Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(iOS, Paper): prevent double modal dismissal (#2568)
## 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](https://developer.apple.com/documentation/uikit/uiviewcontroller/dismiss(animated:completion:)?language=objc) 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. ## Changes Described above ☝️ ## Test code and steps to reproduce I've enhanced `TestModalNavigation` test case to cover this issue. ## Checklist - [x] Included code example that can be used to test this change - [ ] Ensured that CI passes
- Loading branch information