forked from technoforte/inji
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
26 lines (22 loc) · 828 Bytes
/
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
import React, { useContext } from 'react';
import AppLoading from 'expo-app-loading';
import { AppLayout } from './screens/AppLayout';
import { useFont } from './shared/hooks/useFont';
import { GlobalContextProvider } from './components/GlobalContextProvider';
import { GlobalContext } from './shared/GlobalContext';
import { useSelector } from '@xstate/react';
import { selectIsReady } from './machines/app';
import './i18n';
const AppInitialization: React.FC = () => {
const { appService } = useContext(GlobalContext);
const hasFontsLoaded = useFont();
const isReady = useSelector(appService, selectIsReady);
return isReady && hasFontsLoaded ? <AppLayout /> : <AppLoading />;
};
export default function App() {
return (
<GlobalContextProvider>
<AppInitialization />
</GlobalContextProvider>
);
}