-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathApp.js
More file actions
40 lines (33 loc) · 1022 Bytes
/
App.js
File metadata and controls
40 lines (33 loc) · 1022 Bytes
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
import React, {useState, useEffect} from 'react';
import {StyleSheet, SafeAreaView, StatusBar, YellowBox} from 'react-native';
import {decode, encode} from 'base-64';
import Auth from './src/components/Auth';
import firebase from './src/utils/firebase';
import 'firebase/auth';
import ListBirthday from './src/components/ListBirthday';
if (!global.btoa) global.btoa = encode;
if (!global.atob) global.atob = decode;
YellowBox.ignoreWarnings(['Setting a timer']);
export default function App() {
const [user, setUser] = useState(undefined);
useEffect(() => {
firebase.auth().onAuthStateChanged((response) => {
setUser(response);
});
}, []);
if (user === undefined) return null;
return (
<>
<StatusBar barStyle="light-content" />
<SafeAreaView style={styles.background}>
{user ? <ListBirthday user={user} /> : <Auth />}
</SafeAreaView>
</>
);
}
const styles = StyleSheet.create({
background: {
backgroundColor: '#15212b',
height: '100%',
},
});