maxs15 / maxs15/react-native-modalbox

issues with refs in React Native 0.61

Open
#299 2 comments 6 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.