This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).
BottomSheet
A SwiftUI BottomSheet component that presents content from the bottom of the screen.
A bottom sheet component that slides up from the bottom of the screen to present content.
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
import { BottomSheet, Host, Text } from '@expo/ui/swift-ui'; import { useWindowDimensions } from 'react-native'; const { width } = useWindowDimensions(); <Host style={{ position: 'absolute', width }}> <BottomSheet isOpened={isOpened} onIsOpenedChange={e => setIsOpened(e)}> <Text>Hello, world!</Text> </BottomSheet> </Host>
See official SwiftUI documentation for more information.
API
Component
Type: React.Element<BottomSheetProps>
booleanSetting it to true will disable the interactive dismiss of the BottomSheet.
(isOpened: boolean) => voidCallback function that is called when the BottomSheet is opened.
PresentationBackgroundInteractionControls how interactions on the dimmed background are handled while the sheet is visible.
automatic- System decides the interaction behavior (default)enabled- Allow touches to pass through to the presenting viewdisabled- Prevent interactions with the presenting view{ type: 'enabledUpThrough', detent: <detent> }- Enable interactions while the sheet is expanded up through the specified detent
PresentationDetent[]Array of presentation detents for the BottomSheet.
Controls the heights that the sheet can snap to.
medium- Medium height sheetlarge- Full height sheet- number (0-1) - Fraction of screen height (for example, 0.4 equals to 40% of screen)
PresentationDragIndicatorVisibilityControls the visibility of the drag indicator for the BottomSheet.
automatic- System decides based on context (default)visible- Always show the drag indicatorhidden- Never show the drag indicator
Types
Type: 'automatic' or 'enabled' or 'disabled' or object shaped as below:
| Property | Type | Description |
|---|---|---|
| detent | PresentationDetent | - |
| type | 'enabledUpThrough' | - |