BottomSheet
A panel that slides up from the bottom of a mobile screen. Use for a short task without leaving the screen.
Health
Source
Design
Accessibility
unknown
Platform
Mobile
📱 Mobile-only
This component is only for mobile. To see how it looks like you can check the mobile storybook with:
yarn workspace alan-mobile dev:install-client -p ios
yarn workspace alan-mobile dev:storybook
- Overview
- Props
- Figma
info
Mobile components cannot be previewed in the browser. Use Storybook mobile or run the app locally to test.
BottomSheet.Modal​
murray/mobile exposes <BottomSheet.Modal>, which presents a <BottomSheet.View> over the current screen without a navigation route.
See Figma template
It accepts all the props from <BottomSheet.View>, plus:
isOpen: whether the sheet is presented.onCloseComplete: called once the closing animation is over. Use it to open the next sheet or navigate.
It is built on ModalOverlay, which renders through react-native-teleport in the app's own window. Toasts show above it, gestures work inside it, and sheets can be stacked.
const [isOpen, setIsOpen] = useState(true);
return (
<BottomSheet.Modal
emojis={["🥳"]}
title="You're all set !"
message="Message"
isOpen={isOpen}
onClose={() => setIsOpen(false)}
/>
);
BottomSheet.View as a screen​
Present BottomSheet.View as a React Navigation screen when the sheet must open from anywhere, or when it needs screen tracking (Loaded a screen).
// In the navigator
MyModal: {
screen: MyModal,
nativeScreenOptions: BottomSheet.navigationOptions,
},
// MyModal
const navigation = useNavigation<StackNavigationProp<>>();
return (
<BottomSheet.View
closeButton="close"
onClose={() => navigation.goBack()}
title="Title"
>
<MyComponent />
</BottomSheet.View>
);
// When you want to open the modal
navigation.navigateDeprecated("MyModal")