@@ -19,11 +19,13 @@ import useThemeStyles from '@hooks/useThemeStyles';
1919import { mergeTransactionRequest } from '@libs/actions/MergeTransaction' ;
2020import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID' ;
2121import { buildMergedTransactionData } from '@libs/MergeTransactionUtils' ;
22+ import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute' ;
2223import Navigation from '@libs/Navigation/Navigation' ;
2324import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
2425import type { MergeTransactionNavigatorParamList } from '@libs/Navigation/types' ;
2526import CONST from '@src/CONST' ;
2627import ONYXKEYS from '@src/ONYXKEYS' ;
28+ import ROUTES from '@src/ROUTES' ;
2729import type SCREENS from '@src/SCREENS' ;
2830import type { Transaction } from '@src/types/onyx' ;
2931import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue' ;
@@ -78,7 +80,18 @@ function ConfirmationPage({route}: ConfirmationPageProps) {
7880
7981 // If we're on search, dismiss the modal and stay on search
8082 if ( ! isOnSearch && reportIDToDismiss && reportID !== targetTransaction . reportID ) {
81- Navigation . dismissModalWithReport ( { reportID : reportIDToDismiss } ) ;
83+ // Navigate to search money report screen if we're on Reports
84+ if ( isSearchTopmostFullScreenRoute ( ) ) {
85+ // Close the current modal screen
86+ Navigation . dismissModal ( ) ;
87+ // Ensure the dismiss completes first
88+ Navigation . setNavigationActionToMicrotaskQueue ( ( ) => {
89+ // Navigate to the money request report in search results
90+ Navigation . navigate ( ROUTES . SEARCH_MONEY_REQUEST_REPORT . getRoute ( { reportID : reportIDToDismiss } ) ) ;
91+ } ) ;
92+ } else {
93+ Navigation . dismissModalWithReport ( { reportID : reportIDToDismiss } ) ;
94+ }
8295 } else {
8396 Navigation . dismissModal ( ) ;
8497 }
0 commit comments