This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
列表
一个虚拟化的垂直行容器,与可点击的 ListItem 基元配对使用
List 提供一个虚拟化的垂直行容器,通常填充 ListItem 子元素。它提供平台原生的界面样式(分隔线、内嵌样式、下拉刷新)。ListItem 是一个可点击的行,带有 leading/trailing/supportingText 插槽。
List目前还不会延迟渲染行:React 会预先创建每一行,因此大型列表的挂载速度可能较慢。我们正在努力改进这一点。对于大型列表,我们推荐使用 FlashList 或 Legend List。
原生实现


安装
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本列表
带插槽的行
ListItem 接受 leading、trailing 和 supportingText 简写属性,用于常见场景。当需要更丰富的内容时,为其中任意属性传入一个 ReactNode。
复合插槽子元素
要完全控制插槽内容,请使用复合 API:<ListItem.Leading>、<ListItem.Trailing> 和 <ListItem.Supporting>。任何未包裹在插槽中的内容都会成为标题。
下拉刷新
传入一个 async onRefresh 处理函数。平台原生的刷新指示器会一直显示,直到返回的 promise 完成(resolve 或 reject)。
下拉刷新目前尚未在 Web 上实现。为保持 API 一致性,处理函数会被接受,但指示器只会在 Android 和 iOS 上显示
API
import { List, ListItem } from '@expo/ui';
Component
Type: React.Element<ListProps>
A vertical container of rows.
Typically populated with ListItem children.
() => Promise<void>Optional pull-to-refresh handler. When provided, the list shows the platform-native refresh affordance. The returned promise drives the indicator's visibility.
Components
Type: React.Element<ListItemProps>
A tappable row in a list.
Composes with List.
Pass row content via the leading / trailing / supportingText shorthand props or the compound <ListItem.Leading> / <ListItem.Trailing> / <ListItem.Supporting> slot children.
Props for the ListItem component.
A tappable row in a list.
ReactNodeHeadline content of the row. The remaining (non-slot) children are rendered in the headline area.
ListItemColorsRow colors. Applied on Android via Compose's ListItem.colors.
ReactNodeShorthand for the leading slot.
Overridden by <ListItem.Leading> if both are provided.
ModifierConfig[]Platform-specific modifier escape hatch. Pass an array of modifier configs
from @expo/ui/swift-ui/modifiers or @expo/ui/jetpack-compose/modifiers.
On iOS these are applied to the underlying SwiftUI Button and can override
its default buttonStyle(.plain).
() => voidTap handler. Activates over the entire row rectangle, including the empty gap between leading/headline/trailing.
ReactNodeShorthand for the supporting (sub-)text slot.
Strings are rendered with platform-appropriate secondary styling; pass a ReactNode for richer content.
Overridden by <ListItem.Supporting> if both are provided.
stringIdentifier used to locate the component in end-to-end tests.
ReactNodeShorthand for the trailing slot.
Overridden by <ListItem.Trailing> if both are provided.