-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
48 lines (45 loc) · 976 Bytes
/
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
/* eslint-disable no-unused-vars */
import React from 'react'
import {
StyleSheet,
View,
Text
} from 'react-native'
//
import Spinner from './src/presentation/common/Spinner'
//
import { goToLogIn, goToApp } from './src/presentation/common/Navigation'
import Firebase from './src/controller/Firebase'
class AppScreen extends React.Component {
myFirebase: Firebase;
constructor (props: any) {
super(props)
this.myFirebase = new Firebase()
}
componentDidMount () {
this.myFirebase.auth().onAuthStateChanged((user: any) => {
if (user) {
goToApp()
} else {
goToLogIn()
}
})
}
render () {
return (
<View style={styles.container}>
<Spinner size='large' />
<Text> Checking authentication ... </Text>
</View>
)
}
}
export default AppScreen
// Styles
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
})