-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
67 lines (60 loc) · 1.67 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import 'react-native-gesture-handler' /* eslint-disable-line */
import React, { useCallback,useEffect, useState } from 'react'
import { View } from 'react-native'
import {
SourceSansPro_400Regular,
SourceSansPro_600SemiBold,
} from '@expo-google-fonts/source-sans-pro'
import * as Font from 'expo-font'
import * as SplashScreen from 'expo-splash-screen'
import * as Sentry from 'sentry-expo'
import 'intl-pluralrules'
import { loadLanguage } from './i18n'
import { AuthProvider } from './src/containers/Auth/AuthProvider'
import { IdeaNavigator } from './src/navigation/IdeaNavigator'
import { ProfileProvider } from './src/contexts/ProfileContext'
Sentry.init({
url: 'https://sentry.liqd.net',
dsn: '',
enableInExpoDevelopment: false,
debug: false,
})
const App = () => {
const [appIsReady, setAppIsReady] = useState(false)
useEffect(() => {
(async function () {
try {
await SplashScreen.preventAutoHideAsync()
await Font.loadAsync({ SourceSansPro_400Regular })
await Font.loadAsync({ SourceSansPro_600SemiBold })
await loadLanguage()
} catch (e) {
console.warn(e)
} finally {
// Tell the application to render
setAppIsReady(true)
}
})()
}, [])
const onLayoutRootView = useCallback(async () => {
if (appIsReady) {
await SplashScreen.hideAsync()
}
}, [appIsReady])
if (!appIsReady) {
return null
}
return (
<View
style={{ flex: 1 }} /* eslint-disable-line */
onLayout={onLayoutRootView}
>
<ProfileProvider>
<AuthProvider>
<IdeaNavigator />
</AuthProvider>
</ProfileProvider>
</View>
)
}
export default App