From fbc857a0c31721f9d68c3336c24f39b43d2d016b Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 5 Jun 2023 08:07:48 +0700 Subject: [PATCH 1/2] fix: remove replace function --- src/CONST.js | 4 ---- src/pages/home/report/ReportActionCompose.js | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index 4557c66a42cc..1966b1a3c25e 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -1121,9 +1121,6 @@ const CONST = { // eslint-disable-next-line no-misleading-character-class /[\n\s,/?"{}[\]()&^%$#<>!*\p{Extended_Pictographic}\u200d\u{1f1e6}-\u{1f1ff}\u{1f3fb}-\u{1f3ff}\u{e0020}-\u{e007f}\u20E3\uFE0F]|[#*0-9]\uFE0F?\u20E3/gu, - // Define the regular expression pattern to match a string starting with a colon and ending with a space or newline character - EMOJI_REPLACER: /^:[^\n\r]+?(?=$|\s)/, - // Define the regular expression pattern to match a string starting with an at sign and ending with a space or newline character MENTION_REPLACER: // eslint-disable-next-line no-misleading-character-class @@ -1301,7 +1298,6 @@ const CONST = { USA_COUNTRY_NAME, SPACE_LENGTH: 1, - SPACE: 1, ALL_COUNTRIES: { AF: 'Afghanistan', diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 6c289eb13123..dc98221ec459 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -626,7 +626,7 @@ class ReportActionCompose extends React.Component { const commentBeforeColon = this.state.value.slice(0, this.state.colonIndex); const emojiObject = this.state.suggestedEmojis[highlightedEmojiIndex]; const emojiCode = emojiObject.types && emojiObject.types[this.props.preferredSkinTone] ? emojiObject.types[this.props.preferredSkinTone] : emojiObject.code; - const commentAfterColonWithEmojiNameRemoved = this.state.value.slice(this.state.selection.end).replace(CONST.REGEX.EMOJI_REPLACER, CONST.SPACE); + const commentAfterColonWithEmojiNameRemoved = this.state.value.slice(this.state.selection.end) this.updateComment(`${commentBeforeColon}${emojiCode} ${this.trimLeadingSpace(commentAfterColonWithEmojiNameRemoved)}`, true); // In some Android phones keyboard, the text to search for the emoji is not cleared From 703511374be1695b31eb6958f0b3787d865e3c2d Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 5 Jun 2023 08:29:06 +0700 Subject: [PATCH 2/2] fix: lint --- src/pages/home/report/ReportActionCompose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index dc98221ec459..162b2bb08a5b 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -626,7 +626,7 @@ class ReportActionCompose extends React.Component { const commentBeforeColon = this.state.value.slice(0, this.state.colonIndex); const emojiObject = this.state.suggestedEmojis[highlightedEmojiIndex]; const emojiCode = emojiObject.types && emojiObject.types[this.props.preferredSkinTone] ? emojiObject.types[this.props.preferredSkinTone] : emojiObject.code; - const commentAfterColonWithEmojiNameRemoved = this.state.value.slice(this.state.selection.end) + const commentAfterColonWithEmojiNameRemoved = this.state.value.slice(this.state.selection.end); this.updateComment(`${commentBeforeColon}${emojiCode} ${this.trimLeadingSpace(commentAfterColonWithEmojiNameRemoved)}`, true); // In some Android phones keyboard, the text to search for the emoji is not cleared