[Discussion] Interop Story with Portal #2288
-
Hi there! Huge fan! When using I noticed that when I was trying to open the I can minimally reproduce this issue with the following: import {useCallback, useRef} from "react";
import {BottomSheetModal, BottomSheetModalProvider, BottomSheetView} from "@gorhom/bottom-sheet";
import {GestureHandlerRootView} from "react-native-gesture-handler";
import {PortalProvider} from "@gorhom/portal";
import {Button} from "react-native";
function App() {
const bottomSheetModalRef = useRef<BottomSheetModal>(null);
const handlePresentModalPress = useCallback(() => {
bottomSheetModalRef.current?.present();
}, []);
return <PortalProvider shouldAddRootHost={false}>
<GestureHandlerRootView style={{flex: 1}}>
<BottomSheetModalProvider>
<BottomSheetModal
ref={bottomSheetModalRef}
>
<BottomSheetView
>
<Text>Hi!</Text>
</BottomSheetView>
</BottomSheetModal>
</BottomSheetModalProvider>
<Button title="Open" onPress={handlePresentModalPress}/>
</GestureHandlerRootView>
</PortalProvider>
} However, after some digging I realized it's because However, this opens a totally different non-bug related question:
I would argue "no" and suggest that we add a However, even if the answer is "yes", we should document this edgecase somewhere. WDYT? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
hi @crutchcorn, thanks for opening up this issue/discussion. based on your initial investigation, you are right. The bottom sheet modal should not mount on the most-top portal-host but instead the portal-host added by the bottom sheet modal provider. seems like a bug, i'll give it a quick look and see if that something i could fix today, if not feel free to cut a PR :) |
Beta Was this translation helpful? Give feedback.
-
did a quick investigation and found that by default the bottom sheet modal does not provide a custom host name for the portal, therefore it remains as the default value |
Beta Was this translation helpful? Give feedback.
-
this should be addressed in |
Beta Was this translation helpful? Give feedback.
this should be addressed in
v5.1.5