Skip to content

Commit

Permalink
Merge pull request #31289 from eh2077/30188-fix-emoji-suggestion-does…
Browse files Browse the repository at this point in the history
…-not-reopen-on-revisit

Fix: emoji suggestion does't reopen on revisit
  • Loading branch information
cristipaval authored Nov 22, 2023
2 parents 6c29cab + 0845f62 commit e5720a0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pages/home/report/ReportActionCompose/SuggestionEmoji.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React, {useCallback, useImperativeHandle, useRef, useState} from 'react';
import React, {useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import EmojiSuggestions from '@components/EmojiSuggestions';
Expand Down Expand Up @@ -59,6 +59,7 @@ function SuggestionEmoji({
forwardedRef,
resetKeyboardInput,
measureParentContainer,
isComposerFocused,
}) {
const [suggestionValues, setSuggestionValues] = useState(defaultSuggestionsValues);

Expand Down Expand Up @@ -180,6 +181,13 @@ function SuggestionEmoji({
[value, preferredLocale, setHighlightedEmojiIndex, resetSuggestions],
);

useEffect(() => {
if (!isComposerFocused) {
return;
}
calculateEmojiSuggestion(selection.end);
}, [selection, calculateEmojiSuggestion, isComposerFocused]);

const onSelectionChange = useCallback(
(e) => {
/**
Expand Down

0 comments on commit e5720a0

Please sign in to comment.