Skip to content

Conversation

@lodev09
Copy link

@lodev09 lodev09 commented Dec 31, 2025

Summary:

When a Modal has another view controller presented on top of it (e.g., a sheet using UISheetPresentationController), calling dismissViewControllerAnimated: on the modal itself only dismisses the topmost presented view controller, leaving the modal in an inconsistent state where it remains presented but its React content is unmounted—resulting in a blank screen.

This fix dismisses from the presenting view controller instead, which correctly dismisses the entire presentation chain including any view controllers presented on top of the modal.

This issue affects any library that presents view controllers on top of RN Modal, such as @lodev09/react-native-true-sheet.

Changelog:

[iOS] [Fixed] - Modal now correctly dismisses when another view controller is presented on top of it

Test Plan:

  1. Present a React Native <Modal>
  2. Present another view controller on top of it (e.g., a sheet)
  3. Set the Modal's visible prop to false

Expected: Both the sheet and modal dismiss, returning to the original screen
Actual: The sheet dismisses but the modal remains presented with blank/black content

Before

before.mov

After

after.mov
…ontrollers

When a Modal has another view controller presented on top of it (e.g., a sheet),
calling dismissViewControllerAnimated: on the modal itself only dismisses the
topmost presented view controller, leaving the modal in an inconsistent state
where it remains presented but its React content is unmounted.

This fix dismisses from the presenting view controller instead, which correctly
dismisses the entire presentation chain including any view controllers presented
on top of the modal.
@meta-cla
Copy link

meta-cla bot commented Dec 31, 2025

Hi @lodev09!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@lodev09
Copy link
Author

lodev09 commented Dec 31, 2025

CLA signed

@meta-cla
Copy link

meta-cla bot commented Dec 31, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 31, 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 31, 2025
@migueldaipre
Copy link
Collaborator

Same as #54858 ?

@lodev09
Copy link
Author

lodev09 commented Dec 31, 2025

@migueldaipre indeed, my bad. I'll leave it here regardless.

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.

3 participants