-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
executable file
·68 lines (55 loc) · 2.06 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React, { useEffect, useState } from 'react';
import { AppRegistry, LogBox, StatusBar } from 'react-native';
import SplashScreen from 'react-native-splash-screen';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import { createStore, applyMiddleware } from 'redux';
import * as RNLocalize from 'react-native-localize';
import { Appearance, AppearanceProvider } from 'react-native-appearance';
import { setI18nConfig } from './src/Core/localization/IMLocalization';
import { AppNavigator } from './src/navigations/AppNavigation';
import { IMAVAppCallWrapper } from './src/Core/avchat';
import IAPManagerWrapped from './src/Core/inAppPurchase/IAPManagerWrapped';
import AppReducer from './src/redux';
import { enableScreens } from 'react-native-screens';
import DynamicAppStyles from './src/DynamicAppStyles';
import DatingConfig from './src/DatingConfig';
const MainNavigator = IMAVAppCallWrapper(AppNavigator);
const store = createStore(AppReducer, applyMiddleware(thunk));
// const useForceUpdate = () => useState()[1];
const App = (props) => {
const [colorScheme, setColorScheme] = useState(Appearance.getColorScheme());
enableScreens();
useEffect(() => {
SplashScreen.hide();
LogBox.ignoreAllLogs(true)
setI18nConfig();
RNLocalize.addEventListener('change', handleLocalizationChange);
Appearance.addChangeListener(({ colorScheme }) => {
setColorScheme(colorScheme);
});
return () => {
RNLocalize.removeEventListener('change', handleLocalizationChange);
};
}, []);
const handleLocalizationChange = () => {
setI18nConfig();
// useForceUpdate();
};
return (
<Provider store={store}>
<AppearanceProvider>
<IAPManagerWrapped
appStyles={DynamicAppStyles}
appConfig={DatingConfig}>
<StatusBar />
<MainNavigator screenProps={{ theme: colorScheme }} />
</IAPManagerWrapped>
</AppearanceProvider>
</Provider>
);
};
App.propTypes = {};
App.defaultProps = {};
AppRegistry.registerComponent('App', () => App);
export default App;