-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
62 lines (58 loc) · 2.16 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
58
59
60
61
62
import React, { type PropsWithChildren } from 'react';
import { StatusBar } from 'react-native';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { NavigationContainer } from '@react-navigation/native';
import { DripsyProvider } from 'dripsy';
import { QueryClientProvider } from 'react-query';
import { RecoilRoot } from 'recoil';
import { Logger } from 'src/modules/logger';
import { navigationRef } from 'src/navigators/helpers';
import { queryClient } from 'src/stores/reactQuery';
import { RecoilExternalPortal } from 'src/stores/recoil';
import { themeLight } from 'src/themes';
import { colors } from 'src/themes/colors';
import { titleFormatter } from 'src/utils';
import { AnimateSuspense } from 'src/components';
import { AppToast, Modals } from './src/modules/app/components';
// eslint-disable-next-line import/no-named-as-default-member
const Navigator = React.lazy(() => import('src/navigators'));
const gestureHandlerStyle = { flex: 1 } as const;
function AppProviders<T = unknown>({
children,
}: PropsWithChildren<T>): React.ReactElement {
return (
<GestureHandlerRootView style={gestureHandlerStyle}>
<SafeAreaProvider>
<DripsyProvider theme={themeLight}>
<QueryClientProvider client={queryClient}>
<RecoilRoot>
<RecoilExternalPortal />
<NavigationContainer
documentTitle={{ formatter: titleFormatter }}
onReady={(): void => {
Logger.info('NavigationContainer', 'onReady');
}}
ref={navigationRef}
>
{children}
</NavigationContainer>
<AppToast />
<Modals />
</RecoilRoot>
</QueryClientProvider>
</DripsyProvider>
</SafeAreaProvider>
</GestureHandlerRootView>
);
}
export function App(): React.ReactElement {
return (
<AppProviders>
<StatusBar backgroundColor={colors.$white} barStyle="dark-content" />
<AnimateSuspense fallback={null}>
<Navigator />
</AnimateSuspense>
</AppProviders>
);
}