/*y
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
TouchableOpacity,
View,
} = React;
var Button = require("react-native-button");
var CodePush = require('react-native-code-push');
var CodePushDemoApp = React.createClass({
componentDidMount: function() {
this.fetchData();
},
fetchData: function() {
CodePush.checkForUpdate().done((update) => {
this.setState({ update: update });
});
},
getInitialState: function() {
return { update: false };
},
handlePress: function() {
CodePush.installUpdate(this.state.update).done();
},
render: function() {
var updateView;
if (this.state.update) {
updateView = (
Update Available: {'\n'} {this.state.update.scriptVersion} - {this.state.update.description}
);
};
return (
Welcome to React Native!
To get started, edit index.ios.js
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
{updateView}
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('CodePushDemoApp', () => CodePushDemoApp);