react-native-modalbox
react-native-modalbox copied to clipboard
issues with refs in React Native 0.61
The fix is to make use of react-native hooks
import the UseRef Hook
import React, {useRef} from 'react';
create a variable using it
const modal3 = useRef();
in the Modal prop, refer to the ref
<Modal
ref={modal3}>
...
</Modal>
Open your modal using the open() Method like so:
<Button
title="Open Modal"
onPress={() => modal3.current.open()}
/>
voila !!. It works
This doesn't work!
@Infinitism Kindly share your code