-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
52 lines (51 loc) · 1.88 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
51
52
import React from 'react';
import {LogBox, StatusBar} from 'react-native';
// As we don't use deep link to the screen which accepts functions in params
LogBox.ignoreLogs([
'Non-serializable values were found in the navigation state',
]);
LogBox.ignoreAllLogs();
import {NavigationContainer, useTheme} from '@react-navigation/native';
import Root from './src/navigation/rootNavigation/Root';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {darkTheme} from './src/utils/theme/darkTheme';
import {defaultTheme} from './src/utils/theme/defaultTheme';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {useSelector} from 'react-redux';
import translator from './translator';
import {useTranslation} from 'react-i18next';
import {useEffect} from 'react';
import FlashMessage from 'react-native-flash-message';
import Network from './src/utils/Network/NetworkProvider';
import {homeStyle} from './src/screens/Home/home.style';
const initI18n = translator;
const App = () => {
const {theme} = useSelector(state => state.themeReducer);
const {i18n} = useTranslation();
const {language} = useSelector(state => state.languageReducer);
const {colors} = useTheme();
const style = homeStyle(colors);
useEffect(() => {
if (language) {
i18n.changeLanguage(language);
}
}, [language]);
return (
<SafeAreaProvider style={style.safeAreaProvider}>
<StatusBar
backgroundColor={theme === 'dark' ? '#2E2446' : '#392F6B'}
barStyle={'light-content'}
/>
<GestureHandlerRootView style={style.safeAreaProvider}>
<Network>
<NavigationContainer
theme={theme === 'dark' ? darkTheme : defaultTheme}>
<Root />
</NavigationContainer>
</Network>
<FlashMessage position="bottom" />
</GestureHandlerRootView>
</SafeAreaProvider>
);
};
export default App;