-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.js
43 lines (35 loc) · 1.03 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
import { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { onAuthStateChanged } from 'firebase/auth';
import { auth } from './firebase';
import SignUp from './components/SignUp';
import SignIn from './components/SignIn';
import SignOut from './components/SignOut';
export default function App() {
const [currentUser, setCurrentUser] = useState(null);
console.log('currentUser', currentUser?.email)
useEffect(() => {
onAuthStateChanged(auth, (user) => {
if (user) {
setCurrentUser(user);
} else {
console.log('User signed out');
}
})
}, [currentUser])
return (
<View style={styles.container}>
<SignUp user={currentUser} setUser={setCurrentUser} />
{/* <SignIn user={currentUser} setUser={setCurrentUser} /> */}
{/* <SignOut user={currentUser} /> */}
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});