-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDrawerNavigator.js
33 lines (30 loc) · 941 Bytes
/
DrawerNavigator.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
import React from "react";
import useAuth from "./hooks/useAuth";
import { createDrawerNavigator } from "@react-navigation/drawer";
import AboutScreen from "./screens/AboutScreen";
import StackNavigator from "./StackNavigator";
import { DrawerContent } from "./screens/DrawerContent";
const Drawer = createDrawerNavigator();
const DrawerNavigator = () => {
const { user } = useAuth();
return (
<Drawer.Navigator
screenOptions={{ headerShown: false }}
drawerContent={(props) => <DrawerContent {...props} />}
>
{user ? (
<>
<Drawer.Screen name="DrawerHome" component={StackNavigator} />
<Drawer.Screen name="About" component={AboutScreen} />
</>
) : (
<Drawer.Screen
name="DrawerHome"
component={StackNavigator}
options={{ swipeEnabled: false }}
/>
)}
</Drawer.Navigator>
);
};
export default DrawerNavigator;