Skip to content

Conversation

@mdjastrzebski
Copy link
Contributor

@mdjastrzebski mdjastrzebski commented Dec 11, 2025

Summary:

Resolves #54856

Fixes a but when RCTModalHostViewController tries to dismiss itself using the following code:

- (void)dismissViewController:(UIViewController *)modalViewController
                     animated:(BOOL)animated
                   completion:(void (^)(void))completion
{
  [modalViewController dismissViewControllerAnimated:animated completion:completion];
}

But since it's already presenting another VC on top of it (e.g., login web view VC, photo picker VC, etc), it dismisses that view but not itself, which results in a transparent modal VC (all the UI is unmounted) that is the top VC blocking all touch input.

image

The change is minimal: instead of calling dismissViewControllerAnimated:completion: on modalViewController, which has two different behaviors depending on whether that VC is presenting another VC, it calls it on modalViewController.presentingViewController, which has a unique behavior of dismissing modalViewController.

Changelog:

Test Plan:

  1. Run Modal examples in the RN Tester app to confirm that this code still works ok in the base case.
  2. Run the reproducer from [iOS] ModalHostViewController not properly dismissed if presenting another VC #54856 with and without the change to confirm this code fixes the issue.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 11, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 11, 2025
@mdjastrzebski
Copy link
Contributor Author

Danger change is failing due to non-related error: https://github.com/facebook/react-native/actions/runs/20138652296/job/57799224046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] ModalHostViewController not properly dismissed if presenting another VC

2 participants