-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.js
227 lines (219 loc) · 6.32 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
import React , { Component } from 'react';
import { StyleSheet, View, Text, Image } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createStackNavigator } from '@react-navigation/stack';
import { createDrawerNavigator, DrawerContentScrollView, DrawerItemList } from '@react-navigation/drawer';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { LogBox } from "react-native";
import 'react-native-gesture-handler';
LogBox.ignoreLogs(["EventEmitter.removeListener"]);
import BookListScreen from './frontend/screens/BookListScreen';
import BookingScreen from './frontend/screens/BookingScreen';
import BookDetailScreen from './frontend/screens/BookDetailScreen';
import UserProfileScreen from './frontend/screens/UserProfileScreen';
import CreateBookScreen from './frontend/screens/CreateBookScreen';
import UpdateBookScreen from './frontend/screens/UpdateBookScreen';
import SearchBookScreen from './frontend/screens/SearchBookScreen';
import SearchDetailScreen from './frontend/screens/SearchDetailScreen';
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
const Drawer = createDrawerNavigator();
export default class App extends Component {
render() {
return(
<NavigationContainer>
<Stack.Navigator
initialRouteName='TabHome'
screenOptions={{
headerShown: false,
headerTitleStyle: {
fontSize: 20,
fontFamily: 'PlayfairDisplay-Bold',
},
headerStyle: {
backgroundColor: '#1C3879',
},
headerTintColor: '#fff',
}}>
<Stack.Screen
name='TabHome'
component={TabNavigator}></Stack.Screen>
<Stack.Screen
name='BookList'
component={BookListScreen}></Stack.Screen>
<Stack.Screen
name='CreateBook'
component={CreateBookScreen}></Stack.Screen>
<Stack.Screen
name='BookDetail'
component={BookDetailScreen}></Stack.Screen>
<Stack.Screen
name='UpdateBook'
component={UpdateBookScreen}></Stack.Screen>
<Stack.Screen
name='SearchDetail'
component={SearchDetailScreen}></Stack.Screen>
<Stack.Screen
name='Booking'
component={BookingScreen}></Stack.Screen>
</Stack.Navigator>
</NavigationContainer>
);
}
}
class TabNavigator extends Component {
render() {
return (
<Tab.Navigator
initialRouteName={'Home'}
screenOptions={{
tabBarActiveTintColor: '#1C6DD0',
tabBarActiveBackgroundColor: '#E8F9FD',
headerTitleStyle: {
fontSize: 30,
fontFamily: 'PlayfairDisplay-Bold',
},
headerStyle: {
backgroundColor: '#1C3879',
},
headerTintColor: '#fff',
}}
>
<Tab.Screen
name="Home"
component={DrawerNavigator}
options={{
headerShown: false,
tabBarIcon: () => {
return(
<Ionicons name='home' size={20} color={'#607EAA'}></Ionicons>
)
}
}}
/>
<Tab.Screen
name="Profile"
component={UserProfileScreen}
options={{
tabBarIcon: () => {
return(
<Ionicons name='person' size={20} color={'#607EAA'}></Ionicons>
)
}
}}
/>
</Tab.Navigator>
);
}
}
class DrawerNavigator extends Component {
render() {
return(
<Drawer.Navigator
drawerContent={props => <DrawerComponent {...props} />}
screenOptions= {{
drawerActiveTintColor: '#fff',
drawerActiveBackgroundColor: '#1C3879',
drawerStyle: {
backgroundColor: '#fff',
},
drawerLabelStyle: {
marginLeft: -24,
},
headerTitleStyle: {
fontSize: 30,
fontFamily: 'PlayfairDisplay-Bold',
},
headerStyle: {
backgroundColor: '#1C3879',
},
headerTintColor: '#fff',
}}
>
<Drawer.Screen
name='BookList'
component={BookListScreen}
options={{
drawerIcon: ({color}) => (
<Ionicons name='list-outline' size={20} color={color} />
)
}}
/>
<Drawer.Screen
name='SearchBook'
component={SearchBookScreen}
options={{
drawerIcon: ({color}) => (
<Ionicons name='search-outline' size={20} color={color} />
)
}}
/>
</Drawer.Navigator>
);
}
}
class DrawerComponent extends Component {
render() {
return(
<View style={drawerStyles.container}>
<DrawerContentScrollView
{...this.props}
contentContainerStyle={drawerStyles.contentContainerStyle}
>
<View style={drawerStyles.background}>
<View style={drawerStyles.imageBackground}>
<Image
style={drawerStyles.image}
source={require('./assets/images/profile-picture.png')}
/>
</View>
<Text style={drawerStyles.userName}>Lim Choon Kiat</Text>
</View>
<View style={drawerStyles.drawerItemList}>
<DrawerItemList {...this.props} />
</View>
</DrawerContentScrollView>
</View>
);
}
}
const drawerStyles = StyleSheet.create({
container: {
flex: 1,
},
contentContainerStyle: {
backgroundColor: '#1C3879',
},
background: {
backgroundColor: '#1C3879',
padding: 10,
alignItems: 'center',
justifyContent: 'center',
},
imageBackground: {
width: 70,
height: 70,
backgroundColor: '#fff',
padding: 15,
borderRadius: 35,
alignItems: 'center',
justifyContent: 'center'
},
image: {
width: 64,
height: 64,
borderRadius: 32
},
userName: {
fontSize: 18,
fontFamily: 'PlayfairDisplay-Bold',
color: '#fff',
textAlign: 'center',
},
drawerItemList: {
backgroundColor: '#fff',
flex: 1,
paddingTop: 10,
},
});