I have a modal Reviews in one File with children prop, so when I add my modal Reviews file in a other file how can I open the modal ?
Modal Reviews:
const ParentReviews = ({
children,
onPressOpenModal
}: IParentReviews) => {
const modalReviewsRef = useRef<BottomSheetModal>(null);
const handleOpenModalReviews = (shop_id: number) => modalReviewsRef.current?.present();
return (
<>
{
children
}
<ModalReviews
ref={modalReviewsRef}
/>
</>
)
}
const s = StyleSheet.create({
});
export default ParentReviews
MainFile.tsx
const Home = () => {
return (
<ParentReviews onPressOpenModal={}>
<ScrollView keyboardShouldPersistTaps='handled' style={s.modalContainer} contentContainerStyle={s.scrollView}>
<Pressable onPress={}>
<Text>Open Modal</Text>
</Pressable>
</ScrollView>
</ParentReviews>
)
});
So how can I run this function When clicking on Open Modal Button on MainFile?
const handleOpenModalReviews = (shop_id: number) => modalReviewsRef.current?.present();
I am very thankful for your help!!