maxs15 / maxs15/react-native-modalbox

onOpened() Call Twice

Open
#257 2 comments 1 reaction 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

Description:
onOpened() always call twice while onClosed() only call once. I tested using public method open() and update attribute isOpen to true. It will give same result, onOpened() call twice.

Environment:
What version of the react SDK are you using?
"react": "^16.6.0"

What version of the react-native SDK are you using?
"react-native": "^0.57.4"

What version of the react-native-modalbox SDK are you using?
"react-native-modalbox": "^1.6.0"

How did you add the SDK to your project (eg. npm)
yarn add react-native-modalbox@latest --save

Android Version:
Android Marshmallow 6.0.1

Steps to Reproduce Issue:

  1. run react-native init testingmodalbox
  2. run yarn add react-native-modalbox@latest --save
  3. Implement react-native-modalbox on App.js
<Modal
    onOpened={()=> {console.log('onopened')}}
    onClosed={()=> {console.log('onclosed')}}
    ref={this.modal}
    style={{backgroundColor:'white', height:100, width:330, borderRadius:4, padding:10, elevation:5}}
    swipeToClose={false}
    animationDuration={500}
    position="center"
    backdropPressToClose={false}>

      <View>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
        <Text style={styles.instructions}>{instructions}</Text>
      </View>
</Modal>
  1. Look at log, you will find onopened print twice.

Anyone face the same issue here?

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 with the App.js reproduction using the public open() method and the isOpen attribute, then inspect the modal lifecycle handling for onOpened and onClosed. Done means opening the modal produces one onOpened callback while closing it still produces one onClosed callback; verify this from the logged output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.