This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
LazyVStack
用于创建惰性垂直布局的 SwiftUI LazyVStack 组件。
iOS
tvOS
Included in Expo Go
Expo UI 的 LazyVStack 与官方 SwiftUI LazyVStack API 相对应,会垂直排列其子项,并仅在需要时(滚动过程中变为可见时)创建内容
LazyVStack目前还不是真正的惰性加载:原生端只会构建可见项,但 React 仍会预先创建所有子项,因此大型列表可能需要较长时间才能挂载。我们正在努力改进这一点。对于大型列表,我们推荐使用 FlashList 或 Legend List。
安装
Terminal
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本惰性垂直堆栈
应在 ScrollView 中使用 LazyVStack,以启用惰性渲染。
BasicLazyVStackExample.tsx
使用对齐方式
alignment 属性用于控制子项的水平对齐方式。可用选项有:leading、center 和 trailing。
LazyVStackAlignmentExample.tsx
API
import { LazyVStack } from '@expo/ui/swift-ui';
Component
Type: React.Element<LazyVStackProps>
Optional • Literal type:
stringThe horizontal alignment of children within the stack.
Acceptable values are: 'center' | 'leading' | 'trailing'
Type:
ReactNode