Skip to content
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
16 changes: 16 additions & 0 deletions ios/RNSScreenStack.mm
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,22 @@ - (void)layoutSubviews
{
[super layoutSubviews];
_controller.view.frame = self.bounds;

// We need to update the bounds of the modal views here, since
// for contained modals they are not updated by modals themselves.
for (UIViewController *modal in _presentedModals) {
// Because `layoutSubviews` method is also called on grabbing the modal,
// we don't want to update the frame when modal is being dismissed.
// We also want to get the frame in correct position. In the best case, it
// should be modal's superview (UITransitionView), which frame is being changed correctly.
// Otherwise, when superview is nil, we will fallback to the bounds of the ScreenStack.
BOOL isModalBeingDismissed = [modal isKindOfClass:[RNSScreen class]] && ((RNSScreen *)modal).isBeingDismissed;
CGRect correctFrame = modal.view.superview != nil ? modal.view.superview.frame : self.bounds;

if (!CGRectEqualToRect(modal.view.frame, correctFrame) && !isModalBeingDismissed) {
modal.view.frame = correctFrame;
}
}
}

- (void)dismissOnReload
Expand Down