Skip to content
Merged
Changes from all 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
8 changes: 5 additions & 3 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ function PureReportActionItem({
// Show the MoneyRequestPreview for when expense is present
if (isIOURequestReportAction(action)) {
const isSplitInGroupChat = moneyRequestActionType === CONST.IOU.REPORT_ACTION_TYPE.SPLIT && report?.chatType === CONST.REPORT.CHAT_TYPE.GROUP;
const isSplitScanWithNoAmount = moneyRequestActionType === CONST.IOU.REPORT_ACTION_TYPE.SPLIT && moneyRequestOriginalMessage?.amount === 0;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that if we scan an invalid receipt, then the amount stays 0 and impossible for user to input it manually, so we need to show it when the amount is 0.

const shouldShowSplitPreview = isSplitInGroupChat || isSplitScanWithNoAmount;
const chatReportID = moneyRequestOriginalMessage?.IOUReportID ? report?.chatReportID : reportID;
// There is no single iouReport for bill splits, so only 1:1 requests require an iouReportID
const iouReportID = moneyRequestOriginalMessage?.IOUReportID?.toString();
Expand All @@ -836,7 +838,7 @@ function PureReportActionItem({

// Table Report View does not display these components as separate messages, except for self-DM
if (isBetaEnabled(CONST.BETAS.TABLE_REPORT_VIEW) && report?.type === CONST.REPORT.TYPE.CHAT) {
if (report.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM || isSplitInGroupChat) {
if (report.chatType === CONST.REPORT.CHAT_TYPE.SELF_DM || shouldShowSplitPreview) {
children = (
<View style={[styles.mt1, styles.w100]}>
<TransactionPreview
Expand All @@ -846,11 +848,11 @@ function PureReportActionItem({
action={action}
shouldDisplayContextMenu={shouldDisplayContextMenu}
isBillSplit={isSplitBillActionReportActionsUtils(action)}
transactionID={isSplitInGroupChat ? moneyRequestOriginalMessage?.IOUTransactionID : undefined}
transactionID={shouldShowSplitPreview ? moneyRequestOriginalMessage?.IOUTransactionID : undefined}
containerStyles={[shouldUseNarrowLayout ? {...styles.w100, ...styles.mw100} : reportPreviewStyles.transactionPreviewStyle, styles.mt1]}
transactionPreviewWidth={shouldUseNarrowLayout ? styles.w100.width : reportPreviewStyles.transactionPreviewStyle.width}
onPreviewPressed={() => {
if (isSplitInGroupChat) {
if (shouldShowSplitPreview) {
Navigation.navigate(ROUTES.SPLIT_BILL_DETAILS.getRoute(chatReportID, action.reportActionID, Navigation.getReportRHPActiveRoute()));
return;
}
Expand Down