From fd9f2e04bdf44c1c70008eaf46b02205106e3b42 Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Tue, 2 Jan 2024 14:19:03 +0100 Subject: [PATCH] fix(iOS): app freeze when navigating back from any modal nested in contained modal (#1996) ## Description Updated logic in `RNSScreenStackView#setModalViewControllers:` so that it handles case when navigating back from top-level VC that was not presented by the screen stack itself, as it happens with `UIModalPresentationCurrentContext` & `UIModalPresentationOverCurrentContext`. Fixes #1813 ## Changes We now check whether the top-level VC should be dismissed by the stack being asked. ## Test code and steps to reproduce See #1813 for reproduction steps. I'm also adding these in `Example` application. ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes --- Example/src/screens/Modals.tsx | 14 ++++++++++++++ TestsExample/App.js | 2 +- ios/RNSScreenStack.mm | 16 ++++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Example/src/screens/Modals.tsx b/Example/src/screens/Modals.tsx index 47badffbc5..a98f7c3bae 100644 --- a/Example/src/screens/Modals.tsx +++ b/Example/src/screens/Modals.tsx @@ -11,6 +11,7 @@ type StackParamList = { Modal: undefined; FullscreenModal: undefined; Alert: undefined; + ContainedModal: undefined; }; interface MainScreenProps { @@ -25,6 +26,10 @@ const MainScreen = ({ navigation }: MainScreenProps): JSX.Element => ( onPress={() => navigation.navigate('FullscreenModal')} />