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): fix quick modal presentation sequence where foreign modal is being dismissed #2671

Merged
merged 3 commits into from
Feb 6, 2025
Merged
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion ios/RNSScreenStack.mm
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,18 @@ - (void)setModalViewControllers:(NSArray<UIViewController *> *)controllers
// See: https://github.com/software-mansion/react-native-screens/issues/2048
// For now, to mitigate the issue, we also decide to trigger its dismissal before
// starting the presentation chain down below in finish() callback.
[changeRootController dismissViewControllerAnimated:shouldAnimate completion:finish];
if (!firstModalToBeDismissed.isBeingDismissed) {
[firstModalToBeDismissed dismissViewControllerAnimated:shouldAnimate completion:finish];
} else {
// We need to wait for its dismissal and then run our presentation code.
// This happens, e.g. when we have foreign modal presented on top of owned one & we dismiss foreign one and
// immediately present another owned one. Dismissal of the foreign one will be triggered by foreign controller.
[[firstModalToBeDismissed transitionCoordinator]
animateAlongsideTransition:nil
completion:^(id<UIViewControllerTransitionCoordinatorContext> _) {
finish();
}];
}
return;
}
}
Expand Down
Loading