-
Notifications
You must be signed in to change notification settings - Fork 11
/
App.tsx
79 lines (71 loc) · 2.68 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
import * as Sentry from '@sentry/react-native';
import { LogBox, Platform, UIManager } from 'react-native';
import React, { ReactElement, useEffect } from 'react';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { NativeBaseProvider, StatusBar } from 'native-base';
import { PersistGate } from 'redux-persist/integration/react';
import { Provider } from 'react-redux';
import { withIAPContext, initConnection, endConnection } from 'react-native-iap';
import { TorContextProvider } from 'src/context/TorContext';
import { HCESessionProvider } from 'react-native-hce';
import { LocalizationProvider } from 'src/context/Localization/LocContext';
import { AppContextProvider } from 'src/context/AppContext';
import * as Zendesk from 'react-native-zendesk-messaging';
import config from 'src/utils/service-utilities/config';
import { customTheme } from './src/navigation/themes';
import Navigator from './src/navigation/Navigator';
import { persistor, store } from './src/store/store';
import NotificationHandler from 'src/hooks/useNotificationHandler';
LogBox.ignoreLogs([
"[react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!",
/\b{$Require cycle}\b/gi,
'Warning: ...',
/.+/s,
]);
if (Platform.OS === 'android') {
if (UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
}
function AndroidProvider({ children }: { children: ReactElement }) {
return Platform.OS === 'android' ? <HCESessionProvider>{children}</HCESessionProvider> : children;
}
function App() {
useEffect(() => {
initConnection();
Zendesk.initialize({ channelKey: config.ZENDESK_CHANNEL_ID })
.then(() => {})
.catch((error) => console.log('zendesk init error ', error));
return () => {
endConnection();
};
}, []);
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<NativeBaseProvider theme={customTheme}>
<NotificationHandler />
<StatusBar translucent backgroundColor="transparent" barStyle="light-content" />
<LocalizationProvider>
<AppContextProvider>
<TorContextProvider>
<AndroidProvider>
<Navigator />
</AndroidProvider>
</TorContextProvider>
</AppContextProvider>
</LocalizationProvider>
</NativeBaseProvider>
</GestureHandlerRootView>
);
}
function AppWrapper() {
return (
<PersistGate persistor={persistor} loading={null}>
<Provider store={store}>
<App />
</Provider>
</PersistGate>
);
}
const SentryApp = Sentry.wrap(AppWrapper);
export default withIAPContext(SentryApp);