react-touch-events
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -41,3 +41,3 @@ "use strict"; | ||
handleClick: function handleClick() { | ||
if (!this.usingTouch && this.props.onPoint) { | ||
if (!this.usingTouch && this.props.onTap) { | ||
this.props.onTap(); | ||
@@ -90,16 +90,19 @@ } | ||
if (!this.touchMoved && this.props.onTap) { | ||
this.props.onTap(event); | ||
} else if (!this.swipeOutBounded && this.props.onSwipe) { | ||
if (!this.touchMoved) { | ||
if (this.props.onTap) { | ||
this.props.onTap(event); | ||
} | ||
} else if (!this.swipeOutBounded) { | ||
if (this.props.onSwipe) { | ||
var swipeOutBounded = this.props.swipeTolerance, | ||
direction; | ||
var swipeOutBounded = this.props.swipeTolerance, | ||
direction; | ||
if (Math.abs(this.startX - this.currentX) < swipeOutBounded) { | ||
direction = this.startY > this.currentY ? "top" : "bottom"; | ||
} else { | ||
direction = this.startX > this.currentX ? "left" : "right"; | ||
} | ||
if (Math.abs(this.startX - this.currentX) < swipeOutBounded) { | ||
direction = this.startY > this.currentY ? "top" : "bottom"; | ||
} else { | ||
direction = this.startX > this.currentX ? "left" : "right"; | ||
this.props.onSwipe(direction, event); | ||
} | ||
this.props.onSwipe(direction, event); | ||
} | ||
@@ -106,0 +109,0 @@ }, |
{ | ||
"name": "react-touch-events", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Enable tap / swipe events for react", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,5 +0,13 @@ | ||
# react-touch-events | ||
# react-touch-events [![](https://img.shields.io/npm/v/react-touch-events.svg)](https://www.npmjs.com/package/react-touch-events) | ||
Enable tap / swipe events for react | ||
## Install | ||
Use `npm` | ||
```shell | ||
npm i -S react-touch-events | ||
``` | ||
## Usage | ||
@@ -66,2 +74,26 @@ | ||
} | ||
``` | ||
``` | ||
## LICENSE | ||
MIT License | ||
Copyright (c) 2016 Jerry Bendy | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
7656
97
99