maxs15 / maxs15/react-native-modalbox
issues with refs in React Native 0.61
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 496
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the repository's Modal component implementation and inspect how refs are handled under React Native 0.61. Reproduce the reported ref usage, then verify that a ref can call the modal's open() method as shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100