mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 19:01:38 +03:00
Intl moved
This commit is contained in:
parent
a77c4f4e65
commit
0fcbdcdbad
26
src/index.js
26
src/index.js
@ -1,14 +1,32 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider, connect } from 'react-redux';
|
||||||
import { PersistGate } from 'redux-persist/integration/react';
|
import { PersistGate } from 'redux-persist/integration/react';
|
||||||
|
import { IntlProvider } from 'react-intl';
|
||||||
|
|
||||||
|
import { flattenMessages } from './utils/flattenMessages';
|
||||||
|
import messages from './config/locales';
|
||||||
|
|
||||||
import Application from './screens/application';
|
import Application from './screens/application';
|
||||||
import { store, persistor } from './redux/store/store';
|
import { store, persistor } from './redux/store/store';
|
||||||
|
|
||||||
export default () => (
|
const _renderApp = ({ locale }) => (
|
||||||
<Provider store={store}>
|
|
||||||
<PersistGate loading={null} persistor={persistor}>
|
<PersistGate loading={null} persistor={persistor}>
|
||||||
|
<IntlProvider locale={locale} messages={flattenMessages(messages[locale])}>
|
||||||
<Application />
|
<Application />
|
||||||
|
</IntlProvider>
|
||||||
</PersistGate>
|
</PersistGate>
|
||||||
</Provider>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
locale: state.application.language,
|
||||||
|
});
|
||||||
|
|
||||||
|
const App = connect(mapStateToProps)(_renderApp);
|
||||||
|
|
||||||
|
export default () => {
|
||||||
|
return (
|
||||||
|
<Provider store={store}>
|
||||||
|
<App />
|
||||||
|
</Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
import React, { Component, Fragment } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
import { IntlProvider } from 'react-intl';
|
|
||||||
import { StatusBar, Platform, View } from 'react-native';
|
import { StatusBar, Platform, View } from 'react-native';
|
||||||
import EStyleSheet from 'react-native-extended-stylesheet';
|
import EStyleSheet from 'react-native-extended-stylesheet';
|
||||||
import { ReduxNavigation } from '../../../navigation/reduxNavigation';
|
import { ReduxNavigation } from '../../../navigation/reduxNavigation';
|
||||||
import { flattenMessages } from '../../../utils/flattenMessages';
|
|
||||||
import messages from '../../../config/locales';
|
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { toastNotification as toastNotificationAction } from '../../../redux/actions/uiAction';
|
import { toastNotification as toastNotificationAction } from '../../../redux/actions/uiAction';
|
||||||
@ -47,14 +44,7 @@ class ApplicationScreen extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { isConnected, isDarkTheme, toastNotification, isReady, isPinCodeReqiure } = this.props;
|
||||||
isConnected,
|
|
||||||
isDarkTheme,
|
|
||||||
locale,
|
|
||||||
toastNotification,
|
|
||||||
isReady,
|
|
||||||
isPinCodeReqiure,
|
|
||||||
} = this.props;
|
|
||||||
const { isShowToastNotification } = this.state;
|
const { isShowToastNotification } = this.state;
|
||||||
const barStyle = isDarkTheme ? 'light-content' : 'dark-content';
|
const barStyle = isDarkTheme ? 'light-content' : 'dark-content';
|
||||||
const barColor = isDarkTheme ? '#1e2835' : '#fff';
|
const barColor = isDarkTheme ? '#1e2835' : '#fff';
|
||||||
@ -66,8 +56,6 @@ class ApplicationScreen extends Component {
|
|||||||
) : (
|
) : (
|
||||||
<StatusBar barStyle={barStyle} backgroundColor={barColor} />
|
<StatusBar barStyle={barStyle} backgroundColor={barColor} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<IntlProvider locale={locale} messages={flattenMessages(messages[locale])}>
|
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{!isConnected && <NoInternetConnection />}
|
{!isConnected && <NoInternetConnection />}
|
||||||
<ReduxNavigation />
|
<ReduxNavigation />
|
||||||
@ -80,7 +68,6 @@ class ApplicationScreen extends Component {
|
|||||||
<PinCode setWrappedComponentState={this._setWrappedComponentState} />
|
<PinCode setWrappedComponentState={this._setWrappedComponentState} />
|
||||||
</Modal>
|
</Modal>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</IntlProvider>
|
|
||||||
{Platform.OS === 'android' && <PostButtonForAndroid />}
|
{Platform.OS === 'android' && <PostButtonForAndroid />}
|
||||||
|
|
||||||
{isShowToastNotification && (
|
{isShowToastNotification && (
|
||||||
|
Loading…
Reference in New Issue
Block a user