From 1cb48f940539ca5d67fc827ecd46aa57bb56356c Mon Sep 17 00:00:00 2001 From: tboba Date: Thu, 15 Feb 2024 16:03:10 +0100 Subject: [PATCH 1/2] Remove calculation of status bar height when header is not shown --- ios/RNSScreen.mm | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index a4cbfe27ae..063ee8ca97 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -1111,17 +1111,10 @@ - (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 and we don't want to count status bar. 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; From abbfc939b2665ad053325cc46b1490f16553a305 Mon Sep 17 00:00:00 2001 From: tboba Date: Thu, 15 Feb 2024 16:16:08 +0100 Subject: [PATCH 2/2] Correct comment --- ios/RNSScreen.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm index 063ee8ca97..e2e8a304aa 100644 --- a/ios/RNSScreen.mm +++ b/ios/RNSScreen.mm @@ -1112,7 +1112,8 @@ - (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal UINavigationController *navctr = [self getVisibleNavigationControllerIsModal:isModal]; // 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 and we don't want to count status bar. + // 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) { return 0; }