Skip to content

Commit

Permalink
Disable emoji suggestion box if selecting text
Browse files Browse the repository at this point in the history
  • Loading branch information
aldo-expensify committed Jun 20, 2024
1 parent 2e184c6 commit f431cb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/home/report/ReportActionCompose/SuggestionEmoji.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ function SuggestionEmoji(
* Calculates and cares about the content of an Emoji Suggester
*/
const calculateEmojiSuggestion = useCallback(
(selectionEnd?: number) => {
if (!selectionEnd || shouldBlockCalc.current || !value) {
(selectionStart?: number, selectionEnd?: number) => {
if (selectionStart !== selectionEnd || !selectionEnd || shouldBlockCalc.current || !value) {
shouldBlockCalc.current = false;
resetSuggestions();
return;
Expand Down Expand Up @@ -181,7 +181,7 @@ function SuggestionEmoji(
if (!isComposerFocused) {
return;
}
calculateEmojiSuggestion(selection.end);
calculateEmojiSuggestion(selection.start, selection.end);
}, [selection, calculateEmojiSuggestion, isComposerFocused]);

const setShouldBlockSuggestionCalc = useCallback(
Expand Down

0 comments on commit f431cb7

Please sign in to comment.