1.0.1 • Published 4 years ago

reliable-touch-element v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

reliable-touch-element

An element providing a reliable onTouch callback. The touch is reliable because the component need to have a touchstart and a touchend event, without any touchmove events, in order to trigger the onTouch callback.

For example, can be convenient when you have a scrollable list with touchable elements inside, in order to show/display, or navigate to, the element touched.

Usage

import { ReliableTouchElement } from "reliable-touch-element"
// or
import ReliableTouchElement from "reliable-touch-element"
// but prefer the first 😉

<ReliableTouchElement onTouch={handleTouch}>
  Hello World!
</ReliableTouchElement>

Props

PropTypeRequiredDescription
onTouchfunctionyesCallback triggered when a real touch is detected
childrenanynoChildren of the element (wrapped in a div).
any div propsThe component accepts any prop a div element can.