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

react-swipe-hook

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-swipe-hook - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.1.2](https://github.com/EricLambrecht/react-swipe-hook/compare/v0.1.1...v0.1.2) (2020-03-19)
### Bug Fixes
* Added missing documentation ([02dc862](https://github.com/EricLambrecht/react-swipe-hook/commit/02dc862e2630d55e775922022d7621a3f4ba123a))
### [0.1.1](https://github.com/EricLambrecht/react-swipe-hook/compare/v0.1.0...v0.1.1) (2020-03-19)

@@ -7,0 +14,0 @@

2

package.json
{
"name": "react-swipe-hook",
"version": "0.1.1",
"version": "0.1.2",
"description": "A hook for running callbacks on swipe",

@@ -5,0 +5,0 @@ "main": "dist/useSwipeCallback.js",

# react-swipe-hook
A hook for running callbacks on swipe
## Api
### Params
1. `minimumDistance`
2. `onSwipeUp`
3. `onSwipeRight`
4. `onSwipeDown`
5. `onSwipeLeft`
### Returns
Array of `onTouchStart` and `onTouchEnd` event handlers.
## Example usage
```jsx harmony
const ExampleComp = () => {
const [output, setOutput] = useState('no output')
const [onTouchStart, onTouchEnd] = useSwipeCallback(
40, //the minimum swipe distance
() => setOutput('The user swiped up!'),
() => setOutput('The user swiped right!'),
() => setOutput('The user swiped down!'),
() => setOutput('The user swiped left!')
)
return (
<>
<div
data-testid="swipe-area"
onTouchStart={onTouchStart}
onTouchEnd={onTouchEnd}
/>
<div data-testid="test-output">{output}</div>
</>
)
}
```
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