This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
分隔线
Jetpack Compose 分割线组件,用于创建视觉分隔符。
Expo UI 提供 HorizontalDivider 和 VerticalDivider,与官方 Jetpack Compose Divider API 相匹配。

安装
🌐 Installation
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
用法
🌐 Usage
水平分隔线
🌐 Horizontal divider
一条细的水平线,用于在列表和布局中视觉上分隔内容。
🌐 A thin horizontal line to visually separate content in lists and layouts.
import { Host, HorizontalDivider, Column, Text } from '@expo/ui/jetpack-compose'; export default function HorizontalDividerExample() { return ( <Host matchContents> <Column> <Text>First section</Text> <HorizontalDivider /> <Text>Second section</Text> </Column> </Host> ); }
自定义厚度和颜色
🌐 Custom thickness and color
HorizontalDivider 和 VerticalDivider 都接受 thickness 和 color 属性。使用 StyleSheet.hairlineWidth 可实现单像素线,或者设置自定义厚度和颜色。
🌐 Both HorizontalDivider and VerticalDivider accept thickness and color props. Use StyleSheet.hairlineWidth for a single-pixel line, or set a custom thickness and color.
import { Host, HorizontalDivider, Column, Text } from '@expo/ui/jetpack-compose'; import { StyleSheet } from 'react-native'; export default function CustomDividerExample() { return ( <Host matchContents> <Column> <Text>Hairline divider (1 pixel)</Text> <HorizontalDivider thickness={StyleSheet.hairlineWidth} /> <Text>Thick colored divider</Text> <HorizontalDivider thickness={4} color="#E91E63" /> <Text>Below</Text> </Column> </Host> ); }
垂直分隔线
🌐 Vertical divider
在行布局中用垂直线分隔并排的项目。
🌐 A vertical line to separate items side by side in a row layout.
import { Host, VerticalDivider, Row, Text } from '@expo/ui/jetpack-compose'; import { height } from '@expo/ui/jetpack-compose/modifiers'; export default function VerticalDividerExample() { return ( <Host matchContents> <Row verticalAlignment="center" modifiers={[height(48)]}> <Text>Left</Text> <VerticalDivider /> <Text>Right</Text> </Row> </Host> ); }
应用接口
🌐 API
import { HorizontalDivider, VerticalDivider } from '@expo/ui/jetpack-compose';
Components
Type: React.Element<ComponentType<DividerCommonConfig>>
A horizontal divider line that groups content in lists and layouts,
matching Compose's HorizontalDivider.
Type: React.Element<ComponentType<DividerCommonConfig>>
A vertical divider line that groups content in layouts,
matching Compose's VerticalDivider.
Types
| Property | Type | Description |
|---|---|---|
| color(optional) | ColorValue | Color of the divider line. |
| modifiers(optional) | ModifierConfig[] | Modifiers for the component. |
| thickness(optional) | number | Thickness of the divider line. Accepts dp values; use |