-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavigation.js
64 lines (60 loc) · 2.19 KB
/
Navigation.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
import React from "react";
import { createDrawerNavigator } from "@react-navigation/drawer";
import { NavigationContainer } from "@react-navigation/native";
import SplashScreen from "./screens/splash";
import Login from "./screens/login";
import BookAppointment from "./screens/bookAppointment";
import ViewAppointments from "./screens/viewAppointments";
import ViewPrescription from "./screens/viewPrescription";
import { createStackNavigator } from "@react-navigation/stack";
import Appointment from "./screens/appointment";
import PatientProfile from "./screens/patientProfile";
import { getUser } from "./helpers";
const { user } = getUser();
const Stack = createStackNavigator();
const MainNavigator = () => (
<Stack.Navigator initialRouteName="View Appointments" headerMode="none">
<Drawer.Screen name="View Appointments" component={ViewAppointments} />
<Stack.Screen name="Appointment" component={Appointment} />
<Stack.Screen name="PatientProfile" component={PatientProfile} />
</Stack.Navigator>
);
const Stack2 = createStackNavigator();
const SubNavigator = () => (
<NavigationContainer>
<Stack2.Navigator initialRouteName="Home" headerMode="none">
<Stack.Screen name="Home" component={SplashScreen} />
<Stack2.Screen name="Drawer" component={DrawerNavigator} />
<Stack.Screen name="Login" component={Login} />
</Stack2.Navigator>
</NavigationContainer>
);
const Drawer = createDrawerNavigator();
const DrawerNavigator = () => (
<Drawer.Navigator
drawerStyle={{ backgroundColor: "#413c69" }}
drawerContentOptions={{
activeTintColor: "#fff",
activeBackgroundColor: "#ad62aa",
inactiveTintColor: "#fff",
itemStyle: {
borderBottomColor: "#2c2947",
borderBottomWidth: 1,
paddingBottom: 5,
paddingTop: 5,
marginTop: 0,
marginBottom: 0,
},
}}
>
{user === "doctor" ? (
<Drawer.Screen name="View Appointments" component={MainNavigator} />
) : (
<>
<Drawer.Screen name="Book Appointment" component={BookAppointment} />
<Drawer.Screen name="View Prescription" component={ViewPrescription} />
</>
)}
</Drawer.Navigator>
);
export default SubNavigator;