diff --git a/src/providers/steem/auth.js b/src/providers/steem/auth.js index 72b3d208e..6a19b988a 100644 --- a/src/providers/steem/auth.js +++ b/src/providers/steem/auth.js @@ -73,6 +73,7 @@ export const Login = (username, password) => { setUserData(userData) .then(() => { resolve({ ...account, password }); + updateCurrentUsername(account.name); }) .catch(() => { reject(new Error('Invalid credentails, please check and try again')); @@ -127,6 +128,7 @@ export const loginWithSC2 = async (accessToken) => { .then(() => { account.account.username = account.account.name; resolve({ ...account.account, accessToken }); + updateCurrentUsername(account.account.name); }) .catch((error) => { reject(error); diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 62f631bc4..d7a5c0c29 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -56,13 +56,14 @@ class ApplicationContainer extends Component { super(); this.state = { isRenderRequire: true, + isReady: false, }; } componentDidMount = async () => { BackHandler.addEventListener('hardwareBackPress', this._onBackPress); await this._getUserData(); - this._getSettings(); + await this._getSettings(); }; componentWillReceiveProps(nextProps) { @@ -146,6 +147,8 @@ class ApplicationContainer extends Component { response.notification && dispatch(isNotificationOpen(response.notification)); response.server && dispatch(setApi(response.server)); response.upvotePercent && dispatch(setUpvotePercent(Number(response.upvotePercent))); + + this.setState({isReady: true}); } }); }; @@ -226,14 +229,14 @@ class ApplicationContainer extends Component { render() { const { selectedLanguage } = this.props; - const { isRenderRequire } = this.state; + const { isRenderRequire, isReady } = this.state; const locale = (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage || selectedLanguage; - if (isRenderRequire) { + if (isRenderRequire && isReady) { return ; } return null;