-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.android.js
83 lines (73 loc) · 1.86 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
74
75
76
77
78
79
80
81
82
83
import React, { Component } from 'react';
import {
AppRegistry,
Navigator,
StyleSheet,
Text,
View
} from 'react-native';
import Map from './app/components/Map';
import Control from './app/components/Control';
import Login from './app/components/Login';
import Report from './app/components/Report';
import Problem from './app/components/Problem';
import Registration from './app/components/Registration';
import CameraView from './app/components/Camera';
const routes = [];
export default class Q3ProjectFE extends Component {
constructor(props) {
super(props);
this.state = {
userInfo: {
id: null,
token: null
},
currentProblem: {}
};
this.getUserInfo = this.getUserInfo.bind(this);
this.saveCurrentProblem = this.saveCurrentProblem.bind(this);
}
getUserInfo(nextState) {
this.setState(nextState);
}
saveCurrentProblem(currentProblem) {
this.setState({
currentProblem
});
}
renderScene(route, navigator) {
switch (route.name) {
case 'login':
return <Login
navigator={navigator}
getUserInfo={this.getUserInfo}
/>
case 'registration':
return <Registration navigator={navigator} />
case 'map':
return <Map
userInfo={this.state.userInfo}
saveCurrentProblem={this.saveCurrentProblem}
currentProblem={this.state.currentProblem}
navigator={navigator}
/>
case 'problem':
return <Problem navigator={navigator} />
case 'camera':
return <CameraView />
default:
return <View>
<Text>EMPTY</Text>
</View>
}
}
render() {
return (
<Navigator
initialRoute={{name: 'login'}}
renderScene={this.renderScene.bind(this)}
/>
);
}
}
AppRegistry.registerComponent('Q3ProjectFE', () => Q3ProjectFE);