-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
51 lines (47 loc) · 1.68 KB
/
App.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
import { StatusBar } from 'expo-status-bar';
import React, { useContext } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import LoginScreen from './src/screens/LoginScreen/LoginScreen';
import SignupScreen from './src/screens/SignupScreen/SignupScreen';
import EnterDetailsScreen from './src/screens/EnterDetailsScreen/EnterDetailsScreen'
import MainContainer from './src/screens/MainContainer/MainContainer';
import { AuthProvider, AuthContext } from './utility/AuthContext';
import AddModuleScreen from './src/screens/AddModuleScreen/AddModuleScreen';
const Stack = createNativeStackNavigator();
export default function App() {
return (
<AuthProvider>
<AppContent />
</AuthProvider>
);
}
function AppContent() {
const authContext = useContext(AuthContext);
const { user } = authContext;
return (
<>
<StatusBar style="dark" />
<NavigationContainer>
<Stack.Navigator>
{user ? (
<Stack.Group>
<Stack.Screen name="Enter Details" component={EnterDetailsScreen} />
<Stack.Screen name="Add Module" component={AddModuleScreen} />
<Stack.Screen
name="MainContainer"
component={MainContainer}
options={{ headerShown: false }}
/>
</Stack.Group>
) : (
<Stack.Group>
<Stack.Screen name="Login" component={LoginScreen} />
<Stack.Screen name="Signup" component={SignupScreen} />
</Stack.Group>
)}
</Stack.Navigator>
</NavigationContainer>
</>
);
}