From 13c9220a3caf623263cae502fdfd8e162eb373a3 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 4 Apr 2024 12:35:28 +0700 Subject: [PATCH] Fix three-dot menu item display incorrectly when opening receipt in combine report --- src/components/ReportActionItem/ReportActionItemImage.tsx | 6 ++++-- src/components/ShowContextMenuContext.ts | 2 ++ src/pages/home/report/ReportActionItem.tsx | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/ReportActionItem/ReportActionItemImage.tsx b/src/components/ReportActionItem/ReportActionItemImage.tsx index 740f784d2669..400d61b782b6 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.tsx +++ b/src/components/ReportActionItem/ReportActionItemImage.tsx @@ -95,10 +95,12 @@ function ReportActionItemImage({ if (enablePreviewModal) { return ( - {({report}) => ( + {({report, transactionThreadReport}) => ( Navigation.navigate(ROUTES.TRANSACTION_RECEIPT.getRoute(report?.reportID ?? '', transaction?.transactionID ?? ''))} + onPress={() => + Navigation.navigate(ROUTES.TRANSACTION_RECEIPT.getRoute(transactionThreadReport?.reportID ?? report?.reportID ?? '', transaction?.transactionID ?? '')) + } accessibilityLabel={translate('accessibilityHints.viewAttachment')} accessibilityRole={CONST.ROLE.BUTTON} > diff --git a/src/components/ShowContextMenuContext.ts b/src/components/ShowContextMenuContext.ts index 374ca8a2f1e5..3a996a8d2c64 100644 --- a/src/components/ShowContextMenuContext.ts +++ b/src/components/ShowContextMenuContext.ts @@ -13,6 +13,7 @@ type ShowContextMenuContextProps = { anchor: ContextMenuAnchor; report: OnyxEntry; action: OnyxEntry; + transactionThreadReport: OnyxEntry; checkIfContextMenuActive: () => void; }; @@ -20,6 +21,7 @@ const ShowContextMenuContext = createContext({ anchor: null, report: null, action: null, + transactionThreadReport: null, checkIfContextMenuActive: () => {}, }); diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 485d75c9099b..980fc7217b1d 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -366,9 +366,10 @@ function ReportActionItem({ anchor: popoverAnchorRef.current, report, action, + transactionThreadReport, checkIfContextMenuActive: toggleContextMenuFromActiveReportAction, }), - [report, action, toggleContextMenuFromActiveReportAction], + [report, action, toggleContextMenuFromActiveReportAction, transactionThreadReport], ); const actionableItemButtons: ActionableItem[] = useMemo(() => {