Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import {truncate} from 'lodash';
import lodashSortBy from 'lodash/sortBy';
import React from 'react';
Expand All @@ -11,7 +10,6 @@ import MoneyRequestSkeletonView from '@components/MoneyRequestSkeletonView';
import MultipleAvatars from '@components/MultipleAvatars';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import RenderHTML from '@components/RenderHTML';
import ReportActionItemImages from '@components/ReportActionItem/ReportActionItemImages';
import {showContextMenuForReport} from '@components/ShowContextMenuContext';
import Text from '@components/Text';
Expand Down Expand Up @@ -63,7 +61,6 @@ function MoneyRequestPreviewContent({
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
const {isSmallScreenWidth, windowWidth} = useWindowDimensions();
const parser = new ExpensiMark();

const sessionAccountID = session?.accountID;
const managerID = iouReport?.managerID ?? -1;
Expand Down Expand Up @@ -298,12 +295,9 @@ function MoneyRequestPreviewContent({
{!isCurrentUserManager && shouldShowPendingConversionMessage && (
<Text style={[styles.textLabel, styles.colorMuted]}>{translate('iou.pendingConversionMessage')}</Text>
)}
{shouldShowDescription && (
<View style={[styles.breakWord, styles.preWrap]}>
<RenderHTML html={`<muted-text>${parser.replace(merchantOrDescription)}</muted-text>`} />
</View>
{(shouldShowMerchant || shouldShowDescription) && (
<Text style={[styles.textLabelSupporting, styles.textNormal]}>{merchantOrDescription}</Text>
)}
{shouldShowMerchant && <Text style={[styles.textLabelSupporting, styles.textNormal]}>{merchantOrDescription}</Text>}
</View>
{isBillSplit && participantAccountIDs.length > 0 && !!requestAmount && requestAmount > 0 && (
<Text style={[styles.textLabel, styles.colorMuted, styles.ml1, styles.amountSplitPadding]}>
Expand Down
16 changes: 4 additions & 12 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import React, {useMemo} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
Expand All @@ -9,7 +8,6 @@ import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import RenderHTML from '@components/RenderHTML';
import SettlementButton from '@components/SettlementButton';
import {showContextMenuForReport} from '@components/ShowContextMenuContext';
import Text from '@components/Text';
Expand Down Expand Up @@ -227,16 +225,14 @@ function ReportPreview({
numberOfRequests === 1 && (!!formattedMerchant || !!formattedDescription) && !(hasOnlyTransactionsWithPendingRoutes && !totalDisplaySpend);
const shouldShowSubtitle = !isScanning && (shouldShowSingleRequestMerchantOrDescription || numberOfRequests > 1);

const {isSupportTextHtml, supportText} = useMemo(() => {
const {supportText} = useMemo(() => {
if (formattedMerchant) {
return {isSupportTextHtml: false, supportText: formattedMerchant};
return {supportText: formattedMerchant};
}
if (formattedDescription ?? moneyRequestComment) {
const parsedSubtitle = new ExpensiMark().replace(formattedDescription ?? moneyRequestComment);
return {isSupportTextHtml: !!parsedSubtitle, supportText: parsedSubtitle ? `<muted-text>${parsedSubtitle}</muted-text>` : ''};
return {supportText: formattedDescription ?? moneyRequestComment};
}
return {
isSupportTextHtml: false,
supportText: translate('iou.expenseCount', {
count: numberOfRequests - numberOfScanningReceipts - numberOfPendingRequests,
scanningReceipts: numberOfScanningReceipts,
Expand Down Expand Up @@ -310,11 +306,7 @@ function ReportPreview({
{shouldShowSubtitle && supportText && (
<View style={styles.flexRow}>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter]}>
{isSupportTextHtml ? (
<RenderHTML html={supportText} />
) : (
<Text style={[styles.textLabelSupporting, styles.textNormal, styles.lh20]}>{supportText}</Text>
)}
<Text style={[styles.textLabelSupporting, styles.textNormal, styles.lh20]}>{supportText}</Text>
</View>
</View>
)}
Expand Down