Android 阻止React本机应用程序运行,直到它已通过代码推送更新

Android 阻止React本机应用程序运行,直到它已通过代码推送更新,android,react-native,code-push,react-native-code-push,Android,React Native,Code Push,React Native Code Push,我想知道,在代码推送更新之前,是否有可能阻止用户访问应用程序中的任何屏幕,这可能吗?如果可能的话,请给我举个例子,目标是阻止应用程序在下载更新之前启动 您可以使用类似于加载的状态来记录更新是否已下载。 在render()。请参阅下面的代码 componentDidMount() { this.setState({loading: true}); fetch(url).then(() => this.setState({loading: false}) } render() {

我想知道,在代码推送更新之前,是否有可能阻止用户访问应用程序中的任何屏幕,这可能吗?如果可能的话,请给我举个例子,目标是阻止应用程序在下载更新之前启动

您可以使用类似于
加载
的状态来记录更新是否已下载。 在
render()。请参阅下面的代码

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>}
  )
}
componentDidMount(){
this.setState({loading:true});
fetch(url).then(()=>this.setState({loading:false})
}
render(){
const{loading}=this.state;
返回(
{加载和加载(&L)}
{!正在加载&&You普通应用程序内容}
)
}