Skip to content

Update statusBarHeight calculation #985

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

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Changes from all commits
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
12 changes: 6 additions & 6 deletions src/helpers/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ isTablet = Platform.isPad || (getAspectRatio() < 1.6 && Math.max(screenWidth, sc

function setStatusBarHeight() {
const {StatusBarManager} = NativeModules;
statusBarHeight = 0; // so there will be a value for any case
statusBarHeight = isIOS ? 20 : StatusBarManager.HEIGHT;
if (isIOS) {
// override guesstimate height with the actual height from StatusBarManager
StatusBarManager.getHeight((data: any) => (statusBarHeight = data.height));
}
statusBarHeight = StatusBarManager.HEIGHT || 0; // So there will be a value for any case
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not apply the old logic instead of setting to 0 in case 'StatusBarManager.HEIGHT' returns null/undefined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically it works. We don't even need the 0 for that matter.
Hmm The reason I didn't kept the old logic is cause I would prefer to remove it eventually if everything goes well.

// statusBarHeight = isIOS ? 20 : StatusBarManager.HEIGHT;
// if (isIOS) {
// // override guesstimate height with the actual height from StatusBarManager
// StatusBarManager.getHeight((data: any) => (statusBarHeight = data.height));
// }
}

function getAspectRatio() {
Expand Down