prevent double tap in react native
import debounce from 'lodash.debounce'; // 4.0.8
const withPreventDoubleClick = (WrappedComponent) => {
class PreventDoubleClick extends React.PureComponent {
debouncedOnPress = () => {
this.props.onPress && this.props.onPress();
}
onPress = debounce(this.debouncedOnPress, 300, { leading: true, trailing: false });
render() {
return <WrappedComponent {...this.props} onPress={this.onPress} />;
}
}
PreventDoubleClick.displayName = `withPreventDoubleClick(${WrappedComponent.displayName ||WrappedComponent.name})`
return PreventDoubleClick;
}
Also in JavaScript:
- intval js
- javascript preencher array com 0
- vuejs remove object from array
- javascript redirect button
- js add animation to element
- javascript for of index
- scrollbar position
- json in listview flutter
- how to clear cache of gradle
- what is es11
- html shortcuts in jsx
- vuejs 3 app.mount
- queryselector by class javascript
- firebase contains query realtime
- passport middleware check if authenticated
- how to restablished closed rxjs websocket
- add firebase javascript
- how to delete everything from a folder in js
- ORDS GET json case sensitive data keys
- hot to start cypress
- regular expression characters
- can we add jquery in chrome extension js code
- javascript get duplicates in array
- how to draw a horizontal line in javascript