Spacer
A layout spacer that produces empty space between siblings.
For the complete documentation index, see llms.txt. Use this file to discover all available pages.
A layout spacer that produces empty space between siblings inside a Row or Column. Use size for a fixed gap, or flexible to fill the remaining main-axis space.
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
Fixed-size spacer
import { Host, Column, Text, Spacer } from '@expo/ui'; export default function FixedSpacerExample() { return ( <Host matchContents> <Column> <Text>Top</Text> <Spacer size={32} /> <Text>Bottom</Text> </Column> </Host> ); }
Flexible spacer
A flexible spacer fills the remaining space along its parent's main axis, pushing the surrounding content to opposite ends.
import { Host, Row, Text, Spacer } from '@expo/ui'; export default function FlexibleSpacerExample() { return ( <Host style={{ flex: 1 }}> <Row> <Text>Leading</Text> <Spacer flexible /> <Text>Trailing</Text> </Row> </Host> ); }
API
import { Spacer } from '@expo/ui';
Component
Type: React.Element<SpacerProps>
A layout spacer that produces empty space between siblings in a
Row or Column.
Props for the Spacer component.
A Spacer produces empty space between siblings in a Row or
Column. Use size for a fixed amount of space, or flexible
to fill the remaining space along the parent's main axis.
booleanWhether the component is disabled. Disabled components do not respond to user interaction.
boolean • Default: falseWhen true, the spacer expands to fill the available space along the
parent's main axis, pushing sibling content to the opposite end.
ModifierConfig[]Platform-specific modifier escape hatch. Pass an array of modifier configs
from @expo/ui/swift-ui/modifiers or @expo/ui/jetpack-compose/modifiers.
() => voidCalled when the component is removed from screen.
numberFixed size in density-independent pixels. Interpreted as width in a horizontal container and as height in a vertical container.
Pick<ViewStyle, 'padding' | 'paddingHorizontal' | 'paddingVertical' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'backgroundColor' | 'borderRadius' | 'borderWidth' | 'borderColor' | 'opacity' | 'width' | 'height'>Platform-agnostic style properties. These are translated to SwiftUI modifiers on iOS and Jetpack Compose modifiers on Android.