Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with refs in React Native 0.61 #299

Open
Michaelvons opened this issue Jan 10, 2020 · 2 comments
Open

issues with refs in React Native 0.61 #299

Michaelvons opened this issue Jan 10, 2020 · 2 comments

Comments

@Michaelvons
Copy link

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

@Infinitism
Copy link

This doesn't work!

@Michaelvons
Copy link
Author

@Infinitism Kindly share your code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants