11import React , { useCallback , useEffect , useMemo , useState } from 'react' ;
2- // eslint-disable-next-line no-restricted-imports
3- import SelectionList from '@components/SelectionListWithSections' ;
4- import SingleSelectListItem from '@components/SelectionListWithSections/SingleSelectListItem' ;
52import useDebouncedState from '@hooks/useDebouncedState' ;
63import useLocalize from '@hooks/useLocalize' ;
74import Navigation from '@libs/Navigation/Navigation' ;
@@ -10,6 +7,8 @@ import {sortOptionsWithEmptyValue} from '@libs/SearchQueryUtils';
107import ROUTES from '@src/ROUTES' ;
118import type { Route } from '@src/ROUTES' ;
129import SearchFilterPageFooterButtons from './SearchFilterPageFooterButtons' ;
10+ import SelectionList from '@components/SelectionList/SelectionListWithSections' ;
11+ import SingleSelectListItem from '@components/SelectionList/ListItem/SingleSelectListItem' ;
1312
1413type SearchSingleSelectionPickerItem = {
1514 name : string ;
@@ -72,14 +71,12 @@ function SearchSingleSelectionPicker({
7271 {
7372 title : undefined ,
7473 data : initiallySelectedItemSection ,
75- shouldShow : initiallySelectedItemSection . length > 0 ,
76- indexOffset : 0 ,
74+ sectionIndex : 0 ,
7775 } ,
7876 {
7977 title : pickerTitle ,
8078 data : remainingItemsSection ,
81- shouldShow : remainingItemsSection . length > 0 ,
82- indexOffset : initiallySelectedItemSection . length ,
79+ sectionIndex : 1 ,
8380 } ,
8481 ] ,
8582 noResultsFound : isEmpty ,
@@ -121,21 +118,27 @@ function SearchSingleSelectionPicker({
121118 ) ,
122119 [ resetChanges , applyChanges ] ,
123120 ) ;
121+
122+ const textInputOptions = {
123+ value : searchTerm ,
124+ label : translate ( 'common.search' ) ,
125+ onChangeText : setSearchTerm ,
126+ headerMessage : noResultsFound ? translate ( 'common.noResultsFound' ) : undefined ,
127+ } ;
128+
129+
124130 return (
125131 < SelectionList
126132 sections = { sections }
127- initiallyFocusedOptionKey = { initiallySelectedItem ?. value }
128- textInputValue = { searchTerm }
129- onChangeText = { setSearchTerm }
130- textInputLabel = { shouldShowTextInput ? translate ( 'common.search' ) : undefined }
131133 onSelectRow = { onSelectItem }
132- headerMessage = { noResultsFound ? translate ( 'common.noResultsFound' ) : undefined }
134+ ListItem = { SingleSelectListItem }
135+ initiallyFocusedItemKey = { initiallySelectedItem ?. value }
136+ shouldShowTextInput = { shouldShowTextInput }
137+ textInputOptions = { textInputOptions }
133138 footerContent = { shouldAutoSave ? undefined : footerContent }
134- shouldStopPropagation
135139 showLoadingPlaceholder = { ! noResultsFound }
136- shouldShowTooltips
137- ListItem = { SingleSelectListItem }
138140 shouldUpdateFocusedIndex
141+ shouldStopPropagation
139142 />
140143 ) ;
141144}
0 commit comments