Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] Fix crash upon Request Preview open #26611

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/components/ReportActionItem/ReportActionItemImage.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -15,8 +16,8 @@
/** thumbnail URI for the image */
thumbnail: PropTypes.string,

/** URI for the image */
image: PropTypes.string.isRequired,
/** URI for the image and localimage is number*/

Check failure on line 19 in src/components/ReportActionItem/ReportActionItemImage.js

View workflow job for this annotation

GitHub Actions / lint

Expected space or tab before '*/' in comment
image: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
pradeepmdk marked this conversation as resolved.
Show resolved Hide resolved

/** whether or not to enable the image preview modal */
enablePreviewModal: PropTypes.bool,
Expand Down Expand Up @@ -72,7 +73,7 @@

return (
<Image
source={{uri: image}}
source={lodashIsString(image)?{uri: image}:image}
style={[styles.w100, styles.h100]}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function ReportPreview(props) {
<View style={[styles.reportPreviewBox, props.isHovered || isScanning ? styles.reportPreviewBoxHoverBorder : undefined]}>
{hasReceipts && (
<ReportActionItemImages
images={_.map(lastThreeTransactionsWithReceipts, ({receipt, filename}) => ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename))}
images={_.map(lastThreeTransactionsWithReceipts, ({receipt, filename}) => ReceiptUtils.getThumbnailAndImageURIs(receipt.source, filename || ''))}
size={3}
total={transactionsWithReceipts.length}
isHovered={props.isHovered || isScanning}
Expand Down
Loading