-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
86 lines (78 loc) · 3.78 KB
/
App.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { StatusBar } from 'expo-status-bar';
import LandingScreen from './screens/Landing';
import LogIn from './screens/LogIn';
import DashboardScreen from './screens/Dashboard';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import SignUpPageScreen from './screens/SignUpPages/SignUpPage';
import SignUpOptionsScreen from './screens/SignUpPages/SignUpOptions';
import PasswordSignUpScreen from './screens/SignUpPages/PasswordSignUp';
import { useEffect, useState } from 'react';
import { onAuthStateChanged } from 'firebase/auth';
import { FIREBASE_AUTH } from './FirebaseConfig';
import { User } from 'firebase/auth';
import JournalScreen from './screens/journalPages/Journal';
import NewJournalScreen from './screens/journalPages/newJournal';
import MoodSurveyScreen from './screens/surveyPages/newSurvey';
import JournalDetail from './screens/journalPages/JournalDetail';
import ChatBoxScreen from './screens/ChatBot';
import MeditationSetup from './screens/MeditationSetup';
import MeditationScreen from './screens/MeditationScreen';
import SurveyScreen from './screens/surveyPages/MoodSurvey';
import UserSettings from './screens/userSettings';
import SurveyDetail from './screens/surveyPages/SurveyDetail';
const AppStack = createNativeStackNavigator();
const Stack = createNativeStackNavigator();
const AuthStack = createNativeStackNavigator();
function AppLayout() {
return (
<AppStack.Navigator screenOptions={{ headerShown: false }}>
{/* <AppStack.Screen name="Landing" component={LandingScreen} /> */}
<AppStack.Screen name="Dashboard" component={DashboardScreen} />
{/* <AppStack.Screen name="SignUp" component={SignUpPageScreen} /> */}
{/* <AppStack.Screen name="SignUpOptions" component={SignUpOptionsScreen} /> */}
{/* <AppStack.Screen name="PasswordSignUp" component={PasswordSignUpScreen} /> */}
{/* <AppStack.Screen name="LogIn" component={LogIn} /> */}
<AppStack.Screen name="Journal" component={JournalScreen} />
<AppStack.Screen name="NewJournal" component={NewJournalScreen} />
<AppStack.Screen name="JournalDetail" component={JournalDetail} />
<AppStack.Screen name="MeditationSetup" component={MeditationSetup} />
<AppStack.Screen name="ChatBot" component={ChatBoxScreen} />
<AppStack.Screen name="MeditationScreen" component={MeditationScreen} />
<AppStack.Screen name="Survey" component={SurveyScreen} />
<AppStack.Screen name="NewSurvey" component={MoodSurveyScreen} />
<AppStack.Screen name="UserSettings" component={UserSettings} />
<AppStack.Screen name="SurveyDetail" component={SurveyDetail} />
</AppStack.Navigator>
);
}
function AuthLayout() {
return (<AuthStack.Navigator screenOptions={{ headerShown: false }}>
<AuthStack.Screen name="Landing" component={LandingScreen} />
<AuthStack.Screen name="LogIn" component={LogIn} />
<AuthStack.Screen name="SignUp" component={SignUpPageScreen} />
<AuthStack.Screen name="SignUpOptions" component={SignUpOptionsScreen} />
<AuthStack.Screen name="PasswordSignUp" component={PasswordSignUpScreen} />
</AuthStack.Navigator>)
}
function App() {
const [user, setUser] = useState<User | null>(null)
useEffect(() => {
onAuthStateChanged(FIREBASE_AUTH, (user) => {
setUser(user)
}
)
}, [])
return (
<NavigationContainer>
<StatusBar style="dark" />
<Stack.Navigator screenOptions={{ headerShown: false }}>
{user ? (
<Stack.Screen name='InsideLayout' component={AppLayout} options={{ headerShown: false }} />
) : <Stack.Screen name='Auth' component={AuthLayout} options={{ headerShown: false }}>
</Stack.Screen>}
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;