Skip to content

Instantly share code, notes, and snippets.

@estevaolucas
Created May 31, 2018 18:18
Show Gist options
  • Save estevaolucas/cd99f1cd59894cd2cf1773ac6307982f to your computer and use it in GitHub Desktop.
Save estevaolucas/cd99f1cd59894cd2cf1773ac6307982f to your computer and use it in GitHub Desktop.
// @flow
import React from 'react';
import { TouchableOpacity } from 'react-native';
import debounce from 'lodash.debounce';
const TouchableDebounce = ({
children,
onPress,
...props
}: TouchableOpacity): TouchableOpacity => (
<TouchableOpacity onPress={ debounce(onPress, 500) } { ...props }>
{children}
</TouchableOpacity>
);
export default TouchableDebounce;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment