You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
[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-claBot
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
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?
@cipolleschi I can't record a video. This sandbox has no iOS Simulator or device, so I can't run the app reproducer.
Instead, I modeled the UIKit rule that causes the bug: dismissViewController always forwards to the topmost presented child. I ran that model before and after the fix.
Before the fix: the alert closes, but the modal stays onscreen as an empty sheet.
After the fix: the alert and the modal both close.
This isn't the real app repro, just the dismiss logic in isolation. The PR also adds RCTModalHostViewComponentViewTests.mm, which covers the same logic through XCTest. I can't compile or run that here either, since this environment has no Xcode toolchain. I traced it by hand against the new code and it matches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.MergedThis PR has been merged.Shared with MetaApplied via automation to indicate that an Issue or Pull Request has been shared with the team.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Dismissing a
Modalon 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.RCTModalHostViewComponentViewdismissed the modal's view controller directly, but UIKit forwardsdismissViewControllerAnimated: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
presentingViewControllerwhenever 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 throughpresentingViewController, 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.