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: multiple modal on iOS #31498

20 changes: 16 additions & 4 deletions React/Views/RCTModalHostViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,22 @@ - (void)presentModalHostView:(RCTModalHostView *)modalHostView
if (_presentationBlock) {
_presentationBlock([modalHostView reactViewController], viewController, animated, completionBlock);
} else {
[[modalHostView reactViewController] presentViewController:viewController
animated:animated
completion:completionBlock];
}

UIViewController *lastPresentedViewController = modalHostView.reactViewController;
UIViewController *presentedViewController = nil;


while (lastPresentedViewController != nil) {
presentedViewController = lastPresentedViewController;
lastPresentedViewController = lastPresentedViewController.presentedViewController;
}


[presentedViewController presentViewController:viewController
animated:animated
completion:completionBlock];
}

}

- (void)dismissModalHostView:(RCTModalHostView *)modalHostView
Expand Down