feat: add change handler for search
This commit is contained in:
parent
17b2c34845
commit
7b50860749
|
@ -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
|
||||||
|
|
|
@ -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} />
|
||||||
|
|
Loading…
Reference in New Issue