Application container structure changed

This commit is contained in:
Mustafa Buyukcelebi 2019-07-11 15:33:42 +03:00
parent e2554884be
commit 215fb1e3a6
4 changed files with 53 additions and 18 deletions

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Provider } from 'react-redux';
import { Application } from './screens/application';
import Application from './screens/application';
import store from './redux/store/store';
export default () => (

View File

@ -399,21 +399,27 @@ class ApplicationContainer extends Component {
};
render() {
const { selectedLanguage, isConnected, toastNotification } = this.props;
const {
selectedLanguage,
isConnected,
toastNotification,
isDarkTheme: _isDarkTheme,
children,
} = this.props;
const { isRenderRequire, isReady, isThemeReady } = this.state;
if (isRenderRequire && isThemeReady) {
return (
<ApplicationScreen
isConnected={isConnected}
locale={selectedLanguage}
toastNotification={toastNotification}
isReady={isReady}
{...this.props}
/>
);
}
return <Launch />;
return (
children &&
children({
isConnected,
toastNotification,
isReady,
isRenderRequire,
isThemeReady,
isDarkTheme: _isDarkTheme,
locale: selectedLanguage,
})
);
}
}

View File

@ -1,5 +1,35 @@
import ApplicationScreen from './screen/applicationScreen';
import Application from './container/applicationContainer';
import React from 'react';
import ApplicationScreen from './screen/applicationScreen';
import ApplicationContainer from './container/applicationContainer';
const Application = () => (
<ApplicationContainer>
{({
isConnected,
locale,
toastNotification,
isReady,
isDarkTheme,
isRenderRequire,
isThemeReady,
}) => {
if (!isRenderRequire || !isThemeReady) {
return null;
}
return (
<ApplicationScreen
isConnected={isConnected}
locale={locale}
toastNotification={toastNotification}
isReady={isReady}
isDarkTheme={isDarkTheme}
/>
);
}}
</ApplicationContainer>
);
export { Application, ApplicationScreen };
export default Application;
export { ApplicationContainer, ApplicationScreen };

View File

@ -1,7 +1,6 @@
import React, { Component, Fragment } from 'react';
import { AppState, Platform, Linking, Alert } from 'react-native';
import { connect } from 'react-redux';
import Push from 'appcenter-push';
import { injectIntl } from 'react-intl';
import get from 'lodash/get';