diff --git a/src/components/EmojiSuggestions.js b/src/components/EmojiSuggestions.js index 078020cc1a0a..dba14fcca6f0 100644 --- a/src/components/EmojiSuggestions.js +++ b/src/components/EmojiSuggestions.js @@ -64,11 +64,11 @@ const measureHeightOfEmojiRows = (numRows, isEmojiPickerLarge) => { }; /** - * Create unique keys for each emoji item - * @param {Object} item - * @param {Number} index - * @returns {String} - */ + * Create unique keys for each emoji item + * @param {Object} item + * @param {Number} index + * @returns {String} + */ const keyExtractor = (item, index) => `${item.name}+${index}}`; const EmojiSuggestions = (props) => { @@ -93,7 +93,7 @@ const EmojiSuggestions = (props) => { onPress={() => props.onSelect(index)} > - {EmojiUtils.emojiCode(item, props.preferredSkinToneIndex)} + {EmojiUtils.getEmojiCodeWithSkinColor(item, props.preferredSkinToneIndex)} : {_.map(styledTextArray, ({text, isColored}, i) => ( diff --git a/src/libs/EmojiUtils.js b/src/libs/EmojiUtils.js index f5cf945d3681..9e52eec797e6 100644 --- a/src/libs/EmojiUtils.js +++ b/src/libs/EmojiUtils.js @@ -254,7 +254,7 @@ function suggestEmojis(text, limit = 5) { * @param {Number} preferredSkinToneIndex * @returns {String} */ -const emojiCode = (item, preferredSkinToneIndex) => { +const getEmojiCodeWithSkinColor = (item, preferredSkinToneIndex) => { const {code, types} = item; if (types && types[preferredSkinToneIndex]) { return types[preferredSkinToneIndex]; @@ -271,5 +271,5 @@ export { replaceEmojis, suggestEmojis, trimEmojiUnicode, - emojiCode, + getEmojiCodeWithSkinColor, }; diff --git a/src/libs/GetStyledTextArray.js b/src/libs/GetStyledTextArray.js index 87e4347a16cd..cc65413ef8d2 100644 --- a/src/libs/GetStyledTextArray.js +++ b/src/libs/GetStyledTextArray.js @@ -1,4 +1,3 @@ - /** * Render a suggestion menu item component. * @param {String} name diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 98ad78e493d2..22fdc2f578ac 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -134,8 +134,7 @@ const getMaxArrowIndex = (numRows, isEmojiPickerLarge) => { class ReportActionCompose extends React.Component { constructor(props) { super(props); - this.calculateEmojiSuggestionDebounce = _.debounce(this.calculateEmojiSuggestion, 10, false); - + this.calculateEmojiSuggestion = _.debounce(this.calculateEmojiSuggestion, 10, false); this.updateComment = this.updateComment.bind(this); this.debouncedSaveReportComment = _.debounce(this.debouncedSaveReportComment.bind(this), 1000, false); this.debouncedBroadcastUserIsTyping = _.debounce(this.debouncedBroadcastUserIsTyping.bind(this), 100, true); @@ -249,7 +248,7 @@ class ReportActionCompose extends React.Component { onSelectionChange(e) { this.setState({selection: e.nativeEvent.selection}); - this.calculateEmojiSuggestionDebounce(); + this.calculateEmojiSuggestion(); } /** @@ -826,9 +825,10 @@ class ReportActionCompose extends React.Component { value={this.state.value} onLayout={(e) => { const composerHeight = e.nativeEvent.layout.height; - if (this.state.composerHeight !== composerHeight) { - this.setState({composerHeight}); + if (this.state.composerHeight === composerHeight) { + return; } + this.setState({composerHeight}); }} onScroll={this.setShouldShowSuggestionMenuToFalse} />