admin管理员组文章数量:1418352
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
Share Improve this question edited Feb 3 at 16:18 Hamed Jimoh 1,4228 silver badges20 bronze badges asked Jan 29 at 17:15 ZeeshanZeeshan 18413 bronze badges 1- Have you tried the useBottomSheet hook? gorhom.dev/react-native-bottom-sheet/hooks#usebottomsheet – PhantomSpooks Commented Jan 30 at 0:55
1 Answer
Reset to default 0You 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.
本文标签: reactjsHow can I use one bottomsheet in many screen Gorhom bottomsheet React NativeStack Overflow
版权声明:本文标题:reactjs - How can I use one bottomsheet in many screen Gorhom bottomsheet React Native? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745287593a2651591.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论