forked from bilalesi/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
50 lines (41 loc) · 1.46 KB
/
App.js
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
import 'react-native-gesture-handler';
import React from 'react';
import { Provider } from 'react-redux';
// import SplashScreen from 'react-native-splash-screen'
import { PersistGate } from 'redux-persist/es/integration/react';
import configureStore from './store';
// navigation container
import { NavigationContainer } from '@react-navigation/native';
import { MainRoutes } from './routes';
import { LanguageProvider } from 'react-native-translation';
import { langs } from './assets/langs';
import * as RNLocalize from 'react-native-localize';
let lang = RNLocalize.getLocales()['languageCode'];
if (!langs[lang]) lang = 'en';
import * as Sentry from '@sentry/react-native';
import { SENTRY_DSN } from '@env';
import { IS_PRODUCTION } from './actions/types';
const App = () => {
if (IS_PRODUCTION) {
Sentry.init({
dsn: SENTRY_DSN
});
}
const { persistor, store } = configureStore();
store.dispatch({ type: 'CHANGE_LANG', payload: lang });
return (
<NavigationContainer>
<Provider store={store}>
<PersistGate persistor={persistor}>
<LanguageProvider
language={lang}
defaultLanguage={'en'}
translations={langs}>
<MainRoutes />
</LanguageProvider>
</PersistGate>
</Provider>
</NavigationContainer>
);
};
export default App;