Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native TextInput Not trigger lodash debounce on android devices. IOS working

$
0
0

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?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>