-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStackNavigator.js
38 lines (34 loc) · 1.13 KB
/
StackNavigator.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
import { StyleSheet } from "react-native";
import React from "react";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import HomeScreen from "./screens/HomeScreen";
import ChatScreen from "./screens/ChatScreen";
import LoginScreen from "./screens/LoginScreen";
import useAuth from "./hooks/useAuth";
import ModalScreen from "./screens/ModalScreen";
const Stack = createNativeStackNavigator();
const StackNavigator = () => {
const {user} = useAuth();
console.log(user);
return (
<Stack.Navigator>
{user ? (
<>
<Stack.Group>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Chat" component={ChatScreen} />
</Stack.Group>
<Stack.Group screenOptions={{ presentation: 'modal' }}>
<Stack.Screen options={{headerShown:false}} name="Modal" component={ModalScreen} />
</Stack.Group>
</>
) : (
<>
<Stack.Screen name="Login" component={LoginScreen} />
</>
)}
</Stack.Navigator>
);
};
export default StackNavigator;
const styles = StyleSheet.create({});