-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.tsx
44 lines (42 loc) · 1.22 KB
/
index.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 { createStackNavigator } from "@react-navigation/stack";
import Login from "./AuthScreens/Login";
import Register from "./AuthScreens/Register";
import Main from "./MainScreens/Main";
import {Feather} from '@expo/vector-icons';
import Comments from "./MainScreens/Comments";
import Welcome from "./AuthScreens/Welcome";
import useAuth,{authValue} from '../hooks/useAuth';
export type RootStackParamList = {
Welcome:undefined;
Main: undefined;
Login:undefined;
Register:undefined;
Comments:{
id:string
}
};
export default function Screens() {
const Stack = createStackNavigator<RootStackParamList>();
const {user} = useAuth() as authValue;
return (
<Stack.Navigator
screenOptions={{
headerShown:false
}}
>{
user?(
<Stack.Group screenOptions={{animationTypeForReplace:'pop',}}>
<Stack.Screen name="Main" component={Main} />
<Stack.Screen name="Comments" component={Comments}/>
</Stack.Group>
):(
<Stack.Group>
<Stack.Screen name="Welcome" component={Welcome}/>
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="Register" component={Register} />
</Stack.Group>
)
}
</Stack.Navigator>
);
}