CareLuLu / react-native-web-ui-components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debounce option for autocomplete input text

clkevinf19 opened this issue · comments

Expected Behavior

I should be able to set an option in Autocomplete component to add debounce option (in millisecond) so we can prevent onChangeText from being called repeatedly in short amount of time.

Current Behavior

Autocomplete onChangeText event always fire when text is changed repeatedly in short amount of time.

Possible Solution

Add debounce on update text event, similar to https://dev.to/gabe_ragland/debouncing-with-react-hooks-jci

Context

This is helpful when you use async operation in Autocomplete component such as calling api to fetch data during onChangeText event and want to limit the operation when user stop typing for 500ms.