-
Notifications
You must be signed in to change notification settings - Fork 6
/
App.tsx
executable file
·43 lines (38 loc) · 1.21 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
import React, { useEffect } from 'react';
import SplashScreen from 'react-native-splash-screen';
import { AppNavigationContainer } from './src/navigator';
import * as firebase from 'firebase';
import { AlertsProvider } from './src/contexts/AlertsContext';
import { Provider } from 'react-redux';
import { configureStore } from './src/store/configureStore';
import 'firebase/firestore';
import { firebaseConfig } from './config';
import './src/locales/i18n';
import { setI18nConfig, RNLocalize } from './src/locales/i18n';
import { initializeProfile } from './src/services/profileServices';
import { checkConnection } from './src/utils/checkConnection';
const store = configureStore();
checkConnection().then(netInfo => {
if (netInfo.isConnected && firebaseConfig.apiKey) {
firebase.initializeApp(firebaseConfig);
firebase.firestore();
}
});
setI18nConfig();
export default () => {
useEffect(() => {
RNLocalize.addEventListener('change', setI18nConfig);
initializeProfile();
SplashScreen.hide();
return () => {
RNLocalize.removeEventListener('change', setI18nConfig);
};
}, []);
return (
<Provider store={store}>
<AlertsProvider>
<AppNavigationContainer />
</AlertsProvider>
</Provider>
);
};