diff --git a/src/components/ReportActionItem/MoneyRequestAction.tsx b/src/components/ReportActionItem/MoneyRequestAction.tsx index 2936fddd0376..b07f70c89038 100644 --- a/src/components/ReportActionItem/MoneyRequestAction.tsx +++ b/src/components/ReportActionItem/MoneyRequestAction.tsx @@ -112,6 +112,10 @@ function MoneyRequestAction({ } return ${translate(message)}`} />; } + + // TODO: this part of code is needed here if we want to replace MoneyRequestPreview with TransactionPreview + // const renderCondition = lodashIsEmpty(iouReport) && !(isSplitBillAction || isTrackExpenseAction); + // return renderCondition ? null : ( return ( [ + { + backgroundColor: theme.cardBG, + }, + ], + [theme.cardBG], + ); + + const shouldShowCategoryOrTag = shouldShowCategory || shouldShowTag; + + const childContainer = ( + + offlineWithFeedbackOnClose} + errorRowStyles={[styles.mbn1]} + needsOffscreenAlphaCompositing + pendingAction={pendingAction} + shouldDisableStrikeThrough={isDeleted} + shouldDisableOpacity={isDeleted} + > + + {!isDeleted && ( + + )} + {shouldShowSkeleton ? ( + + ) : ( + + + + {isIOU && !!from && !!to && ( + + + + )} + + {previewHeaderText} + {isBillSplit && ( + + + + )} + {!isBillSplit && !shouldShowDescription && !shouldShowMerchant && ( + + {displayAmount} + + )} + + + + + {(shouldShowMerchant || shouldShowDescription) && ( + + {merchantOrDescription} + + )} + {(shouldShowMerchant || shouldShowDescription || isBillSplit) && ( + + {displayAmount} + + )} + + + + {!!splitShare && ( + + {translate('iou.yourSplit', {amount: convertToDisplayString(splitShare, requestCurrency)})} + + )} + + + {shouldShowCategoryOrTag && ( + + {shouldShowCategory && ( + + + + {category} + + + )} + {shouldShowTag && !!tag && ( + + + + {getCleanedTagName(tag)} + + + )} + + )} + + {!isSettled && shouldShowRBR && ( + + + + {RBRmessage} + + + )} + + + )} + + + + ); + + if (!onPreviewPressed) { + return childContainer; + } + + return ( + canUseTouchScreen() && ControlSelection.block()} + onPressOut={() => ControlSelection.unblock()} + onLongPress={showContextMenu} + shouldUseHapticsOnLongPress + accessibilityLabel={isBillSplit ? translate('iou.split') : showCashOrCard} + accessibilityHint={convertToDisplayString(requestAmount, requestCurrency)} + style={[ + styles.moneyRequestPreviewBox, + containerStyles, + themeStyles, + shouldDisableOnPress && styles.cursorDefault, + (isSettled || isApproved) && isSettlementOrApprovalPartial && styles.offlineFeedback.pending, + ]} + > + {childContainer} + {isReviewDuplicateTransactionPage && !isSettled && !isApproved && shouldShowKeepButton && ( +