-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.android.js
73 lines (66 loc) · 2.99 KB
/
index.android.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React from 'react';
import {AppRegistry, Navigator} from 'react-native';
import HomePage from "./components/HomePage";
import SettingsPage from "./components/SettingsPage";
import BeaconsIndexPage from "./components/beacons/IndexPage";
import BeaconsShowPage from "./components/beacons/ShowPage";
import JourneysIndexPage from "./components/journeys/IndexPage";
import JourneysShowPage from "./components/journeys/ShowPage";
//import {presentationMode} from "./lib/dev_helper";
//if (presentationMode == true) {
// console.ignoredYellowBox = ['Warning: setState(...)']; // for demonstration purposes, ignore the warning message: "Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the HomePage component."
//}; OK SO IT TURNS OUT THE WARNING MESSAGES THAT WERE PREVIOUSLY GETTING DISPLAYED HAVE BEEN FIXED, SO DON'T NEED THIS RIGHT NOW, BUT LEAVING THE OPTION HERE FOR THE FUTURE...
// This component controls navigation between other components.
const App = React.createClass({
componentWillMount: function(){ console.log("APP WILL MOUNT") },
componentDidMount: function(){ console.log("APP DID MOUNT") },
componentWillReceiveProps: function(nextProps){ console.log("APP WILL RECEIVE PROPS") },
componentWillUpdate: function(nextProps, nextState){ console.log("APP WILL UPDATE") },
componentDidUpdate: function(prevProps, prevState){ console.log("APP DID UPDATE") },
componentWillUnmount: function(){ console.log("APP WILL UNMOUNT") },
renderScene(route, navigator) {
switch (route.name) {
case 'Home':
return <HomePage navigator={navigator} {...route.passProps} />
break;
case 'Beacons':
return <BeaconsIndexPage navigator={navigator} {...route.passProps} />
break;
case 'Beacon':
return <BeaconsShowPage navigator={navigator} {...route.passProps} />
break;
case 'Settings':
return <SettingsPage navigator={navigator} {...route.passProps} />
break;
case 'Journeys':
return <JourneysIndexPage navigator={navigator} {...route.passProps} />
break;
case 'Journey':
return <JourneysShowPage navigator={navigator} {...route.passProps} />
break;
};
},
configureScene(route, routeStack){
switch (route.type) {
case 'Back':
return Navigator.SceneConfigs.FloatFromLeft;
break;
case 'Menu':
return Navigator.SceneConfigs.FadeAndroid;
break;
default:
return Navigator.SceneConfigs.PushFromRight;
};
},
render: function(){
return (
<Navigator
style={{ flex:1 }}
initialRoute={{ name: 'Home' }} // Specify which component should show up when the app is loaded.
renderScene={ this.renderScene }
configureScene={ this.configureScene }
/>
);
}
});
AppRegistry.registerComponent('BeaconNavigator', function(){ return App; });