Reference version

用于水平放置子组件的 Jetpack Compose Row 组件。

Android
Included in Expo Go
Bundled version:
~56.0.6

For the complete documentation index, see llms.txt. Use this file to discover all available pages.

有关跨平台用法,请参阅通用的 Row — 它会为每个平台渲染相应的原生组件。

Expo UI Row 与官方 Jetpack Compose Row API 一致,并以可配置的排列和对齐方式将子元素水平放置。

Three colored boxes laid out horizontally inside a Row

安装

Terminal
npx expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

用法

Row 会将子元素水平放置。使用 horizontalArrangementverticalAlignment 来控制间距和对齐。

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

Row

Android

Type: React.Element<RowProps>

RowProps

children

Android
Optional • Type: React.ReactNode

horizontalAlignment

Android
Optional • Type: HorizontalAlignment

Horizontal alignment of children.

horizontalArrangement

Android
Optional • Type: HorizontalArrangement

Horizontal arrangement of children.

verticalAlignment

Android
Optional • Type: VerticalAlignment

Vertical alignment of children.

verticalArrangement

Android
Optional • Type: VerticalArrangement

Vertical arrangement of children.

Inherited Props

  • PrimitiveBaseProps