mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 02:14:52 +08:00
42 lines
876 B
JavaScript
42 lines
876 B
JavaScript
"use strict";
|
|
|
|
var React = require("react-native");
|
|
var CodePush = require("react-native-code-push");
|
|
|
|
var {
|
|
AppRegistry,
|
|
Text,
|
|
View,
|
|
} = React;
|
|
|
|
var IsFirstRunTest = React.createClass({
|
|
getInitialState() {
|
|
return {};
|
|
},
|
|
componentDidMount() {
|
|
CodePush.getCurrentPackage()
|
|
.then((localPackage) => {
|
|
if (localPackage.isFirstRun) {
|
|
this.setState({ passed: true });
|
|
} else {
|
|
this.setState({ passed: false });
|
|
}
|
|
});
|
|
},
|
|
render() {
|
|
var text = "Testing...";
|
|
if (this.state.passed !== undefined) {
|
|
text = this.state.passed ? "Test Passed!" : "Test Failed!";
|
|
}
|
|
|
|
return (
|
|
<View style={{backgroundColor: "white", padding: 40}}>
|
|
<Text>
|
|
{text}
|
|
</Text>
|
|
</View>
|
|
);
|
|
}
|
|
});
|
|
|
|
AppRegistry.registerComponent("IsFirstRunTest", () => IsFirstRunTest); |