forked from GACOSTA1988/Hovrtek-Drone-Services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appNavigationUtils.js
124 lines (115 loc) · 4.2 KB
/
appNavigationUtils.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
import React from "react";
import { createStackNavigator } from "@react-navigation/stack";
import { createDrawerNavigator } from '@react-navigation/drawer';
import { NavigationContainer } from '@react-navigation/native';
import {AboutNavigation, SupportNavigation} from "./navigation/AboutSupportNavigationStack";
import PilotCreateProfileNavigation from "./navigation/PilotCreateProfileNavigation";
import ClientProfileNavigator from "./navigation/ClientProfileNavigation";
import SignUpNavigation from "./navigation/SignUpNavigation";
import SignInScreen from "./screens/auth/SignInScreen";
import signOut from "./actions/sessions";
import LoadingScreen from "./screens/LoadingScreen";
import ClientTabs from './navigation/ClientTabs';
import PilotTabs from './navigation/PilotTabs';
import GlobalHeader from "./components/shared/GlobalHeader";
// auth stack navigator
const AuthStack = createStackNavigator();
const renderLogin = () => {
const signHeaderStyle = {
backgroundColor: "#161616",
width: "100%",
height: 100,
};
return (
<NavigationContainer>
<AuthStack.Navigator>
<AuthStack.Screen
name="SignIn"
component={SignInScreen}
options={{
headerTitle: () => <GlobalHeader isSplash={true} subheaderTitle={" "}/>,
headerStyle: signHeaderStyle,
headerRight: null,
}}
/>
<AuthStack.Screen
name="SignUp"
component={SignUpNavigation}
options={{
headerShown: false,
}}
/>
<AuthStack.Screen
name="Loading"
component={LoadingScreen}
options={() => ({
headerTitle: () => <GlobalHeader isSplash={true} subheaderTitle={" "}/>,
headerStyle: signHeaderStyle,
headerLeft: null,
})}
/>
<AuthStack.Screen
name="SignOut"
component={signOut}
/>
</AuthStack.Navigator>
</NavigationContainer>
);
};
// loading screen
const renderLoading = () => {
const signHeaderStyle = {
backgroundColor: "#161616",
width: "100%",
height: 110,
};
return (
<NavigationContainer>
<AuthStack.Navigator>
<AuthStack.Screen
name="Loading"
component={LoadingScreen}
options={() => ({
headerStyle: signHeaderStyle,
})}
/>
</AuthStack.Navigator>
</NavigationContainer>
);
}
//main drawer nav
const ClientDrawer = createDrawerNavigator();
const PilotDrawer = createDrawerNavigator();
const clientNavigation = (
<NavigationContainer independent={true} >
<ClientDrawer.Navigator initialRouteName="Home"
drawerPosition={"right"}
drawerStyle={{backgroundColor: "#161616", color: "white"}}
drawerContentOptions={{activeTintColor: "white",inactiveTintColor: "#DDE2E4", height: "100%", activeBackgroundColor: "#535756"}}
>
<ClientDrawer.Screen name="Home" component={ClientTabs}/>
<ClientDrawer.Screen name="Profile" component={ClientProfileNavigator}/>
<ClientDrawer.Screen name="About" component={AboutNavigation}/>
<ClientDrawer.Screen name="Support" component={SupportNavigation}/>
<ClientDrawer.Screen name="Sign out" component={() => signOut()}/>
</ClientDrawer.Navigator>
</NavigationContainer>
)
const pilotNavigation = (
<NavigationContainer independent={true}>
<PilotDrawer.Navigator
initialRouteName="Home"
drawerPosition={"right"}
drawerStyle={{backgroundColor: "#161616", color: "white"}}
drawerContentOptions={{activeTintColor: "white",inactiveTintColor: "#DDE2E4", height: "100%", activeBackgroundColor: "#535756"}}
sceneContainerStyle={{color: "white"}}
>
<PilotDrawer.Screen name="Home" component={PilotTabs}/>
<PilotDrawer.Screen name="Profile" component={PilotCreateProfileNavigation}/>
<PilotDrawer.Screen name="About" component={AboutNavigation}/>
<PilotDrawer.Screen name="Support" component={SupportNavigation}/>
<PilotDrawer.Screen name="Sign out" component={() => signOut()}/>
</PilotDrawer.Navigator>
</NavigationContainer>
)
export { clientNavigation, pilotNavigation, renderLogin, renderLoading };