Socket
Socket
Sign inDemoInstall

@quintenkasteel/useswipe

Package Overview
Dependencies
6
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @quintenkasteel/useswipe

A simple to use library that provides useSwipe hook for React that enables swipe gestures for touch screens.


Version published
Weekly downloads
211
decreased by-8.66%
Maintainers
1
Install size
9.14 kB
Created
Weekly downloads
 

Readme

Source

Getting Started with UseSwipe

A simple to use library that provides useSwipe hook for React that enables swipe gestures for touch screens.

Usage

import useSwipe from '@quintenkasteel/useswipe'

example without element const swipe = useSwipe({})

example with element const swipe = useSwipe(".header", true)

Props

element: String

DOM element where the swipe is enabled. default value is body.

preventDefault: Bool

Prevent all default events when moving. for example scrolling.

onStart: () => {}

function that will be fired on start of moving. (not yet in)

onMove: () => {}

function that will be fired on every move. (not yet in)

onEnd: () => {}

function that will be fired on end of moving. (not yet in)

onCancel: () => {}

function that will be fired on cancel of moving. (not yet in)

Return Values

direction: String

Get the current swiping direction in uppercase.
one of: "RIGHT" | "LEFT" | "DOWN" | "UP"

distance: Number

Get the swiped amount in pixels.

startX: Number

Get the starting X position in pixels.

startY: Number

Get the starting Y position in pixels.

endX: Number

Get the end X position in pixels.

endY: Number

Get the end Y position in pixels.

startTime: Date

Get the date at the beginning of the swipe.

elapsedTime: Number

Get the duration of the swipe in seconds.

speed: Number

Get the speed of the swipe

isSwiping: Bool 

True when swiping.

Keywords

FAQs

Last updated on 30 Oct 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc