Skip to content

Commit

Permalink
Add check if modal is being dismissed to avoid redundant calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
tboba committed Oct 17, 2023
1 parent dc987c6 commit 686a221
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ios/RNSScreenStack.mm
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ - (void)viewDidLayoutSubviews
[super viewDidLayoutSubviews];
if ([self.topViewController isKindOfClass:[RNSScreen class]]) {
RNSScreen *screenController = (RNSScreen *)self.topViewController;
BOOL isNotDismissingModal = screenController.presentedViewController == nil ||
(screenController.presentedViewController != nil &&
![screenController.presentedViewController isBeingDismissed]);

// Calculate header height during simple transition from one screen to another.
// If RNSScreen includes a navigation controller of type RNSNavigationController, it should not calculate
// header height, as it could have nested stack.
if (![screenController hasNestedStack]) {
if (![screenController hasNestedStack] && isNotDismissingModal) {
[screenController calculateAndNotifyHeaderHeightChangeIsModal:NO];
}
}
Expand Down

0 comments on commit 686a221

Please sign in to comment.