-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
30 lines (25 loc) · 836 Bytes
/
index.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
import { registerRootComponent } from 'expo';
import AppLoading from 'expo-app-loading';
import { ExpoRoot } from 'expo-router';
import { RequireContext } from 'expo-router/build/types';
import { useState } from 'react';
import useCustomFonts from './hooks/useCustomFonts';
// Must be exported or Fast Refresh won't update the context
export function App() {
const [isReady, setIsReady] = useState(false);
const LoadFonts = async () => {
await useCustomFonts();
};
if (!isReady) {
return (
<AppLoading
startAsync={LoadFonts}
onFinish={() => setIsReady(true)}
onError={() => {}}
/>
);
}
const ctx = require.context('./app');
return <ExpoRoot context={ctx as RequireContext} />;
}
registerRootComponent(App);