Hooks
useBottomSheetModal
This hook provides modal functionalities only, for sheet functionalities please look at Bottom Sheet Hooks.
This hook works at any component in
BottomSheetModalProvider
.
import React from 'react';
import { View, Button } from 'react-native';
import { useBottomSheetModal } from '@gorhom/bottom-sheet';
const SheetContent = () => {
const { dismiss, dismissAll } = useBottomSheetModal();
return (
<View>
<Button onPress={dismiss}>
</View>
)
}
dismiss
type dismiss = (key?: string) => void;
Dismiss a modal by its name/key, if key is not provided, then it will dismiss the last presented modal.
dismissAll
type dismissAll = () => void;
Dismiss all mounted/presented modals.