分隔线

用于创建视觉分隔线的 Jetpack Compose Divider 组件。

Android
Bundled version:
~55.0.2

Expo UI 分隔线与官方 Jetpack Compose HorizontalDivider API 匹配,并创建一条细水平线以在视觉上分隔内容。

🌐 Expo UI Divider matches the official Jetpack Compose HorizontalDivider API and creates a thin horizontal line to visually separate content.

安装

🌐 Installation

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.

用法

🌐 Usage

基础分隔线

🌐 Basic divider

BasicDividerExample.tsx
import { Host, Divider, Column, Text } from '@expo/ui/jetpack-compose'; export default function BasicDividerExample() { return ( <Host matchContents> <Column> <Text>First section</Text> <Divider /> <Text>Second section</Text> </Column> </Host> ); }

带填充修饰符的分隔符

🌐 Divider with padding modifier

使用 modifiers 属性在分隔线上添加填充。

🌐 Use the modifiers prop to add padding around the divider.

DividerWithPaddingExample.tsx
import { Host, Divider, Column, Text } from '@expo/ui/jetpack-compose'; import { paddingAll } from '@expo/ui/jetpack-compose/modifiers'; export default function DividerWithPaddingExample() { return ( <Host matchContents> <Column> <Text>Section A</Text> <Divider modifiers={[paddingAll(16)]} /> <Text>Section B</Text> <Divider modifiers={[paddingAll(16)]} /> <Text>Section C</Text> </Column> </Host> ); }

应用接口

🌐 API

import { Divider } from '@expo/ui/jetpack-compose';

Component

Divider

Android

Type: React.Element<DividerProps>

A visual element that can be used to separate other content.

DividerProps

modifiers

Android
Optional • Type: ExpoModifier[]

Modifiers for the component.