GithubHelp home page GithubHelp logo

iamham / react-swipe-events Goto Github PK

View Code? Open in Web Editor NEW
18.0 4.0 6.0 61 KB

Swipe (Touch) event for react component as npm package

Home Page: https://www.npmjs.com/package/react-swipe-events

JavaScript 100.00%
swipe-gestures events touch reactjs

react-swipe-events's Introduction

ReactSwipeEvents: React Swipe (Touch Event) enabler

Simple component to enable Swipe event for react component https://www.npmjs.com/package/react-swipe-events

This package is based on React-NPM-Boilerplate (https://github.com/juliancwirko/react-npm-boilerplate)

How to use ReactSwipeEvents

Install first

  • npm install --save react-swipe-events

Import this component

  • import ReactSwipeEvents from 'reactSwipeEvents'

Cover your component with ReactSwipeEvents

Props

Here is a list of accepted Props

  • threshold: number - If delta between start and end of swipe below threshold no function will be called out
  • onSwiping: func - Call out this function when user swiping (onTouchMove)
  • onSwiped: func - Call out this function when user swiped (onTouchEnd)
  • onSwipedUp: func - Call out this function when user swiped up
  • onSwipedDown: func - Call out this function when user swiped down
  • onSwipedLeft: func - Call out this function when user swiped left
  • onSwipedRight: func - Call out this function when user swiped right

Returned parameter

  • onSwipedLeft, onSwipedRight will return (e, originalX, endX)
  • onSwipedTop, onSwipedDown will return (e, originalY, endY)
  • onSwiping will return (e, originalX, originalY, currentX, currentY, deltaX, deltaY)
  • onSwiped will return (e, originalX, originalY, endX, endY, deltaX, deltaY)

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.