fix(ios): dismiss Modal from presenting VC to handle presented view controllers#55005
fix(ios): dismiss Modal from presenting VC to handle presented view controllers#55005lodev09 wants to merge 1 commit intofacebook:mainfrom
Conversation
…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.
|
Hi @lodev09! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
CLA signed |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Same as #54858 ? |
|
@migueldaipre indeed, my bad. I'll leave it here regardless. |
|
Looks like the other PR has some activity, closing this |
Summary:
When a Modal has another view controller presented on top of it (e.g., a sheet using
UISheetPresentationController), callingdismissViewControllerAnimated: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:
<Modal>visibleprop tofalseExpected: 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