diff --git a/e2e/Modals.test.js b/e2e/Modals.test.js index 3106ea4c362..b950a9a69c8 100644 --- a/e2e/Modals.test.js +++ b/e2e/Modals.test.js @@ -203,4 +203,13 @@ describe('modal', () => { await expect(elementByLabel('Toggle declared modal')).toBeVisible(); }); + + it.e2e('dismiss modal with side menu', async () => { + await elementById(TestIDs.MODAL_COMMANDS_BTN).tap(); + await elementById(TestIDs.SHOW_SIDE_MENU_MODAL).tap(); + await expect(elementByLabel('StatusBar Options')).toBeVisible(); + await elementById(TestIDs.DISMISS_MODAL_TOPBAR_BTN).tap(); + await expect(elementByLabel('StatusBar Options')).not.toBeVisible(); + await expect(elementByLabel('Modal Commands')).toBeVisible(); + }); }); diff --git a/lib/ios/RNNModalManager.m b/lib/ios/RNNModalManager.m index cf6d6ae4201..27180ad70b2 100644 --- a/lib/ios/RNNModalManager.m +++ b/lib/ios/RNNModalManager.m @@ -177,8 +177,7 @@ - (void)removePendingNextModalIfOnTop:(RNNTransitionCompletionBlock)completion _dismissModalTransitionDelegate; } - if ((modalToDismiss == topPresentedVC || - [[topPresentedVC childViewControllers] containsObject:modalToDismiss])) { + if ((modalToDismiss == topPresentedVC || [topPresentedVC findViewController:modalToDismiss])) { [self dismissSearchController:modalToDismiss]; [modalToDismiss dismissViewControllerAnimated:animated diff --git a/playground/src/screens/ModalCommandsScreen.tsx b/playground/src/screens/ModalCommandsScreen.tsx index a7959090e8d..bb56ccf1135 100644 --- a/playground/src/screens/ModalCommandsScreen.tsx +++ b/playground/src/screens/ModalCommandsScreen.tsx @@ -12,6 +12,7 @@ const { SHOW_MODAL_PROMISE_RESULT, MODAL_DISMISSED_LISTENER_RESULT, DISMISS_MODAL_PROMISE_RESULT, + SHOW_SIDE_MENU_MODAL, } = testIDs; interface State { @@ -51,6 +52,11 @@ export default class ModalScreen extends NavigationComponent