react-native-modalize icon indicating copy to clipboard operation
react-native-modalize copied to clipboard

How to access useModalize hook

Open borasumer opened this issue 3 years ago • 6 comments

In the documentation there is useModalize hook but I can't see where you import it.

Screen Shot 2021-11-26 at 2 57 44 PM

borasumer avatar Nov 26 '21 19:11 borasumer

import { useModalize } from 'react-native-modalize/lib/utils/use-modalize'; I imported it from here, but not sure this is how it is supposed to be imported honestly. Thanks

borasumer avatar Nov 26 '21 20:11 borasumer

hi, did u used useModalize without problem? Can u give some example? Thanks

fukemy avatar Aug 10 '22 07:08 fukemy

hi, did u used useModalize without problem? Can u give some example? Thanks

Yes I do use it, sure.

import { useModalize } from 'react-native-modalize/lib/utils/use-modalize';
const { ref, open, close } = useModalize();

borasumer avatar Aug 10 '22 13:08 borasumer

i have multi modalize in some component of app, i wonder how to call each modal by ref or id? Bro did u solved this?

fukemy avatar Aug 10 '22 13:08 fukemy

i have multi modalize in some component of app, i wonder how to call each modal by ref or id? Bro did u solved this?

You can simply call it twice as in;

const { ref: refOne, open: openOne, close: closeOne } = useModalize();
const { ref: refTwo, open: openTwo, close: closeTwo } = useModalize();

I haven't tried but this should work.

borasumer avatar Aug 10 '22 13:08 borasumer

thanks u so much

fukemy avatar Aug 10 '22 14:08 fukemy