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

fix(iOS): Remove calculating status bar height in useAnimatedHeaderHeight when header is not shown #2033

Merged
merged 3 commits into from
Feb 21, 2024
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
14 changes: 4 additions & 10 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1111,17 +1111,11 @@ - (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal
{
UINavigationController *navctr = [self getVisibleNavigationControllerIsModal:isModal];

// If navigation controller doesn't exists (or it is hidden) we want to handle two possible cases.
// If there's no navigation controller for the modal, we simply don't want to return header height, as modal possibly
// does not have header and we don't want to count status bar. If there's no navigation controller for the view we
// just want to return status bar height (if it's hidden, it will simply return 0).
// If there's no navigation controller for the modal (or the navigation bar is hidden), we simply don't want to
// return header height, as modal possibly does not have header when navigation controller is nil,
// and we don't want to count status bar if navigation bar is hidden (inset could be negative).
if (navctr == nil || navctr.isNavigationBarHidden) {
if (isModal) {
return 0;
} else {
CGSize statusBarSize = [self getStatusBarHeightIsModal:isModal];
return MIN(statusBarSize.width, statusBarSize.height);
}
return 0;
}

CGFloat navbarHeight = navctr.navigationBar.frame.size.height;
Expand Down
Loading