-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
25 lines (20 loc) · 826 Bytes
/
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
import { useState } from 'react'
import { NavigationContainer, DefaultTheme, DarkTheme } from '@react-navigation/native'
import AppContext from './app/context/AppContext'
import { HomeNav } from './app/navigation'
import { useInit } from './app/hooks'
import AppLoading from 'expo-app-loading'
export default function App() {
const [ isDark, setIsDark ] = useState(null)
const [ isReady, setReady ] = useState(false)
const { init, fontsLoaded } = useInit(setIsDark)
if ( !isReady || !fontsLoaded )
return <AppLoading startAsync={init} onFinish={()=> setReady(true)} onError={console.warn}/>
return (
<AppContext.Provider value={{isDark, setIsDark }}>
<NavigationContainer theme={isDark ? DarkTheme : DefaultTheme }>
<HomeNav/>
</NavigationContainer>
</AppContext.Provider>
)
}