-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
108 lines (99 loc) · 3.46 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
import 'react-native-gesture-handler';
import React from 'react';
import { DefaultTheme, NavigationContainer, useTheme } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { Provider } from 'react-redux';
import RegisterView from './src/views/Register/RegisterView';
import AppointmentsView from './src/views/Appointments/AppointmentsView';
import store from './src/setup/store';
import LoginView from './src/views/Login/LoginView';
import AppointmentDetailsView from './src/views/AppointmentDetails/AppointmentDetailsView';
import HeaderProfile from './src/common/header/HeaderProfile';
import HeaderNotification from './src/common/header/HeaderNotification';
import AppointmentNew from './src/views/AppointmentNew/AppointmentNew';
import QRCodeView from './src/views/QRCode/QRCode';
import { colors } from './theme';
import initFeathersClient from './src/setup/feathersClient';
import FlashMessage from 'react-native-flash-message';
import withSideMenu from './src/common/sideMenu/SideMenuHOC';
import Menu from './src/common/sideMenu/SideMenu';
initFeathersClient();
const Stack = createStackNavigator();
const RootStack = createStackNavigator();
const theme = {
...DefaultTheme,
colors
};
//TODO: create header title component to add accessibilityLabel prop
function StackScreen() {
const theme = useTheme();
return (
<Stack.Navigator initialRouteName="Login">
<Stack.Screen
name="AppointmentDetails"
component={AppointmentDetailsView}
options={{
headerStyle: {
backgroundColor: theme.colors.background
},
headerTitle: 'Back'
}}
/>
<Stack.Screen
name="Appointments"
component={withSideMenu(AppointmentsView, Menu)}
options={({ navigation }) => ({
headerStyle: {
backgroundColor: theme.colors.background
},
headerTitle: 'My Turns',
headerTitleAlign: 'center',
headerTitleStyle: { color: theme.colors.secondary },
headerLeft: props => <HeaderProfile {...props} navigation={navigation} />,
headerLeftContainerStyle: { paddingHorizontal: 10 },
headerRight: props => <HeaderNotification {...props} />,
headerRightContainerStyle: { paddingHorizontal: 10 }
})}
/>
<Stack.Screen
name="AppointmentNew"
component={AppointmentNew}
options={{
headerStyle: {
backgroundColor: theme.colors.background
},
headerTitle: 'New Appointment',
headerTitleStyle: { color: theme.colors.secondary },
headerTitleAlign: 'center'
}}
/>
<Stack.Screen
name="Register"
component={RegisterView}
options={{
headerShown: false
}}
/>
<Stack.Screen
name="Login"
component={LoginView}
options={{
headerShown: false
}}
/>
</Stack.Navigator>
);
}
export default function App() {
return (
<Provider store={store}>
<NavigationContainer theme={theme}>
<RootStack.Navigator mode="modal">
<RootStack.Screen name="Main" component={StackScreen} options={{ headerShown: false }} />
<RootStack.Screen name="QRCode" component={QRCodeView} options={{ headerShown: false }} />
</RootStack.Navigator>
</NavigationContainer>
<FlashMessage position={'bottom'} floating={true} />
</Provider>
);
}