From b9a1119950a01094915ec8ce5ed8f0572c5b3fe9 Mon Sep 17 00:00:00 2001 From: Adam Grzybowski Date: Mon, 28 Oct 2024 17:46:52 +0100 Subject: [PATCH] fix Search - App returns to Inbox after deleting expense from report RHP in Search --- src/libs/ReportUtils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 9570e9c131bc..b6d07df578e7 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -75,6 +75,7 @@ import {isEmailPublicDomain} from './LoginUtils'; import ModifiedExpenseMessage from './ModifiedExpenseMessage'; import linkingConfig from './Navigation/linkingConfig'; import Navigation, {navigationRef} from './Navigation/Navigation'; +import {isFullScreenName} from './NavigationUtils'; import * as NumberUtils from './NumberUtils'; import Parser from './Parser'; import Permissions from './Permissions'; @@ -4115,10 +4116,10 @@ function navigateBackAfterDeleteTransaction(backRoute: Route | undefined, isFrom if (!backRoute) { return; } - // @TODO: Verify if this method works correctly + const rootState = navigationRef.current?.getRootState(); - const topmostRoute = rootState?.routes.at(-1); - if (topmostRoute?.name === SCREENS.SEARCH.CENTRAL_PANE) { + const lastFullScreenRoute = rootState?.routes.findLast((route) => isFullScreenName(route.name)); + if (lastFullScreenRoute?.name === SCREENS.SEARCH.CENTRAL_PANE) { Navigation.dismissModal(); return; }