Box
A Jetpack Compose Box component for stacking child elements.
Android
Expo UI Box matches the official Jetpack Compose Box API and stacks children on top of each other with configurable content alignment.
Installation
Terminal
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Box stacks children on top of each other. Use contentAlignment to position them within the box.
BoxExample.tsx
import { Host, Box, Text } from '@expo/ui/jetpack-compose'; import { size, background } from '@expo/ui/jetpack-compose/modifiers'; export default function BoxExample() { return ( <Host matchContents> <Box contentAlignment="center" modifiers={[size(200, 200), background('#E0E0E0')]}> <Text>Centered in Box</Text> </Box> </Host> ); }
API
import { Box } from '@expo/ui/jetpack-compose';
Component
Optional • Type:
FloatingToolbarExitAlwaysScrollBehaviorScroll behavior for the floating toolbar exit.