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 Spacer 组件。
Android
Included in Expo Go
如需跨平台使用,请查看通用的
Spacer— 它会根据平台渲染相应的原生组件。
Expo UI Spacer 与官方 Jetpack Compose Spacer API 一致,用于在布局中添加可伸缩或固定大小的间距。


安装
Terminal
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
带权重的 Spacer
使用 weight() 修饰符,使 spacer 在 Row 或 Column 中按比例填充可用空间。
SpacerWeightExample.tsx
固定尺寸的 Spacer
使用 height 或 width 修饰符来创建具有固定尺寸的 spacer。
SpacerFixedSizeExample.tsx
API
import { Spacer } from '@expo/ui/jetpack-compose';
Component
Type: React.Element<SpacerProps>
A spacer component that fills available space.
Use with the weight() modifier to create flexible spacing in Row or Column layouts.
Example
<Row> <Text>Left</Text> <Spacer modifiers={[weight(1)]} /> <Text>Right</Text> </Row>