This repository was archived by the owner on Jul 22, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,17 +3,30 @@ import { AppLoading } from 'expo'
33import { Asset } from 'expo-asset'
44import * as Font from 'expo-font'
55import * as Icon from '@expo/vector-icons'
6+ import { withFirebaseHOC } from '../config/Firebase'
67
7- export default class Initial extends Component {
8+ class Initial extends Component {
89 state = {
910 isAssetsLoadingComplete : false
1011 }
1112
1213 componentDidMount = async ( ) => {
13- this . loadLocalAsync ( )
14+ try {
15+ // previously
16+ this . loadLocalAsync ( )
1417
15- // TODO: add auth check here with firebase
16- this . props . navigation . navigate ( 'Auth' )
18+ await this . props . firebase . checkUserAuth ( user => {
19+ if ( user ) {
20+ // if the user has previously logged in
21+ this . props . navigation . navigate ( 'App' )
22+ } else {
23+ // if the user has previously signed out from the app
24+ this . props . navigation . navigate ( 'Auth' )
25+ }
26+ } )
27+ } catch ( error ) {
28+ console . log ( error )
29+ }
1730 }
1831
1932 loadLocalAsync = async ( ) => {
@@ -48,3 +61,5 @@ export default class Initial extends Component {
4861 )
4962 }
5063}
64+
65+ export default withFirebaseHOC ( Initial )
You can’t perform that action at this time.
0 commit comments