Trigger Once in React native

15 Views Asked by At

I am using

 react-native-simple-events

 useEffect(() => {
        Events.on('onCommonModalShow', '_id' + 'id', onCommonModalShow);
        Events.on('onCommonModalHide', '_id' + 'id', onCommonModalHide);

        return () => {
            Events.rm('onCommonModalShow', '_id' + 'id', onCommonModalShow);
            Events.rm('onCommonModalHide', '_id' + 'id', onCommonModalHide);
        };
    }, []);

As I am using this code in a modal and when I am hitting this and modal open at once. There is a button inside the modal then when user navigate from modal to a screen then even I come back to homepage and trigger the event again then event is not trigging and Modal is not opening. What can be the issue not getting?

0

There are 0 best solutions below