Skip to content

Latest commit

 

History

History
48 lines (39 loc) · 1.05 KB

Touch.mdx

File metadata and controls

48 lines (39 loc) · 1.05 KB
name menu
Touch
2. Feedback Containers

import { Props, Prop, ChildrenProps, ChildrenProp } from '../_ui/PropsTable' import { Touch } from '../../dist/react-powerplug.esm'

Touch

The Touch component is used to known when user is touching some element.

import { Touch } from 'react-powerplug'
<Touch>
  {({ touched, bind }) => (
    <div {...bind}>
      You are {touched ? 'touching' : 'not touching'} this div.
    </div>
  )}
</Touch>

Props

The onChange event of the Touch is called whenever the `touched` state changes. Receive state as function. It can also be `render` prop.

Children Props

True if is touching the binded element There are the bind event functions.
Contains `onTouchStart` and `onTouchEnd` event listeners.