2018-10-04 05:18:36 +03:00
|
|
|
import React from 'react';
|
2020-08-08 09:08:54 +03:00
|
|
|
import 'react-native-gesture-handler';
|
2019-07-18 11:10:34 +03:00
|
|
|
import { Provider, connect } from 'react-redux';
|
2019-07-17 00:31:34 +03:00
|
|
|
import { PersistGate } from 'redux-persist/integration/react';
|
2019-08-12 11:10:52 +03:00
|
|
|
import { IntlProvider } from 'react-intl';
|
2021-01-15 23:28:56 +03:00
|
|
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
2022-01-17 19:39:20 +03:00
|
|
|
import { Host } from 'react-native-portalize';
|
2019-07-18 11:10:34 +03:00
|
|
|
import { flattenMessages } from './utils/flattenMessages';
|
|
|
|
import messages from './config/locales';
|
2018-10-04 05:18:36 +03:00
|
|
|
|
2019-07-11 15:33:42 +03:00
|
|
|
import Application from './screens/application';
|
2019-07-17 00:31:34 +03:00
|
|
|
import { store, persistor } from './redux/store/store';
|
2018-11-14 17:29:29 +03:00
|
|
|
|
2019-07-18 11:10:34 +03:00
|
|
|
const _renderApp = ({ locale }) => (
|
|
|
|
<PersistGate loading={null} persistor={persistor}>
|
|
|
|
<IntlProvider locale={locale} messages={flattenMessages(messages[locale])}>
|
2021-01-15 23:28:56 +03:00
|
|
|
<SafeAreaProvider>
|
2022-01-17 19:39:20 +03:00
|
|
|
<Host>
|
|
|
|
<Application />
|
|
|
|
</Host>
|
2021-01-15 23:28:56 +03:00
|
|
|
</SafeAreaProvider>
|
2019-07-18 11:10:34 +03:00
|
|
|
</IntlProvider>
|
|
|
|
</PersistGate>
|
2018-10-04 05:18:36 +03:00
|
|
|
);
|
2019-07-18 11:10:34 +03:00
|
|
|
|
2020-03-24 13:52:23 +03:00
|
|
|
const mapStateToProps = (state) => ({
|
2019-07-18 11:10:34 +03:00
|
|
|
locale: state.application.language,
|
|
|
|
});
|
|
|
|
|
|
|
|
const App = connect(mapStateToProps)(_renderApp);
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
2019-10-29 16:16:44 +03:00
|
|
|
<App />
|
2019-07-18 11:10:34 +03:00
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
};
|