diff --git a/src/pages/iou/request/MoneyRequestAccountantSelector.tsx b/src/pages/iou/request/MoneyRequestAccountantSelector.tsx index 4bd11762780e..1748f0174997 100644 --- a/src/pages/iou/request/MoneyRequestAccountantSelector.tsx +++ b/src/pages/iou/request/MoneyRequestAccountantSelector.tsx @@ -5,9 +5,8 @@ import type {GestureResponderEvent} from 'react-native'; import EmptySelectionListContent from '@components/EmptySelectionListContent'; import {usePersonalDetails} from '@components/OnyxListItemProvider'; import {useOptionsList} from '@components/OptionListContextProvider'; -// eslint-disable-next-line no-restricted-imports -import SelectionList from '@components/SelectionListWithSections'; -import InviteMemberListItem from '@components/SelectionListWithSections/InviteMemberListItem'; +import InviteMemberListItem from '@components/SelectionList/ListItem/InviteMemberListItem'; +import SelectionListWithSections from '@components/SelectionList/SelectionListWithSections'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; @@ -16,7 +15,6 @@ import useOnyx from '@hooks/useOnyx'; import useScreenWrapperTransitionStatus from '@hooks/useScreenWrapperTransitionStatus'; import {canUseTouchScreen} from '@libs/DeviceCapabilities'; import memoize from '@libs/memoize'; -import type {Section} from '@libs/OptionsListUtils'; import { filterAndOrderOptions, formatSectionsFromSearchTerm, @@ -28,6 +26,7 @@ import { isCurrentUser, orderOptions, } from '@libs/OptionsListUtils'; +import type {SelectionListSections} from '@libs/OptionsListUtils/types'; import {searchInServer} from '@userActions/Report'; import type {IOUAction, IOUType} from '@src/CONST'; import CONST from '@src/CONST'; @@ -145,7 +144,7 @@ function MoneyRequestAccountantSelector({onFinish, onAccountantSelected, iouType * Returns the sections needed for the OptionsSelector */ const [sections, header] = useMemo(() => { - const newSections: Section[] = []; + const newSections: SelectionListSections = []; if (!areOptionsInitialized || !didScreenTransitionEnd) { return [newSections, '']; } @@ -164,20 +163,18 @@ function MoneyRequestAccountantSelector({onFinish, onAccountantSelected, iouType undefined, reportAttributesDerived, ); - // Just a temporary fix to satisfy the type checker - // Will be fixed when migrating to use new SelectionListWithSections - newSections.push({...formatResults.section, title: undefined, shouldShow: true}); + newSections.push({...formatResults.section, sectionIndex: 0}); newSections.push({ title: translate('common.recents'), data: fiveRecents, - shouldShow: fiveRecents.length > 0, + sectionIndex: 1, }); newSections.push({ title: translate('common.contacts'), data: contactsWithRestOfRecents, - shouldShow: contactsWithRestOfRecents.length > 0, + sectionIndex: 2, }); if ( @@ -196,7 +193,7 @@ function MoneyRequestAccountantSelector({onFinish, onAccountantSelected, iouType ? getPolicyExpenseReportOption(participant, currentUserAccountID, personalDetails, reportAttributesDerived) : getParticipantsOption(participant, personalDetails); }), - shouldShow: true, + sectionIndex: 3, }); } @@ -255,23 +252,31 @@ function MoneyRequestAccountantSelector({onFinish, onAccountantSelected, iouType const shouldShowListEmptyContent = useMemo(() => optionLength === 0 && !showLoadingPlaceholder, [optionLength, showLoadingPlaceholder]); + const textInputOptions = { + value: searchTerm, + label: translate('selectionList.nameEmailOrPhoneNumber'), + onChangeText: setSearchTerm, + headerMessage: header, + hint: offlineMessage, + }; + return ( - } - headerMessage={header} showLoadingPlaceholder={showLoadingPlaceholder} isLoadingNewOptions={!!isSearchingForReports} - shouldShowListEmptyContent={shouldShowListEmptyContent} + showListEmptyContent={shouldShowListEmptyContent} + disableMaintainingScrollPosition /> ); }