JavaScript
Need help with react-point?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.
ReactTraining

Description

Fast touch events for React

204 Stars 22 Forks 58 Commits 3 Opened issues

Services available

Need anything else?

react-point Travis npm package

react-point
gives you fast touch events for your React applications.

A

 normalizes click and click-like touch events (not swipes or drags) into a "point" event. This helps you avoid the 300ms delay for click events on touch interfaces like iOS.

Installation

Using yarn:

$ yarn add react-point

Then, use as you would anything else:

// using ES6 modules
import PointTarget from 'react-point'

// using CommonJS modules var PointTarget = require('react-point')

The UMD build is also available on unpkg:


You can find the library on

window.ReactPoint
.

Usage

Just render a

 component and give it an 
onPoint
function to call whenever the user clicks or taps the element.
import React from 'react'
import PointTarget from 'react-point'

class App extends React.Component { handlePoint = () => { alert('I was clicked or tapped!') }

render() { return ( ) } }

By default, a

 renders a 
 for accessibility. However, you can use the 
children
prop
to make it render something else. For example, to render a
:
import React from 'react'
import PointTarget from 'react-point'

class App extends React.Component { handlePoint = () => { alert('I was clicked or tapped!') }

render() { return (

Click or tap here
) } }

Note: The

onClick
,
onTouchStart
,
onTouchMove
,
onTouchEnd
, and
onTouchCancel
props will be overwritten because
 needs them to do its thing).

About

react-point is developed and maintained by React Training. If you're interested in learning more about what React can do for your company, please get in touch!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.