-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
51 lines (46 loc) · 1.87 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
import { StatusBar } from 'expo-status-bar';
import { NativeBaseProvider } from 'native-base';
import React from 'react';
import customTheme from './src/lib/hooks/customTheme';
import Onboarding from './src/components/Onboarding';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import useCachedResources from './src/lib/hooks/useCachedResources';
import { Provider } from 'react-redux';
import store from './src/store';
import { setToken } from './src/modules/auth';
import Navigation from './src/navigation';
import { useNavigationContainerRef } from '@react-navigation/core';
import TokenManager from './src/service/TokenManager';
import * as Sentry from 'sentry-expo';
import config from './src/config';
import Notification from './src/service/Notification';
import SocketProvider from './src/service/SocketProvider';
import { LogBox } from 'react-native';
Sentry.init({
dsn: config.sentry_dsn,
enableInExpoDevelopment: true,
debug: __DEV__ ? false : true,
});
const App = () => {
LogBox.ignoreLogs(['Setting a timer for a long period of time']);
const { isLoadingComplete, accessToken, refreshToken } = useCachedResources();
const navigationRef = useNavigationContainerRef();
store.dispatch(setToken({ accessToken, refreshToken }));
return (
<Provider store={store}>
<SocketProvider serverUrl={config.socketEndpoint} navigationRef={navigationRef}>
<TokenManager navigationRef={navigationRef}>
<Notification>
<SafeAreaProvider>
<NativeBaseProvider theme={customTheme}>
{!isLoadingComplete ? <Onboarding /> : <Navigation navigationRef={navigationRef} />}
<StatusBar style="dark" />
</NativeBaseProvider>
</SafeAreaProvider>
</Notification>
</TokenManager>
</SocketProvider>
</Provider>
);
};
export default App;