feat: add change handler for search

This commit is contained in:
RadoslavDimchev 2023-10-19 09:37:51 +03:00
parent 17b2c34845
commit 7b50860749
2 changed files with 16 additions and 17 deletions

View File

@ -3,24 +3,20 @@ import { SearchIcon } from '@status-im/icons'
type InputSearchProps = {
value: string
setValue: (value: string) => void
changeSearchValue: (value: string) => void
}
const InputSearch = ({ value, setValue }: InputSearchProps) => {
const InputSearch = ({ value, changeSearchValue }: InputSearchProps) => {
return (
<>
<Input
placeholder="Search Validators"
value={value}
onChangeText={setValue}
icon={<SearchIcon size={20} />}
onClear={() => setValue('')}
size={40}
// button={{
// label: 'Confirm',
// onPress: () => alert('Confirmed!'),
// }}
/>
</>
<Input
placeholder="Search Validators"
value={value}
onChangeText={changeSearchValue}
icon={<SearchIcon size={20} />}
onClear={() => changeSearchValue('')}
size={40}
/>
)
}
export default InputSearch

View File

@ -47,10 +47,13 @@ const ValidatorsList = () => {
dispatch(setCountOfValidators(filteredCount))
}, [searchValue, validators])
const changeSearchValue = (value: string) => {
setSearchValue(value)
}
return (
<YStack>
<InputSearch value={searchValue} setValue={setSearchValue} />
<InputSearch value={searchValue} changeSearchValue={changeSearchValue} />
<YStack space={'$1'} mt={'16px'}>
{filteredValidators.map(validator => (
<ValidatorListItem {...validator} />