Skip to content

Commit

Permalink
Apply changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tboba committed Oct 11, 2023
1 parent 9529047 commit 8884bef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
19 changes: 4 additions & 15 deletions ios/RNSScreen.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1060,23 +1060,12 @@ - (CGFloat)getNavigationBarHeightIsModal:(BOOL)isModal

- (CGFloat)getNavigationBarInsetIsModal:(BOOL)isModal
{
#if !TARGET_OS_TV
BOOL isDraggableModal = isModal && ![self.screenView isFullscreenModal];
BOOL isDraggableModalWithChildViewCtr =
isDraggableModal && self.childViewControllers.count > 0 && self.childViewControllers[0] != nil;

// When modal is floating (we can grab its header), we don't want to get inset of the navigation bar.
// Thus, we return '0' as an inset.
if (isDraggableModalWithChildViewCtr || self.screenView.isTransparentModal) {
return 0;
}

return self.navigationController.navigationBar.frame.origin.y;

#else
#if TARGET_OS_TV
// On TVOS there's no inset of navigation bar.
return 0;
#endif // !TARGET_OS_TV
#endif // TARGET_OS_TV

return self.navigationController.navigationBar.frame.origin.y;
}

- (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal
Expand Down
4 changes: 1 addition & 3 deletions ios/RNSScreenStackHeaderConfig.mm
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ - (void)updateViewControllerIfNeeded
[RNSScreenStackHeaderConfig updateViewController:self.screenView.controller withConfig:self animated:YES];
// As the header might have change in `updateViewController` we need to ensure that header height
// returned by the `onHeaderHeightChange` event is correct.
if ([vc isKindOfClass:[RNSScreen class]]) {
[(RNSScreen *)self.screenView.controller calculateAndNotifyHeaderHeightChangeIsModal:NO];
}
[(RNSScreen *)self.screenView.controller calculateAndNotifyHeaderHeightChangeIsModal:NO];
}
}

Expand Down

0 comments on commit 8884bef

Please sign in to comment.