Skip to content

Latest commit

 

History

History
55 lines (38 loc) · 1.42 KB

README.md

File metadata and controls

55 lines (38 loc) · 1.42 KB

React Double Tap Hook

codecov npm type definitions NPM Downloads npm npm bundle size

React Double Tap Hook

React hook for handling double tap on mobile devices

Main features

  • Detect double tap on mobile devices
  • Adjustable detection threshold
  • Callback for single tap

Installation

yarn add use-double-tap

or

npm install --save use-double-tap

Basic usage

import React from 'react'; // No longer necessary in newer React versions
import { useDoubleTap } from 'use-double-tap';

export const Example = () => {
    const bind = useDoubleTap((event) => {
      // Your action here
      console.log('Double tapped');
    });

    return <button {...bind}>Tap me</button>;
}

Documentation

Full documentation can be found here

Support

If you like my work, consider making a donation through Github Sponsors.

License

MIT © minwork