0

I wanted to know if it is possible to prevent users from accessing any screen in app until code-push updates, Is this possible? if possible, could you please kindly show me an example, the goal is preventing the app to launch until update has been downloaded.

IsaacK
  • 1,178
  • 1
  • 19
  • 49

1 Answers1

1

You use a state like loading to record if update has been downloaded. In render(), return the normal app content only when loading is false. see my code below.

componentDidMount() {
  this.setState({loading: true});
  fetch(url).then(() => this.setState({loading: false})
}

render() {
  const {loading} = this.state;
  return (
    {loading && <Text>Loading</Text>}
    {!loading && <View>You normal app content</View>}
  )
}
Harlan
  • 847
  • 5
  • 15