Skip to content

Fix Modal staying onscreen when dismissed while presenting a child controller - #58364

Open
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-58326-modal-dismiss-presented-child
Open

Fix Modal staying onscreen when dismissed while presenting a child controller#58364
lazerg wants to merge 1 commit into
react:mainfrom
lazerg:fix/issue-58326-modal-dismiss-presented-child

Conversation

@lazerg

@lazerg lazerg commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary:

Dismissing a Modal on iOS/Fabric while it was presenting a child view controller (a system alert, an action sheet, the dev menu) left the modal itself stuck onscreen as an empty sheet. RCTModalHostViewComponentView dismissed the modal's view controller directly, but UIKit forwards dismissViewControllerAnimated: calls to the topmost presented child, so only the alert closed while React still thought the modal was gone.

Now the dismissal goes through the modal's presentingViewController whenever it has a presented child, closing the whole stack in one animation.

Fixes #58326

Changelog:

[IOS] [FIXED] - Fix Modal staying onscreen when dismissed while presenting a child view controller

Test Plan:

Added RCTModalHostViewComponentViewTests.mm: dismissing with a presented child redirects through presentingViewController, falls back to the modal itself when that's nil, and the no-child path still dismisses directly. Couldn't run against a simulator in this environment (no full Xcode/CocoaPods toolchain available here); traced the issue's repro steps against the new logic by hand.

@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 Sep 6, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 6, 2026

@cipolleschi cipolleschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this.
Code makes sense. Can you add a video in the Test Plan using the same reproducer of the issue that shows that the issue is fixed?

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][Fabric] Modal leaves an empty sheet when dismissed while presenting another view controller

2 participants