-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
57 lines (50 loc) · 1.53 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
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { useEffect, useState } from "react"
import { Provider } from "react-redux"
import { PersistGate } from "redux-persist/integration/react"
import * as Font from "expo-font"
import useColorScheme from "./src/hooks/useColorScheme"
import { persistor, store } from "./src/redux/store"
import MainNavigation from "./src/navigation/MainNavigation"
/**
* Import fonts
*/
// I mean yeah, disabling eslint on this block makes sense
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
const fontFamily = {
"Lato-400": require("./src/assets/fonts/Lato-Regular.ttf"),
"Lato-700": require("./src/assets/fonts/Lato-Bold.ttf"),
"Lato-900": require("./src/assets/fonts/Lato-Black.ttf"),
"Roboto-400": require("./src/assets/fonts/Roboto-Regular.ttf"),
AT: require("./src/assets/fonts/AnekTelugu-ExtraBold.ttf"),
}
/* eslint-enable @typescript-eslint/no-unsafe-assignment */
export default function App() {
const [fontLoaded, setFontLoaded] = useState(false)
const colorScheme = useColorScheme()
/**
* Load font
*/
useEffect(() => {
// We use IIFE instead
;(async () => {
try {
await Font.loadAsync(fontFamily)
} catch (e) {
console.warn(e)
} finally {
setFontLoaded(true)
}
})()
}, [])
if (!fontLoaded) {
return null
}
return (
<Provider store={store}>
<PersistGate persistor={persistor}>
<MainNavigation colorScheme={colorScheme} />
</PersistGate>
</Provider>
)
}