-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.tsx
62 lines (51 loc) · 1.56 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'reflect-metadata'
import DependencyEnum from 'shared/domain/entities/dependencyEnum'
import { ReloadSessionCase } from 'auth/data/useCases/reloadSession.case'
import { useFonts } from '@expo-google-fonts/inter'
import {
RobotoSlab_100Thin,
RobotoSlab_200ExtraLight,
RobotoSlab_300Light,
RobotoSlab_400Regular,
RobotoSlab_500Medium,
RobotoSlab_600SemiBold,
RobotoSlab_700Bold,
RobotoSlab_800ExtraBold,
RobotoSlab_900Black,
} from '@expo-google-fonts/roboto-slab'
import { registerRootComponent } from 'expo'
import AppLoading from 'expo-app-loading'
import FirebaseConfig from 'firebase.json'
import { initializeApp } from 'firebase/app'
import { useState, useEffect } from 'react'
import Router from 'router'
import { container } from 'tsyringe'
import 'shared/application/dependencyInjector'
import 'firebase/auth'
initializeApp(FirebaseConfig)
const App: React.FC = () => {
const reloadSession = container.resolve<ReloadSessionCase>(
DependencyEnum.RELOAD_SESSION_CASE
)
const [fontsLoaded] = useFonts({
RobotoSlab_100Thin,
RobotoSlab_200ExtraLight,
RobotoSlab_300Light,
RobotoSlab_400Regular,
RobotoSlab_500Medium,
RobotoSlab_600SemiBold,
RobotoSlab_700Bold,
RobotoSlab_800ExtraBold,
RobotoSlab_900Black,
})
const [sessionLoaded, setSessionLoaded] = useState(false)
useEffect(() => {
reloadSession.execute().then(() => setSessionLoaded(true))
}, [])
if (fontsLoaded && sessionLoaded) {
return <Router />
} else {
return <AppLoading />
}
}
export default registerRootComponent(App)