-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
46 lines (36 loc) · 1.07 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
import React, { useState } from "react";
import { View, StyleSheet } from "react-native";
import { StatusBar } from "expo-status-bar";
import firebase from "firebase/app";
import "firebase/auth";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import LoadingScreen from "./app/screens/LoadingScreen";
import RootTabScreen from "./app/screens/RootTabScreen";
import RootStackScreen from "./app/screens/RootStackScreen";
function App() {
const [user, setUser] = useState(true);
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
// User is signed in.
setUser(true);
} else {
// No user is signed in.
setUser(false);
}
});
return (
<View style={styles.container}>
<StatusBar backgroundColor="#5D2DFD" style="light" />
<NavigationContainer>
{user ? <RootTabScreen /> : <RootStackScreen />}
</NavigationContainer>
</View>
);
}
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
},
});