maxs15 / react-native-modalbox

A <Modal/> component for react-native
MIT License
2.9k stars 505 forks source link

onOpened() Call Twice #257

Open abdullahizzuddiin opened 5 years ago

abdullahizzuddiin commented 5 years ago

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>
  4. Look at log, you will find onopened print twice.

Anyone face the same issue here?

mojtaba-hajishah commented 5 years ago

Same for me. react-native-modalbox: 1.7.1

dmsierra11 commented 5 years ago

Any update on this?