From 106090da42909f82e236c27dbc9246e80a6677c8 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 20 Oct 2023 11:16:04 -0600 Subject: [PATCH] Merge pull request #30092 from s-alves10/fix/issue-30083 fix: update first emoji index on mount (cherry picked from commit ccc5e3cb7f796d196729a840de7966bfe65dda73) --- src/components/EmojiPicker/EmojiPickerMenu/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/EmojiPicker/EmojiPickerMenu/index.js b/src/components/EmojiPicker/EmojiPickerMenu/index.js index 0d7826ff3783..fe194f0cdaf2 100755 --- a/src/components/EmojiPicker/EmojiPickerMenu/index.js +++ b/src/components/EmojiPicker/EmojiPickerMenu/index.js @@ -371,13 +371,17 @@ function EmojiPickerMenu(props) { } setupEventHandlers(); - updateFirstNonHeaderIndex(emojis.current); return () => { cleanupEventHandlers(); }; }, [forwardedRef, shouldFocusInputOnScreenFocus, cleanupEventHandlers, setupEventHandlers]); + useEffect(() => { + // Find and store index of the first emoji item on mount + updateFirstNonHeaderIndex(emojis.current); + }, []); + const scrollToHeader = useCallback((headerIndex) => { if (!emojiListRef.current) { return;