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 = { type InputSearchProps = {
value: string value: string
setValue: (value: string) => void changeSearchValue: (value: string) => void
} }
const InputSearch = ({ value, setValue }: InputSearchProps) => {
const InputSearch = ({ value, changeSearchValue }: InputSearchProps) => {
return ( return (
<> <Input
<Input placeholder="Search Validators"
placeholder="Search Validators" value={value}
value={value} onChangeText={changeSearchValue}
onChangeText={setValue} icon={<SearchIcon size={20} />}
icon={<SearchIcon size={20} />} onClear={() => changeSearchValue('')}
onClear={() => setValue('')} size={40}
size={40} />
// button={{
// label: 'Confirm',
// onPress: () => alert('Confirmed!'),
// }}
/>
</>
) )
} }
export default InputSearch export default InputSearch

View File

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