File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/components/TextareaComposer/SuggestionList Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type { TextComposerSuggestion } from 'stream-chat';
66import type { UserItemProps } from './UserItem' ;
77import type { CommandItemProps } from './CommandItem' ;
88import type { EmoticonItemProps } from './EmoticonItem' ;
9+ import { useMessageInputContext } from '../../../context' ;
910
1011export type DefaultSuggestionListItemEntity =
1112 | UserItemProps [ 'entity' ]
@@ -33,11 +34,13 @@ export const SuggestionListItem = React.forwardRef<
3334 innerRef : Ref < HTMLButtonElement > ,
3435) {
3536 const { textComposer } = useMessageComposer ( ) ;
37+ const { textareaRef } = useMessageInputContext ( ) ;
3638 const containerRef = useRef < HTMLLIElement > ( null ) ;
3739
3840 const handleSelect = useCallback ( ( ) => {
3941 textComposer . handleSelect ( item ) ;
40- } , [ item , textComposer ] ) ;
42+ textareaRef . current ?. focus ( ) ;
43+ } , [ item , textareaRef , textComposer ] ) ;
4144
4245 useLayoutEffect ( ( ) => {
4346 if ( ! focused ) return ;
You can’t perform that action at this time.
0 commit comments