-
Notifications
You must be signed in to change notification settings - Fork 18
/
App.tsx
101 lines (91 loc) · 4 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import { useEffect } from "react";
import { I18nextProvider } from "react-i18next";
import { StyleSheet } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { KeyboardProvider } from "react-native-keyboard-controller";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { enableFreeze, enableScreens } from "react-native-screens";
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
import * as Sentry from "sentry-expo";
import type { SentryExpoNativeOptions } from "sentry-expo";
import { TamaguiProvider } from "tamagui";
import { ErrorBoundary } from "@/components/ErrorBoundary";
import { NetworkChecker } from "@/components/NetworkChecker";
import { NetworkSafeView } from "@/components/NetworkSafeView";
import { NotificationRegister } from "@/components/NotificationRegister";
import ProviderComposer from "@/components/ProviderComposer";
import { StatusBar } from "@/components/StatusBar";
import { WalletConnectModal } from "@/components/WalletConnectModal";
import { ENV, SENTRY_DSN } from "@/constants/env";
import { i18n } from "@/i18n";
import { ApolloProvider } from "@/providers/apollo-provider";
import { ConnectKitProvider } from "@/providers/connect-kit-provider";
import { DrawerProvider } from "@/providers/drawer-provider";
import { GlobalStateProvider } from "@/providers/global-state-provider";
import LoadingProvider from "@/providers/loading-provider";
import { NavigationProvider } from "@/providers/navigation-provider";
import { NotificationProvider } from "@/providers/notification-provider";
import { PersistQueryClientProvider } from "@/providers/persist-query-client-provider";
import { PostIndicatorProvider } from "@/providers/post-indicator-provider";
import { PreloadProvider } from "@/providers/preload-provider";
import { ThemeProvider } from "@/providers/theme-provider";
import { ToastProvider } from "@/providers/toast-provider";
import { checkHotUpdates } from "@/utils/hot-updates";
import { version } from "./package.json";
import { RootNavigator } from "./src/navigation/root";
import config from "./tamagui.config";
enableScreens(true);
enableFreeze(true);
if (!__DEV__) {
const SENTRY_CONFIG: SentryExpoNativeOptions = {
dsn: SENTRY_DSN,
enableInExpoDevelopment: true,
debug: __DEV__,
attachScreenshot: true,
environment: ENV,
};
Sentry.init(SENTRY_CONFIG);
Sentry.Native.setTag("version", version);
// eslint-disable-next-line no-console
console.log("Sentry init config: ", SENTRY_CONFIG);
}
export default () => {
useEffect(() => {
checkHotUpdates().catch(() => { });
}, []);
return (
<ProviderComposer providers={[
<PreloadProvider key={"PreloadProvider"} />,
<GestureHandlerRootView key={"GestureHandlerRootView"} style={styles.container} />,
<TamaguiProvider key={"TamaguiProvider"} config={config} />,
<ErrorBoundary key={"ErrorBoundary"} />,
<SafeAreaProvider key={"SafeAreaProvider"} />,
<PersistQueryClientProvider key={"PersistQueryClientProvider"} />,
<I18nextProvider key={"I18nextProvider"} i18n={i18n} />,
<ToastProvider key={"ToastProvider"} />,
<ConnectKitProvider key={"ConnectKitProvider"} />,
<ThemeProvider key={"ThemeProvider"} />,
<LoadingProvider key={"LoadingProvider"} />,
<NavigationProvider key={"NavigationProvider"} />,
<BottomSheetModalProvider key={"BottomSheetModalProvider"} />,
<DrawerProvider key={"DrawerProvider"} />,
// @ts-expect-error: Internal
<KeyboardProvider key={"KeyboardProvider"} />,
<NotificationProvider key={"NotificationProvider"} />,
<ApolloProvider key={"ApolloProvider"} />,
<GlobalStateProvider key={"GlobalAnimationProvider"} />,
<PostIndicatorProvider key={"PostIndicatorProvider"} />,
]}>
<NetworkChecker/>
<NotificationRegister/>
<StatusBar />
<RootNavigator />
<WalletConnectModal />
</ProviderComposer>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
});