From 1e1db5f8d32f4170f2d0532f3e452ea8abb66721 Mon Sep 17 00:00:00 2001
From: pradeepkumar <kongupradeep@live.com>
Date: Thu, 2 Nov 2023 08:58:49 +0530
Subject: [PATCH 1/5] load pdf correct path

---
 src/CONST.ts                                         |  1 +
 src/components/ReportActionItem/MoneyRequestView.js  |  1 +
 .../ReportActionItem/ReportActionItemImage.js        | 12 ++++++++----
 src/libs/ReceiptUtils.ts                             |  7 ++++++-
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/CONST.ts b/src/CONST.ts
index 6b9c504555ee..c3bb63d32299 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -1162,6 +1162,7 @@ const CONST = {
             DOC: 'doc',
             DOCX: 'docx',
             SVG: 'svg',
+            PDF: 'pdf',
         },
     },
 
diff --git a/src/components/ReportActionItem/MoneyRequestView.js b/src/components/ReportActionItem/MoneyRequestView.js
index 4b69f14213a2..ee852d5c146a 100644
--- a/src/components/ReportActionItem/MoneyRequestView.js
+++ b/src/components/ReportActionItem/MoneyRequestView.js
@@ -170,6 +170,7 @@ function MoneyRequestView({report, betas, parentReport, policyCategories, should
                             <ReportActionItemImage
                                 thumbnail={receiptURIs.thumbnail}
                                 image={receiptURIs.image}
+                                isLocalFile={receiptURIs.isLocalFile}
                                 transaction={transaction}
                                 enablePreviewModal
                             />
diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js
index d5f9f7ed06b8..b5711d43abb9 100644
--- a/src/components/ReportActionItem/ReportActionItemImage.js
+++ b/src/components/ReportActionItem/ReportActionItemImage.js
@@ -18,7 +18,7 @@ import ROUTES from '@src/ROUTES';
 
 const propTypes = {
     /** thumbnail URI for the image */
-    thumbnail: PropTypes.string,
+    thumbnail: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
 
     /** URI for the image or local numeric reference for the image  */
     image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
@@ -28,12 +28,16 @@ const propTypes = {
 
     /* The transaction associated with this image, if any. Passed for handling eReceipts. */
     transaction: transactionPropTypes,
+
+    /** whether thumbnail is refer the local file or not */
+    isLocalFile: PropTypes.bool,
 };
 
 const defaultProps = {
     thumbnail: null,
     transaction: {},
     enablePreviewModal: false,
+    isLocalFile: false,
 };
 
 /**
@@ -42,7 +46,7 @@ const defaultProps = {
  * and optional preview modal as well.
  */
 
-function ReportActionItemImage({thumbnail, image, enablePreviewModal, transaction}) {
+function ReportActionItemImage({thumbnail, image, enablePreviewModal, transaction, isLocalFile}) {
     const {translate} = useLocalize();
     const imageSource = tryResolveUrlFromApiRoot(image || '');
     const thumbnailSource = tryResolveUrlFromApiRoot(thumbnail || '');
@@ -56,7 +60,7 @@ function ReportActionItemImage({thumbnail, image, enablePreviewModal, transactio
                 <EReceiptThumbnail transactionID={transaction.transactionID} />
             </View>
         );
-    } else if (thumbnail) {
+    } else if (thumbnail && !isLocalFile) {
         receiptImageComponent = (
             <ThumbnailImage
                 previewSourceURL={thumbnailSource}
@@ -68,7 +72,7 @@ function ReportActionItemImage({thumbnail, image, enablePreviewModal, transactio
     } else {
         receiptImageComponent = (
             <Image
-                source={{uri: image}}
+                source={{uri: thumbnail || image}}
                 style={[styles.w100, styles.h100]}
             />
         );
diff --git a/src/libs/ReceiptUtils.ts b/src/libs/ReceiptUtils.ts
index 5ee177b8f831..26edade89d1c 100644
--- a/src/libs/ReceiptUtils.ts
+++ b/src/libs/ReceiptUtils.ts
@@ -11,8 +11,9 @@ import * as FileUtils from './fileDownload/FileUtils';
 
 type ThumbnailAndImageURI = {
     image: ImageSourcePropType | string;
-    thumbnail: string | null;
+    thumbnail: ImageSourcePropType | string | null;
     transaction?: Transaction;
+    isLocalFile?: boolean;
 };
 
 type FileNameAndExtension = {
@@ -65,6 +66,10 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string
         image = ReceiptSVG;
     }
 
+    if (fileExtension === CONST.IOU.FILE_TYPES.PDF) {
+        return {thumbnail: image, image: path, isLocalFile: true};
+    }
+
     return {thumbnail: null, image};
 }
 

From 61c8b1116489f2ea3a9d3cee1007b100611dba6c Mon Sep 17 00:00:00 2001
From: pradeepkumar <kongupradeep@live.com>
Date: Wed, 8 Nov 2023 18:22:51 +0530
Subject: [PATCH 2/5] update all types

---
 src/libs/ReceiptUtils.ts | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/libs/ReceiptUtils.ts b/src/libs/ReceiptUtils.ts
index 26edade89d1c..737e5ddc2e31 100644
--- a/src/libs/ReceiptUtils.ts
+++ b/src/libs/ReceiptUtils.ts
@@ -66,11 +66,7 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string
         image = ReceiptSVG;
     }
 
-    if (fileExtension === CONST.IOU.FILE_TYPES.PDF) {
-        return {thumbnail: image, image: path, isLocalFile: true};
-    }
-
-    return {thumbnail: null, image};
+    return {thumbnail: image, image: path, isLocalFile: true};
 }
 
 // eslint-disable-next-line import/prefer-default-export

From 7d28502e2a62b76eddf76c65109782458df7e980 Mon Sep 17 00:00:00 2001
From: pradeepkumar <kongupradeep@live.com>
Date: Wed, 8 Nov 2023 19:23:34 +0530
Subject: [PATCH 3/5] remove pdf

---
 src/CONST.ts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/CONST.ts b/src/CONST.ts
index c3bb63d32299..6b9c504555ee 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -1162,7 +1162,6 @@ const CONST = {
             DOC: 'doc',
             DOCX: 'docx',
             SVG: 'svg',
-            PDF: 'pdf',
         },
     },
 

From 24d0843cbcc73d50445cdc1221217f5d36aafe37 Mon Sep 17 00:00:00 2001
From: pradeepkumar <kongupradeep@live.com>
Date: Fri, 10 Nov 2023 19:14:35 +0530
Subject: [PATCH 4/5] add is local file field

---
 src/components/ReportActionItem/ReportActionItemImages.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/components/ReportActionItem/ReportActionItemImages.js b/src/components/ReportActionItem/ReportActionItemImages.js
index e44e27bb7ec0..d9fea9a8ca07 100644
--- a/src/components/ReportActionItem/ReportActionItemImages.js
+++ b/src/components/ReportActionItem/ReportActionItemImages.js
@@ -74,7 +74,7 @@ function ReportActionItemImages({images, size, total, isHovered}) {
 
     return (
         <View style={[styles.reportActionItemImages, hoverStyle, heightStyle]}>
-            {_.map(shownImages, ({thumbnail, image, transaction}, index) => {
+            {_.map(shownImages, ({thumbnail, image, transaction, isLocalFile}, index) => {
                 const isLastImage = index === numberOfShownImages - 1;
 
                 // Show a border to separate multiple images. Shown to the right for each except the last.
@@ -88,6 +88,7 @@ function ReportActionItemImages({images, size, total, isHovered}) {
                         <ReportActionItemImage
                             thumbnail={thumbnail}
                             image={image}
+                            isLocalFile={isLocalFile}
                             transaction={transaction}
                         />
                         {isLastImage && remaining > 0 && (

From ad1ee152612f57dbdfe278dcd11403868cd6cadf Mon Sep 17 00:00:00 2001
From: pradeepkumar <kongupradeep@live.com>
Date: Fri, 10 Nov 2023 20:46:04 +0530
Subject: [PATCH 5/5] update props ty;e

---
 src/components/ReportActionItem/ReportActionItemImages.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/components/ReportActionItem/ReportActionItemImages.js b/src/components/ReportActionItem/ReportActionItemImages.js
index d9fea9a8ca07..21d7c5fa3488 100644
--- a/src/components/ReportActionItem/ReportActionItemImages.js
+++ b/src/components/ReportActionItem/ReportActionItemImages.js
@@ -15,7 +15,7 @@ const propTypes = {
     /** array of image and thumbnail URIs */
     images: PropTypes.arrayOf(
         PropTypes.shape({
-            thumbnail: PropTypes.string,
+            thumbnail: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
             image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
             transaction: transactionPropTypes,
         }),
