-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
143 lines (132 loc) · 3.57 KB
/
App.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import React from 'react';
import { AppRegistry, Platform } from 'react-native';
import { Button, Header } from 'react-native-elements';
import Icon from 'react-native-vector-icons/MaterialIcons'
import { createStackNavigator, createDrawerNavigator, } from 'react-navigation';
// Screens
import LoginScreen from './Screen/LoginScreen';
import ScoreScreen from './Screen/ScoreScreen';
import PastScoreScreen from './Screen/PastScoreScreen';
import EmptyClassroomScreen from './Screen/EmptyClassroomScreen';
import TimetableScreen from './Screen/TimetableScreen';
import AboutScreen from './Screen/AboutScreen';
import CourseTrackerScreen from './Screen/CourseTrackerScreen';
import DrawerComponent from './utils/DrawerComponent';
export default class App extends React.Component {
render() {
// AsyncStorage.clear()
return <RootStack />;
}
}
const DrawerNav = createDrawerNavigator({
Score: {
screen: ScoreScreen,
navigationOptions: {
drawerLabel: "成績查詢",
drawerIcon: ({ tintColor }) => <Icon name="insert-chart" size={24} style={{ color: tintColor }} />
}
},
PastScore: {
screen: PastScoreScreen,
navigationOptions: {
drawerLabel: "歷年成績",
drawerIcon: ({ tintColor }) => <Icon name="show-chart" size={24} style={{ color: tintColor }} />
}
},
EmptyClassroom: {
screen: EmptyClassroomScreen,
navigationOptions: {
drawerLabel: "空教室查詢",
drawerIcon: ({ tintColor }) => <Icon name="room" size={24} style={{ color: tintColor }} />
}
},
Timetable: {
screen: TimetableScreen,
navigationOptions: {
drawerLabel: "個人課表",
drawerIcon: ({ tintColor }) => <Icon name="event" size={24} style={{ color: tintColor }} />
}
},
CourseTracker: {
screen: CourseTrackerScreen,
navigationOptions: {
drawerLabel: "選課人數追蹤",
drawerIcon: ({ tintColor }) => <Icon name="center-focus-weak" size={24} style={{ color: tintColor }} />
}
},
About: {
screen: AboutScreen,
navigationOptions: {
drawerLabel: "關於",
}
}
}, {
contentComponent: props =>
<DrawerComponent {...props} />
});
const RootStack = createStackNavigator(
{
// Main
Main: {
screen: DrawerNav,
navigationOptions: ({ navigation }) => ({
// header start
header: (
<Header
outerContainerStyles={{
borderBottomWidth: 0,
elevation: 5,
}}
leftComponent={
<Button
clear
icon={{
name: 'menu',
color: '#fff'
}}
title=""
onPress={() => { navigation.toggleDrawer() }}
/>
}
centerComponent={{ text: 'NTUSTapp', style: { color: '#fff', fontSize: 18 } }}
rightComponent={
<Button
clear
icon={{
name: 'person',
color: '#fff'
}}
title=""
onPress={() => { navigation.navigate('Login') }}
/>
}
/>
),
// header end
}),
},
// Login
Login: {
screen: LoginScreen,
navigationOptions: {
header: null,
gesturesEnabled: true,
}
}
},
{
mode: 'modal'
}
);
AppRegistry.registerComponent('NTUSTappLite', () => App)
// Nav Arch:
// RootStack {
// StackNav{
// DrawerNav{
// ScoreScreen,
// PastScoreScreen,
// ...
// }
// }
// LoginScreen
// }