Closed
Description
Hi, I would like to reopen #10417
I am having this problem for a while and the only solution that worked for me was to create a timeout big enough that even in slow devices it works.
When using try/catch, if the work is finished quickly (quick api responses for instance), when we setState({showLoader: false}) it won't remove the Modal and we will have to close and run the app again to clear it.
I am going to use the same example as the issue link mentioned
makeRequest = () => {
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>
)
}