BottomSheet
alpha
The bottomsheet component is simpler implementation of gorhom bottomsheet.
Installation
API Reference
Installation
CLI
Manual
Run the following command:
npx gluestack-ui add bottomsheet
Important Note
Note: you need to install specific versions of @gorhom/bottom-sheet@5.0.0-alpha.10 (v5), react-native-reanimated version ~3.6.2 and react-native-gesture-handler version ~2.14.0.
API Reference
To use this component in your project, include the following import statement in your file.
import {BottomSheet,BottomSheetBackdrop,BottomSheetContent,BottomSheetDragIndicator,BottomSheetItem,BottomSheetItemText,BottomSheetPortal,BottomSheetTrigger,} from "@/components/ui/bottomsheet"
export default () => (<BottomSheet><BottomSheetTrigger><Text>Open BottomSheet</Text></BottomSheetTrigger><BottomSheetPortalsnapPoints={["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>)
Component Props
This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.
BottomSheet
It is a context provider for entire bottomsheet api.
Props
Prop | Type | Default | Description |
---|---|---|---|
snapToIndex | number | 1 | index of snapPoints at which bottomsheet initially opens. |
onOpen | () => void | - | callback function which trigger when bottomsheet is opens. |
onClose | () => void | - | callback function which trigger when bottomsheet is closed. |
BottomSheetTrigger
It inherits all the properties of React Native's pressable component.
BottomSheetPortal
it's a gorhom BottomSheet component. inherits all the properties of gorhom BottomSheet.
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. |
BottomSheetContent
It inherits all the properties of gorhom BottomSheetView.
BottomSheetItem
It inherits all the properties of React Native's Pressable component.
BottomSheetItemText
It inherits all the properties of React Native's Text component.
BottomSheetTextInput
It inherits all the properties of gorhom BottomSheetTextInput.
BottomSheetScrollView
It inherits all the properties of gorhom BottomSheetScrollView.
BottomSheetFlatList
It inherits all the properties of gorhom BottomSheetFlatList.
BottomSheetSectionList
It inherits all the properties of gorhom BottomSheetSectionList.