-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.ios.js
59 lines (53 loc) · 1.58 KB
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';
import React, {
Component,
AppRegistry,
Navigator,
AlertIOS
} from 'react-native';
import LoginPage from './app/components/login/loginPage';
import AddEntryPage from './app/components/addEntry/addEntryPage';
import MonthlySummaryPage from './app/components/monthlySummary/monthlySummaryPage';
import MainPage from './app/components/mainPage';
import CodePush from 'react-native-code-push';
import AppConfig from './appConfig.js';
const RoutableComponents = {
'Login': LoginPage,
'Add Entry': AddEntryPage,
'Monthly Summary': MonthlySummaryPage,
'Main Page': MainPage
};
class MoveIt extends Component {
componentDidMount() {
if(!AppConfig.isDevelopment()) {
CodePush.sync({
deploymentKey: AppConfig.codePushKey,
updateDialog: {
appendReleaseDescription: true,
descriptionPrefix: '\n\nChange log:\n'
},
installMode: CodePush.InstallMode.IMMEDIATE
}, (status) => {
if(status === CodePush.SyncStatus.DOWNLOADING_PACKAGE) {
AlertIOS.alert(
'Installing Update',
'Please wait for the app to refresh automatically'
);
}
});
}
}
renderScene(route, navigator) {
var RoutableComponent = RoutableComponents[route.name];
return <RoutableComponent navigator={navigator} {...route.passProps} />;
}
render() {
return (
<Navigator
initialRoute={{name: 'Add Entry', component: AddEntryPage}}
renderScene={this.renderScene.bind(this)}
/>
);
}
}
AppRegistry.registerComponent('MoveIt', () => MoveIt);