npx gluestack-ui add bottomsheetimport {
BottomSheet,
BottomSheetBackdrop,
BottomSheetContent,
BottomSheetDragIndicator,
BottomSheetItem,
BottomSheetItemText,
BottomSheetPortal,
BottomSheetTrigger,
} from '@/components/ui/bottomsheet';
export default () => (
<BottomSheet>
<BottomSheetTrigger>
<Text>Open BottomSheet</Text>
</BottomSheetTrigger>
<BottomSheetPortal
snapPoints={['25%', '50%']}
backdropComponent={BottomSheetBackdrop}
handleComponent={BottomSheetDragIndicator}
>
<BottomSheetContent>
<BottomSheetItem>
<BottomSheetItemText>Item 1</BottomSheetItemText>
</BottomSheetItem>
<BottomSheetItem>
<BottomSheetItemText>Item 2</BottomSheetItemText>
</BottomSheetItem>
<BottomSheetItem>
<BottomSheetItemText>Item 3</BottomSheetItemText>
</BottomSheetItem>
</BottomSheetContent>
</BottomSheetPortal>
</BottomSheet>
);
| Prop | Type | Default | Description |
|---|---|---|---|
snapToIndex | number | 1 | index of snapPoints at which bottomsheet initially opens. |
onOpen | () => void | - | callback function which trigger when bottomsheet is opened. |
onClose | () => void | - | callback function which trigger when bottomsheet is closed. |
| Prop | Type | Default | Description |
|---|---|---|---|
snapPoints | Array<string | number> | - | Points for the bottom sheet to snap to. It accepts array of number, string or mix. String values should be a percentage. |