colorfy-software / react-native-modalfy

🥞 Modal citizen of React Native.
https://colorfy-software.gitbook.io/react-native-modalfy
MIT License
1.16k stars 48 forks source link

Is it possible to pass a parameter which is a callback function to the modal? #138

Closed kokosky93 closed 8 months ago

kokosky93 commented 10 months ago

Hi,

I am struggling how to do the following things

I need to notify my react native component which opened a modal when the modal is closed. How can I do this?

Is it possible to pass parameters from a modal component to a component which opened the modal?

Anyone would know how can I do this?

CharlesMangwa commented 8 months ago

hey @kokosky93! thanks for your patience with this reply. what you're asking for is possible via a mix of modal.addListener & modal.params.

i've modified the demo snack to make a functional example of what you're trying to achieve: https://snack.expo.dev/safxFTYCR7x1FVsncrkmt. you can focus on ./components/IntroButton.tsx#L16 & ./components/IntroModal.tsx#L73 and follow the threads from there.

hope this helps!