diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 356e75b1e1bb..83a1126756c7 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -46,7 +46,7 @@ import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimen const propTypes = { /** Optional source (URL, SVG function) for the image shown. If not passed in via props must be specified when modal is opened. */ - source: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), + source: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.number]), /** Optional callback to fire when we want to preview an image and approve it for use. */ onConfirm: PropTypes.func, diff --git a/src/components/Attachments/AttachmentCarousel/attachmentCarouselPropTypes.js b/src/components/Attachments/AttachmentCarousel/attachmentCarouselPropTypes.js index 7543e8d9c099..72a554de68be 100644 --- a/src/components/Attachments/AttachmentCarousel/attachmentCarouselPropTypes.js +++ b/src/components/Attachments/AttachmentCarousel/attachmentCarouselPropTypes.js @@ -5,7 +5,7 @@ import reportPropTypes from '@pages/reportPropTypes'; const propTypes = { /** source is used to determine the starting index in the array of attachments */ - source: PropTypes.string, + source: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), /** Callback to update the parent modal's state with a source and name from the attachments array */ onNavigate: PropTypes.func, diff --git a/src/pages/home/report/ReportAttachments.js b/src/pages/home/report/ReportAttachments.js index c580da7887a2..8ecbb036a756 100644 --- a/src/pages/home/report/ReportAttachments.js +++ b/src/pages/home/report/ReportAttachments.js @@ -23,7 +23,10 @@ const propTypes = { function ReportAttachments(props) { const reportID = _.get(props, ['route', 'params', 'reportID']); const report = ReportUtils.getReport(reportID); - const source = decodeURI(_.get(props, ['route', 'params', 'source'])); + + // In native the imported images sources are of type number. Ref: https://reactnative.dev/docs/image#imagesource + const decodedSource = decodeURI(_.get(props, ['route', 'params', 'source'])); + const source = Number(decodedSource) || decodedSource; const onCarouselAttachmentChange = useCallback( (attachment) => {