Skip to content

Instantly share code, notes, and snippets.

@FredyC FredyC/App.js
Created Sep 6, 2017

Embed
What would you like to do?
Update Expo app
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Util } from 'expo'
export default class App extends React.Component {
state = {
updated: false,
}
componentWillMount() {
Util.addNewVersionListenerExperimental(() => {
this.setState({ updated: true })
setTimeout(() => Util.reload(), 10000)
})
}
render() {
if (this.state.updated) {
return (<View style={styles.container}>
<Text>App update available, reloading in 10 seconds...</Text>
</View>)
}
return (
<View style={styles.container}>
<Text>App is running...</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
justifyContent: 'center',
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.