2017-08-22 2 views

Répondre

1

Vous utilisez un état tel que loading pour enregistrer si la mise à jour a été téléchargée. Dans render(), renvoyez le contenu normal de l'application uniquement lorsque loading est faux. voir mon code ci-dessous.

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>} 
) 
}