From d34bae417c71db877bc0dfd6ae94caeb1222382c Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sun, 3 Sep 2023 23:09:16 +0530 Subject: [PATCH 1/9] uri type case check --- src/components/ReportActionItem/ReportActionItemImage.js | 3 ++- src/components/ReportActionItem/ReportPreview.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js index 089df6cb4a6f..d6b94aed3a12 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.js +++ b/src/components/ReportActionItem/ReportActionItemImage.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import lodashIsString from 'lodash/isString'; import styles from '../../styles/styles'; import Image from '../Image'; import ThumbnailImage from '../ThumbnailImage'; @@ -72,7 +73,7 @@ function ReportActionItemImage({thumbnail, image, enablePreviewModal}) { return ( ); diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js index e962d4ea757b..dbf690b4982c 100644 --- a/src/components/ReportActionItem/ReportPreview.js +++ b/src/components/ReportActionItem/ReportPreview.js @@ -179,7 +179,7 @@ function ReportPreview(props) { {hasReceipts && ( ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename))} + images={_.map(lastThreeTransactionsWithReceipts, ({receipt, filename}) => ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename || ''))} size={3} total={transactionsWithReceipts.length} isHovered={props.isHovered || isScanning} From 775ecc32374054e54ad26598157dfb63bd6de2e3 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sun, 3 Sep 2023 23:27:02 +0530 Subject: [PATCH 2/9] allow local image --- src/components/ReportActionItem/ReportActionItemImage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js index d6b94aed3a12..73946f1154b2 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.js +++ b/src/components/ReportActionItem/ReportActionItemImage.js @@ -16,8 +16,8 @@ const propTypes = { /** thumbnail URI for the image */ thumbnail: PropTypes.string, - /** URI for the image */ - image: PropTypes.string.isRequired, + /** URI for the image and localimage is number*/ + image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /** whether or not to enable the image preview modal */ enablePreviewModal: PropTypes.bool, From f337d113bdcc5da4da5a0f0cd71fd9d558d68388 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sun, 3 Sep 2023 23:48:27 +0530 Subject: [PATCH 3/9] fix the lint issue --- src/components/ReportActionItem/ReportActionItemImage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js index 73946f1154b2..3e4e5a7e37d4 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.js +++ b/src/components/ReportActionItem/ReportActionItemImage.js @@ -16,7 +16,7 @@ const propTypes = { /** thumbnail URI for the image */ thumbnail: PropTypes.string, - /** URI for the image and localimage is number*/ + /** URI for the image and localimage is number */ image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /** whether or not to enable the image preview modal */ From 2605b0aa23d54d936a07c8b6e53f7c5cb88aed27 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sun, 3 Sep 2023 23:55:21 +0530 Subject: [PATCH 4/9] prettier fix --- src/components/ReportActionItem/ReportActionItemImage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js index 3e4e5a7e37d4..721da52237c0 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.js +++ b/src/components/ReportActionItem/ReportActionItemImage.js @@ -17,7 +17,7 @@ const propTypes = { thumbnail: PropTypes.string, /** URI for the image and localimage is number */ - image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, + image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /** whether or not to enable the image preview modal */ enablePreviewModal: PropTypes.bool, @@ -73,7 +73,7 @@ function ReportActionItemImage({thumbnail, image, enablePreviewModal}) { return ( ); From b9834767b61d2a64e4edda6ef4d5ae6d1e8ef031 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 4 Sep 2023 00:29:57 +0530 Subject: [PATCH 5/9] update the condition --- src/components/Image/index.native.js | 5 ++++- src/components/ReportActionItem/ReportActionItemImage.js | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Image/index.native.js b/src/components/Image/index.native.js index 0713fa6c7fe2..8d4bad11a769 100644 --- a/src/components/Image/index.native.js +++ b/src/components/Image/index.native.js @@ -18,7 +18,10 @@ function Image(props) { const {source, isAuthTokenRequired, session, ...rest} = props; let imageSource = source; - if (typeof source !== 'number' && isAuthTokenRequired) { + if(source && source.uri && typeof source.uri === 'number' ) { + imageSource = source.uri + } + if (typeof imageSource !== 'number' && isAuthTokenRequired) { const authToken = lodashGet(props, 'session.encryptedAuthToken', null); imageSource = { ...source, diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js index 721da52237c0..4e3cf84bd0f8 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.js +++ b/src/components/ReportActionItem/ReportActionItemImage.js @@ -1,6 +1,5 @@ import React from 'react'; import PropTypes from 'prop-types'; -import lodashIsString from 'lodash/isString'; import styles from '../../styles/styles'; import Image from '../Image'; import ThumbnailImage from '../ThumbnailImage'; @@ -16,7 +15,7 @@ const propTypes = { /** thumbnail URI for the image */ thumbnail: PropTypes.string, - /** URI for the image and localimage is number */ + /** URI for the image or local numeric reference for the image */ image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /** whether or not to enable the image preview modal */ @@ -73,7 +72,7 @@ function ReportActionItemImage({thumbnail, image, enablePreviewModal}) { return ( ); From fdff8eeb4ee075044854cb7b744cde6ffa40d739 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 4 Sep 2023 00:37:46 +0530 Subject: [PATCH 6/9] update preitter --- src/components/Image/index.native.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Image/index.native.js b/src/components/Image/index.native.js index 8d4bad11a769..9d9ad600b1d4 100644 --- a/src/components/Image/index.native.js +++ b/src/components/Image/index.native.js @@ -18,8 +18,8 @@ function Image(props) { const {source, isAuthTokenRequired, session, ...rest} = props; let imageSource = source; - if(source && source.uri && typeof source.uri === 'number' ) { - imageSource = source.uri + if (source && source.uri && typeof source.uri === 'number') { + imageSource = source.uri; } if (typeof imageSource !== 'number' && isAuthTokenRequired) { const authToken = lodashGet(props, 'session.encryptedAuthToken', null); From b7728d449427f742f2fb29bf53e6aaf08376d907 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 4 Sep 2023 00:57:20 +0530 Subject: [PATCH 7/9] Update src/components/ReportActionItem/ReportActionItemImage.js Co-authored-by: Rajat Parashar --- src/components/ReportActionItem/ReportActionItemImage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/ReportActionItemImage.js b/src/components/ReportActionItem/ReportActionItemImage.js index 4e3cf84bd0f8..5f8444af0b21 100644 --- a/src/components/ReportActionItem/ReportActionItemImage.js +++ b/src/components/ReportActionItem/ReportActionItemImage.js @@ -15,7 +15,7 @@ const propTypes = { /** thumbnail URI for the image */ thumbnail: PropTypes.string, - /** URI for the image or local numeric reference for the image */ + /** URI for the image or local numeric reference for the image */ image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, /** whether or not to enable the image preview modal */ From ad1608df5adfce030abf52923bbc5216413fa1e9 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 4 Sep 2023 01:10:31 +0530 Subject: [PATCH 8/9] update props --- src/components/Image/imagePropTypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Image/imagePropTypes.js b/src/components/Image/imagePropTypes.js index 3e9293bd2437..46ec83384d62 100644 --- a/src/components/Image/imagePropTypes.js +++ b/src/components/Image/imagePropTypes.js @@ -10,7 +10,7 @@ const imagePropTypes = { source: PropTypes.oneOfType([ PropTypes.number, PropTypes.shape({ - uri: PropTypes.string.isRequired, + uri: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, // eslint-disable-next-line react/forbid-prop-types headers: PropTypes.object, }), From 13dd7b12490d52683c828d5ae0fbd453669ebfbf Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 4 Sep 2023 02:27:42 +0530 Subject: [PATCH 9/9] filename check --- src/components/ReportActionItem/MoneyRequestPreview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ReportActionItem/MoneyRequestPreview.js b/src/components/ReportActionItem/MoneyRequestPreview.js index 5c834a53a00e..0c03f446939c 100644 --- a/src/components/ReportActionItem/MoneyRequestPreview.js +++ b/src/components/ReportActionItem/MoneyRequestPreview.js @@ -223,7 +223,7 @@ function MoneyRequestPreview(props) { {hasReceipt && ( )}