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

Modal not work on Android when using State to hide it in try/catch section #10417

Closed
raminious opened this issue Oct 16, 2016 · 3 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@raminious
Copy link

raminious commented Oct 16, 2016

Issue Description

Modal component not worked on android when changing state to hide it in try/catch section

Steps to Reproduce / Code Snippets

makeReauest = () => {
  this.setState({ loading: true })
  Media.request(url)
  .then(response => {
    // todo
  }, e => {
    this.setState({ loading: false })
  })
}

render() {
  return(
    <View>
      <Modal
          animationType={'slide'}
          transparent={false}
          visible={this.state.loading}
          onRequestClose={() => {} }
       >
        <View></View>
      </Modal>
      <Text onPress={this.makeRequest}>Do Magic</Text>
    </View>
  )
}

Result

image

Additional Information

  • React Native version: 0.35.0
  • Platform: just Android
  • Android Version: 5.1.0 on Google Nexus 6 (Genymotion Simulator)
  • Operating System: macOS
@raminious raminious changed the title Modal not work on Android when using States to hide on Try/Catch Modal not work on Android when using State to hide it in Catch section Oct 16, 2016
@raminious raminious changed the title Modal not work on Android when using State to hide it in Catch section Modal not work on Android when using State to hide it in try/catch section Oct 16, 2016
@raminious
Copy link
Author

raminious commented Oct 16, 2016

when I changed catch section from

e => {
  this.setState({ loading: false })
}

to:

setTimeout(() => {
  this.setState({ loading: false })
}, 100)

it works

@ying-huang
Copy link

ying-huang commented Dec 2, 2016

I am having a similar problem in iOS.

@santospatrick
Copy link

Can we reopen this please? setTimeout did not work for me, i am setting state of loading for false after async call and the Modal does not hide in standalone app, and does not throw any error. I tried to use timeout and restart my phone and nothing happens

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants