-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
48 lines (43 loc) · 1.51 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
import React from 'react';
import {PersistGate} from 'redux-persist/integration/react';
import * as RNLocalize from 'react-native-localize';
import {setI18nConfig} from './app/locales/i18n';
import {persistor, store} from './app/redux/store';
import {Provider} from 'react-redux';
import getTheme from './app/theme/components';
import commonColor from './app/theme/variables/commonColor';
import {Container, StyleProvider} from 'native-base';
import i18n from 'i18n-js';
import {AppContainer} from './app/routes/index';
class App extends React.Component {
constructor(props) {
super(props);
setI18nConfig();
store.dispatch({type: 'SET_LOCALE', locale: i18n.locale});
}
componentDidMount() {
RNLocalize.addEventListener('change', this.handleLocalizationChange);
}
componentWillUnmount() {
RNLocalize.removeEventListener('change', this.handleLocalizationChange);
}
handleLocalizationChange = () => {
setI18nConfig();
store.dispatch({type: 'SET_LOCALE', locale: i18n.locale});
this.forceUpdate();
};
render() {
return (
<StyleProvider style={getTheme(commonColor)}>
<Container>
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<AppContainer />
</PersistGate>
</Provider>
</Container>
</StyleProvider>
);
}
}
export default App;