Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-gesture-handler

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-gesture-handler

React component to detect touch gestures

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
164
increased by37.82%
Maintainers
1
Weekly downloads
 
Created
Source

react-gesture-handler

React component to detect touch gestures. It's a react port of hammerjs :)

Install

npm i react-gesture-handler hammerjs --save
npm i @types/hammerjs --save-dev

Events

  • Pan
  • Pinch
  • Press
  • Rotate
  • Swipe
  • Tap

Usage

Example:

import { React } from 'react';
import { Gestures } from 'react-gesture-handler';

const MyComponent = () =>{
    const [eventType, setEventType] = React.useState<string>('');

    const handleGesture = (event: HammerInput) => setEventType(event.type);

    return (
        <Gestures
            recognizers={{
                Pan: {
                options: { direction: Hammer.DIRECTION_ALL, threshold: 0 },
                events: {
                        panleft: handleGesture,
                        panright: handleGesture,
                        panup: handleGesture,
                        pandown: handleGesture
                    }
                }
            }}
        >
            <div>
                <p>Gesture Section</p>
                {eventType && `This is ${eventType}`}
            </div>
        </Gestures>
    );
}

Keywords

FAQs

Package last updated on 31 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc