Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iOS, Paper): prevent double modal dismissal #2568

Merged
merged 3 commits into from
Dec 11, 2024
Merged

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Dec 10, 2024

Description

Fixes #2525

View hierarchy for modal with header looks kinda like this:

UITransitionView -> Screen -> Stack (UINavigationController) -> Screen -> content

calling [_controller dismissViewControllerAnimated:YES completion:nil] on the Stack ☝️, according to documentation
should dismiss the view controller itself and any view controllers presented from that view controller. However in practive it dismisses not only itself and "above" modal, but also a single modal "below". I'm not sure
why it is the case. Removing this line of code introduces a bug: during development, when multiple modals are opened and you reload the react-native, the modals could be left in stuck state. I'll proceed, as this bug
bug in development is of much lesser severity.

I've decided to move the call "one up" the view controller hierarchy, to avoid calling dismiss directly on UINavigationController as it looks like it causes the problem. This fixes the problem & keeps the development behaviour working as intended.

The bug was introduced with

On Fabric this is not an issue, because invalidate is not called (Fabric does not support RCTInvalidating protocol)

Changes

Described above ☝️

Test code and steps to reproduce

I've enhanced TestModalNavigation test case to cover this issue.

Checklist

  • Included code example that can be used to test this change
  • Ensured that CI passes

@kkafar kkafar merged commit 2152383 into main Dec 11, 2024
5 checks passed
@kkafar kkafar deleted the @kkafar/paper-dismissal branch December 11, 2024 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant