This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
LazyRow
用于显示水平滚动列表的 Jetpack Compose LazyRow 组件。
一种采用延迟加载的水平列表组件,仅渲染可见项目以实现高效滚动。有关更多信息,请参阅 Jetpack Compose 官方文档。
信息
LazyRow目前还不是真正的延迟加载:原生端只会组合可见项目,但 React 仍会预先创建每个子项,因此大型列表的挂载速度可能较慢。我们正在努力改进这一点。对于大型列表,我们推荐使用 FlashList 或 Legend List。


安装
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本延迟加载行
使用排列方式
使用 horizontalArrangement 属性控制列表中项目之间的间距。传入类似 'spaceBetween' 的字符串值,或传入类似 { spacedBy: 8 } 的对象以设置固定的 dp 间距。
使用内容内边距
使用 contentPadding 属性以 dp 为单位在列表内容周围添加内边距。
API
import { LazyRow } from '@expo/ui/jetpack-compose';
Component
Type: React.Element<LazyRowProps>
A lazy row component that efficiently displays a horizontally scrolling list.
unionThe horizontal arrangement of items.
Can be a preset string or an object with spacedBy to specify spacing in dp.
Acceptable values are: 'center' | 'start' | 'end' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly' | {
spacedBy: number
}