I have an issue with React Native Textinput with lodash debounce. Here is my code,
const SearchBar: React.FC<SearchBarComponentType> = ({onHandleSearch}) => { const theme = useContext(ThemeContext); const styles = getStyles(theme); const debounceFn = useCallback(_debounce(handleDebounceFn, 1000), []); function handleDebounceFn(searchText: string) { onHandleSearch(searchText); } const handleChangeText = (value: string) => { debounceFn(value); }; return (<View style={styles.container}><View style={styles.wrapper}><MaterialIcons name={'search'} color={theme.colors.tabActive} size={26} /><TextInput onChangeText={handleChangeText} style={styles.textInput} autoFocus /></View><View style={styles.border} /></View> );};
This component works well on IOS devices but, on Android, debounce function does not trigger. Does anyone have an idea?