This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 55).
行
用于将子项水平放置的 Jetpack Compose Row 组件。
Android
For the complete documentation index, see llms.txt. Use this Use this file to discover all available pages.
Expo UI Row 与官方 Jetpack Compose Row API 一致,并以可配置的排列和对齐方式将子元素水平放置。
安装
Terminal
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
用法
Row 会将子元素水平排列。使用 horizontalArrangement 和 verticalAlignment 来控制间距和对齐。
RowExample.tsx
import { Host, Row, Text } from '@expo/ui/jetpack-compose'; import { fillMaxWidth, height } from '@expo/ui/jetpack-compose/modifiers'; export default function RowExample() { return ( <Host matchContents> <Row horizontalArrangement="spaceEvenly" verticalAlignment="center" modifiers={[fillMaxWidth(), height(60)]}> <Text>项目 1</Text> <Text>项目 2</Text> <Text>项目 3</Text> </Row> </Host> ); }
API
import { Row } from '@expo/ui/jetpack-compose';
Component
Optional • Type:
HorizontalArrangementHorizontal arrangement of children.