@@ -5,6 +5,7 @@ import {useOnyx} from 'react-native-onyx';
5
5
import * as Expensicons from '@components/Icon/Expensicons' ;
6
6
import { usePersonalDetails } from '@components/OnyxProvider' ;
7
7
import { useOptionsList } from '@components/OptionListContextProvider' ;
8
+ import type { AnimatedTextInputRef } from '@components/RNTextInput' ;
8
9
import SelectionList from '@components/SelectionList' ;
9
10
import type { SearchQueryItem , SearchQueryListItemProps } from '@components/SelectionList/Search/SearchQueryListItem' ;
10
11
import SearchQueryListItem , { isSearchQueryItem } from '@components/SelectionList/Search/SearchQueryListItem' ;
@@ -76,6 +77,9 @@ type SearchAutocompleteListProps = {
76
77
77
78
/** Callback to highlight (e.g. scroll to) the first matched item in the list. */
78
79
onHighlightFirstItem ?: ( ) => void ;
80
+
81
+ /** Ref for textInput */
82
+ textInputRef ?: React . RefObject < AnimatedTextInputRef > ;
79
83
} ;
80
84
81
85
const defaultListOptions = {
@@ -134,8 +138,9 @@ function SearchAutocompleteList(
134
138
onListItemPress,
135
139
setTextQuery,
136
140
updateAutocompleteSubstitutions,
137
- shouldSubscribeToArrowKeyEvents,
141
+ shouldSubscribeToArrowKeyEvents = true ,
138
142
onHighlightFirstItem,
143
+ textInputRef,
139
144
} : SearchAutocompleteListProps ,
140
145
ref : ForwardedRef < SelectionListHandle > ,
141
146
) {
@@ -582,6 +587,9 @@ function SearchAutocompleteList(
582
587
onLayout = { ( ) => {
583
588
setPerformanceTimersEnd ( ) ;
584
589
setIsInitialRender ( false ) ;
590
+ if ( ! ! textInputRef ?. current && ref && 'current' in ref ) {
591
+ ref . current ?. updateExternalTextInputFocus ?.( textInputRef . current . isFocused ( ) ) ;
592
+ }
585
593
} }
586
594
showScrollIndicator = { ! shouldUseNarrowLayout }
587
595
sectionTitleStyles = { styles . mhn2 }
0 commit comments