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

react-use-gestures

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-gestures - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

14

index.js

@@ -6,5 +6,8 @@ export function useGestures({

}) {
let lastMove;
function handleTouchStart(e) {
window.addEventListener('touchmove', handleTouchMove);
window.addEventListener('touchend', handleTouchEnd);
window.addEventListener('touchcancel', handleTouchEnd);
handleTake(e.touches[0]);

@@ -20,3 +23,10 @@ }

window.removeEventListener('touchend', handleTouchEnd);
handleRelease(e.touches[0]);
window.removeEventListener('touchcancel', handleTouchEnd);
// weird chrome bug where touchend event is called without the touch data
// so we patch with the last touch coordinate we have
if (e.touches.length === 0) {
handleRelease(lastMove);
} else {
handleRelease(e.touches[0]);
}
}

@@ -46,2 +56,3 @@

initialY = pageY;
lastMove = { pageX, pageY };
onTake({ pageX, initialX, pageY, initialY });

@@ -52,2 +63,3 @@ }

const deltaY = pageY - initialY;
lastMove = { pageX, pageY };
onMove({ pageX, initialX, deltaX, pageY, initialY, deltaY });

@@ -54,0 +66,0 @@ }

2

package.json
{
"name": "react-use-gestures",
"version": "0.1.0",
"version": "0.1.1",
"description": "An utility function to use with React hooks that plays well with https://github.com/drcmda/react-spring 's useSpring()",

@@ -5,0 +5,0 @@ "main": "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