Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit d07b96a

Browse files
author
Will Anderson
committed
Update example to use new HybridMobileDeploy implementation
1 parent 45048f5 commit d07b96a

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

Examples/HybridMobileDeployCompanion/index.ios.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,41 @@ var {
99
AppRegistry,
1010
StyleSheet,
1111
Text,
12+
TouchableOpacity,
1213
View,
1314
} = React;
1415

15-
var HybridMobileDeploy = require('react-native-hybrid-mobile-deploy')('http://localhost:3000/', 'HybridMobileDeployCompanion');
16+
var Button = require("react-native-button");
17+
18+
var HybridMobileDeploy = require('react-native-hybrid-mobile-deploy')('http://localhost:3000/', '<deployment key here>');
1619

1720
var HybridMobileDeployCompanion = React.createClass({
21+
componentDidMount: function() {
22+
this.fetchData();
23+
},
24+
fetchData: function() {
25+
HybridMobileDeploy.queryUpdate((err, update) => {
26+
this.setState({ update: update, updateString: JSON.stringify(update) });
27+
});
28+
},
29+
getInitialState: function() {
30+
return { update: false, updateString: "" };
31+
},
32+
handlePress: function() {
33+
console.log("pressed");
34+
},
1835
render: function() {
36+
var updateView;
37+
if (this.state.update) {
38+
updateView = (
39+
<View>
40+
<Text>Update Available: {'\n'} {this.state.update.scriptVersion} - {this.state.update.description}</Text>
41+
<Button style={{color: 'green'}} onPress={this._handlePress}>
42+
Update
43+
</Button>
44+
</View>
45+
);
46+
};
1947
return (
2048
<View style={styles.container}>
2149
<Text style={styles.welcome}>
@@ -28,6 +56,7 @@ var HybridMobileDeployCompanion = React.createClass({
2856
Press Cmd+R to reload,{'\n'}
2957
Cmd+D or shake for dev menu
3058
</Text>
59+
{updateView}
3160
</View>
3261
);
3362
}

Examples/HybridMobileDeployCompanion/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"dependencies": {
99
"react-native": "^0.8.0-rc",
10-
"react-native-hybrid-mobile-deploy": "file:../.."
10+
"react-native-hybrid-mobile-deploy": "file:../..",
11+
"react-native-button": "^1.2.0"
1112
}
1213
}

0 commit comments

Comments
 (0)