forked from cereal-hecker/plantDEX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
54 lines (48 loc) · 1.33 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
52
53
54
import React, { useState } from "react";
import { NavigationContainer } from "@react-navigation/native";
import AuthStack from "./screens/authStackNav";
import TabNavigator from "./screens/navbar";
import { createStackNavigator } from "@react-navigation/stack";
import { auth } from "./screens/firebase";
import { onAuthStateChanged } from "@firebase/auth";
import {
useFonts,
Poppins_900Black,
Poppins_700Bold,
Poppins_500Medium,
Poppins_600SemiBold,
Poppins_400Regular,
} from "@expo-google-fonts/poppins";
export default function App() {
let [fontsLoaded, fontError] = useFonts({
Poppins_900Black,
Poppins_700Bold,
Poppins_500Medium,
Poppins_600SemiBold,
Poppins_400Regular,
});
if (!fontsLoaded && !fontError) {
return null;
}
const Stack = createStackNavigator();
onAuthStateChanged(auth, (user) => {
if (user) {
console.log(auth.currentUser.uid);
//navigation.navigate('MainApp',{screen:'History'})
} else {
//navigation.navigate('AuthStack')
}
});
return (
<NavigationContainer>
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="AuthStack" component={AuthStack} />
<Stack.Screen name="MainApp" component={TabNavigator} />
</Stack.Navigator>
</NavigationContainer>
);
}