Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed splash screen slightly jumps before hiding #2594

Merged
merged 2 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/Expensify.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
import {View} from 'react-native';
import {View, StatusBar} from 'react-native';
import Onyx, {withOnyx} from 'react-native-onyx';

import BootSplash from './libs/BootSplash';
Expand Down Expand Up @@ -74,7 +74,7 @@ class Expensify extends PureComponent {

// Initialize this client as being an active client
ActiveClientManager.init();

this.hideSplash = this.hideSplash.bind(this);
this.state = {
isOnyxMigrated: false,
};
Expand All @@ -87,7 +87,7 @@ class Expensify extends PureComponent {
// When we don't have an authToken we'll want to show the sign in screen immediately so we'll hide our
// boot screen right away
if (!this.getAuthToken()) {
BootSplash.hide({fade: true});
this.hideSplash();
}

this.setState({isOnyxMigrated: true});
Expand Down Expand Up @@ -115,7 +115,7 @@ class Expensify extends PureComponent {
return;
}

BootSplash.hide({fade: true});
this.hideSplash();
});
}
}
Expand All @@ -124,6 +124,14 @@ class Expensify extends PureComponent {
return lodashGet(this.props, 'session.authToken', null);
}

hideSplash() {
BootSplash.hide({fade: true}).then(() => {
// To prevent the splash from shifting positions we set status bar translucent after splash is hidden.
// on IOS it has no effect.
StatusBar.setTranslucent(true);
parasharrajat marked this conversation as resolved.
Show resolved Hide resolved
});
}

render() {
// Display a blank page until the onyx migration completes
if (!this.state.isOnyxMigrated) {
Expand Down
1 change: 0 additions & 1 deletion src/components/CustomStatusBar/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default class CustomStatusBar extends React.Component {
componentDidMount() {
StatusBar.setBarStyle('dark-content', true);
StatusBar.setBackgroundColor('transparent', true);
StatusBar.setTranslucent(true);
parasharrajat marked this conversation as resolved.
Show resolved Hide resolved
}

render() {
Expand Down