From 26bba7f9770fde7cff84912dccb1dd73183ede77 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Wed, 20 Sep 2023 11:30:26 +0700 Subject: [PATCH 1/2] fix extra spaces between text is not displayed --- src/components/LHNOptionsList/OptionRowLHN.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index f5a293701454..7b8f6fe9fe3e 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -85,8 +85,8 @@ function OptionRowLHN(props) { const displayNameStyle = StyleUtils.combineStyles([styles.optionDisplayName, styles.optionDisplayNameCompact, styles.pre, ...textUnreadStyle], props.style); const alternateTextStyle = StyleUtils.combineStyles( props.viewMode === CONST.OPTION_MODE.COMPACT - ? [textStyle, styles.optionAlternateText, styles.noWrap, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] - : [textStyle, styles.optionAlternateText, styles.noWrap, styles.textLabelSupporting], + ? [textStyle, styles.optionAlternateText, styles.pre, styles.textLabelSupporting, styles.optionAlternateTextCompact, styles.ml2] + : [textStyle, styles.optionAlternateText, styles.pre, styles.textLabelSupporting], props.style, ); const contentContainerStyles = From 13d94b348bd07da82b2526b5374bff6da10da116 Mon Sep 17 00:00:00 2001 From: DylanDylann Date: Wed, 27 Sep 2023 23:00:50 +0700 Subject: [PATCH 2/2] fix modifiedExpenseMessage case --- src/CONST.ts | 1 + src/libs/OptionsListUtils.js | 3 ++- src/libs/ReportUtils.js | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index dd192f1b257c..7f365669d357 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1217,6 +1217,7 @@ const CONST = { EMOJI_NAME: /:[\w+-]+:/g, EMOJI_SUGGESTIONS: /:[a-zA-Z0-9_+-]{1,40}$/, AFTER_FIRST_LINE_BREAK: /\n.*/g, + LINE_BREAK: /\n/g, CODE_2FA: /^\d{6}$/, ATTACHMENT_ID: /chat-attachments\/(\d+)/, HAS_COLON_ONLY_AT_THE_BEGINNING: /^:[^:]+$/, diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 8705d9f78004..b23b63a88cfe 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -398,7 +398,8 @@ function getLastMessageTextForReport(report) { const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(lastReportAction)); lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastReportAction); } else if (ReportActionUtils.isModifiedExpenseAction(lastReportAction)) { - lastMessageTextFromReport = ReportUtils.getModifiedExpenseMessage(lastReportAction); + const properSchemaForModifiedExpenseMessage = ReportUtils.getModifiedExpenseMessage(lastReportAction); + lastMessageTextFromReport = ReportUtils.formatReportLastMessageText(properSchemaForModifiedExpenseMessage, true); } else { lastMessageTextFromReport = report ? report.lastMessageText || '' : ''; diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 8e9cea908f74..40a2663a37e5 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -876,9 +876,13 @@ function canShowReportRecipientLocalTime(personalDetails, report, accountID) { /** * Shorten last message text to fixed length and trim spaces. * @param {String} lastMessageText + * @param {Boolean} isModifiedExpenseMessage * @returns {String} */ -function formatReportLastMessageText(lastMessageText) { +function formatReportLastMessageText(lastMessageText, isModifiedExpenseMessage = false) { + if (isModifiedExpenseMessage) { + return String(lastMessageText).trim().replace(CONST.REGEX.LINE_BREAK, '').trim(); + } return String(lastMessageText).trim().replace(CONST.REGEX.AFTER_FIRST_LINE_BREAK, '').substring(0, CONST.REPORT.LAST_MESSAGE_TEXT_MAX_LENGTH).trim(); }