I want to use one bottom sheet and I am using useMemo
,
i tried forwardRef
but it didn't work as I have to call same bottomsheet in almost 7-8 screen.
Tried to save ref in Zustand store globally using createRef
or {current:null}
. It works in one screen only but if I come back to the screen and want to reopen, the sheet ref becomes null.
const handleCloseModalPress = () => {
bottomSheetModalRef?.current?.close();
};
const handleRevealPress = () => {
handleCloseModalPress()
navigation.navigate('MainSearch')}
Can someone help? I have tried many things but it's still not working
I want to use one bottom sheet and I am using useMemo
,
i tried forwardRef
but it didn't work as I have to call same bottomsheet in almost 7-8 screen.
Tried to save ref in Zustand store globally using createRef
or {current:null}
. It works in one screen only but if I come back to the screen and want to reopen, the sheet ref becomes null.
const handleCloseModalPress = () => {
bottomSheetModalRef?.current?.close();
};
const handleRevealPress = () => {
handleCloseModalPress()
navigation.navigate('MainSearch')}
Can someone help? I have tried many things but it's still not working
You can create two custom hooks, one for creating a new drawer and returning its ref, and the other one for using it via drawer's id.