-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathNavigator.tsx
43 lines (37 loc) · 1.21 KB
/
Navigator.tsx
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
import { useAuthentication } from "@/context/Authentication";
import { useAppearanceTheme } from "@/hooks/useAppearanceTheme";
import { useReactNavigationDevTools } from "@dev-plugins/react-navigation";
import {
NavigationContainer,
useNavigationContainerRef,
} from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { AuthNavigator } from "./AuthNavigator";
import { BottomTabNavigator } from "./BottomTabNavigator";
const Stack = createNativeStackNavigator();
export const Navigator = () => {
const { user } = useAuthentication();
const appearanceTheme = useAppearanceTheme();
const navigationRef = useNavigationContainerRef();
useReactNavigationDevTools(navigationRef);
return (
<NavigationContainer
ref={navigationRef}
theme={appearanceTheme}
>
<Stack.Navigator screenOptions={{ headerShown: false }}>
{user ? (
<Stack.Screen
component={BottomTabNavigator}
name={"BOTTOM_TABS"}
/>
) : (
<Stack.Screen
component={AuthNavigator}
name={"AUTH_STACK"}
/>
)}
</Stack.Navigator>
</NavigationContainer>
);
};