Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/pages/Debug/ConstantPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import isObject from 'lodash/isObject';
import React, {useMemo, useState} from 'react';
import SelectionList from '@components/SelectionListWithSections';
import RadioListItem from '@components/SelectionListWithSections/RadioListItem';
import type {ListItem} from '@components/SelectionListWithSections/types';
import SelectionList from '@components/SelectionList';
import RadioListItem from '@components/SelectionList/ListItem/RadioListItem';
import type {ListItem} from '@components/SelectionList/types';
import useLocalize from '@hooks/useLocalize';
import tokenizedSearch from '@libs/tokenizedSearch';
import type {DebugForms} from './const';
Expand Down Expand Up @@ -53,15 +53,22 @@ function ConstantPicker({formType, fieldName, fieldValue, onSubmit}: ConstantPic
);
const selectedOptionKey = useMemo(() => sections.find((option) => option.searchText === fieldValue)?.keyForList, [sections, fieldValue]);

const textInputOptions = useMemo(
() => ({
value: searchValue,
label: translate('common.search'),
onChangeText: setSearchValue,
}),
[searchValue, translate, setSearchValue],
);

return (
<SelectionList
sections={[{data: sections}]}
textInputValue={searchValue}
textInputLabel={translate('common.search')}
onChangeText={setSearchValue}
data={sections}
textInputOptions={textInputOptions}
onSelectRow={onSubmit}
ListItem={RadioListItem}
initiallyFocusedOptionKey={selectedOptionKey ?? undefined}
initiallyFocusedItemKey={selectedOptionKey}
isRowMultilineSupported
/>
);
Expand Down
Loading