diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 2ad3fe8262cd..f00454099a03 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -755,14 +755,11 @@ function BaseSelectionList( isTextInputFocusedRef.current = isTextInputFocused; }, []); - useImperativeHandle(ref, () => ({scrollAndHighlightItem, clearInputAfterSelect, updateAndScrollToFocusedIndex, updateExternalTextInputFocus, scrollToIndex, getFocusedOption}), [ - scrollAndHighlightItem, - clearInputAfterSelect, - updateAndScrollToFocusedIndex, - updateExternalTextInputFocus, - scrollToIndex, - getFocusedOption, - ]); + useImperativeHandle( + ref, + () => ({scrollAndHighlightItem, clearInputAfterSelect, updateAndScrollToFocusedIndex, updateExternalTextInputFocus, scrollToIndex, getFocusedOption, focusTextInput}), + [scrollAndHighlightItem, clearInputAfterSelect, updateAndScrollToFocusedIndex, updateExternalTextInputFocus, scrollToIndex, getFocusedOption, focusTextInput], + ); /** Selects row when pressing Enter */ useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, selectFocusedOption, { diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 5c7bd13d97e6..213fd71d0632 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -645,6 +645,7 @@ type SelectionListHandle = { updateAndScrollToFocusedIndex: (newFocusedIndex: number) => void; updateExternalTextInputFocus: (isTextInputFocused: boolean) => void; getFocusedOption: () => ListItem | undefined; + focusTextInput: () => void; }; type ItemLayout = { diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index e513ba7b571d..4d17997c56fb 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -236,6 +236,8 @@ function NewChatPage() { selectionListRef?.current?.clearInputAfterSelect?.(); + selectionListRef.current?.focusTextInput(); + selectionListRef?.current?.scrollToIndex(Math.max(newSelectedOptions.length - 1, 0), true); setSelectedOptions(newSelectedOptions); }