Socket
Socket
Sign inDemoInstall

react-easy-swipe

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-easy-swipe - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

14

lib/demo.js

@@ -87,15 +87,15 @@ (function (global, factory) {

key: 'onSwipeStart',
value: function onSwipeStart() {
console.log('Start swiping...');
value: function onSwipeStart(event) {
console.log('Start swiping...', event);
}
}, {
key: 'onSwipeMove',
value: function onSwipeMove(position) {
console.log('Moved ' + position.x + ' pixels horizontally');
console.log('Moved ' + position.y + ' pixels vertically');
value: function onSwipeMove(position, event) {
console.log('Moved ' + position.x + ' pixels horizontally', event);
console.log('Moved ' + position.y + ' pixels vertically', event);
}
}, {
key: 'onSwipeEnd',
value: function onSwipeEnd() {
console.log('End swiping...');
value: function onSwipeEnd(event) {
console.log('End swiping...', event);
}

@@ -102,0 +102,0 @@ }, {

@@ -92,15 +92,15 @@ (function (global, factory) {

key: '_handleSwipeStart',
value: function _handleSwipeStart(e) {
var _e$touches$ = e.touches[0];
var pageX = _e$touches$.pageX;
var pageY = _e$touches$.pageY;
value: function _handleSwipeStart(event) {
var _event$touches$ = event.touches[0];
var pageX = _event$touches$.pageX;
var pageY = _event$touches$.pageY;
this.touchStart = { pageX: pageX, pageY: pageY };
this.props.onSwipeStart();
this.props.onSwipeStart(event);
}
}, {
key: '_handleSwipeMove',
value: function _handleSwipeMove(e) {
var deltaX = e.touches[0].pageX - this.touchStart.pageX;
var deltaY = e.touches[0].pageY - this.touchStart.pageY;
value: function _handleSwipeMove(event) {
var deltaX = event.touches[0].pageX - this.touchStart.pageX;
var deltaY = event.touches[0].pageY - this.touchStart.pageY;
this.swiping = true;

@@ -113,6 +113,6 @@

y: deltaY
});
}, event);
if (shouldPreventDefault) {
e.preventDefault();
event.preventDefault();
}

@@ -124,16 +124,16 @@

key: '_handleSwipeEnd',
value: function _handleSwipeEnd() {
value: function _handleSwipeEnd(event) {
if (this.swiping) {
if (this.touchPosition.deltaX < 0) {
this.props.onSwipeLeft(1);
this.props.onSwipeLeft(1, event);
} else if (this.touchPosition.deltaX > 0) {
this.props.onSwipeRight(1);
this.props.onSwipeRight(1, event);
}
if (this.touchPosition.deltaY < 0) {
this.props.onSwipeUp(1);
this.props.onSwipeUp(1, event);
} else if (this.touchPosition.deltaY > 0) {
this.props.onSwipeDown(1);
this.props.onSwipeDown(1, event);
}
}
this.props.onSwipeEnd();
this.props.onSwipeEnd(event);
this.touchStart = null;

@@ -140,0 +140,0 @@ this.swiping = false;

{
"name": "react-easy-swipe",
"version": "0.0.5",
"version": "0.0.6",
"description": "React easy swipe - Easy handler for common touch operations",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

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