Code Monkey home page Code Monkey logo

react-fastclick's Introduction

Build Status npm version react-fastclick

Wrapper <span/> that implements the FastClick logic in its touch events, triggering appropriate click and focus events on its children if it detects a 'tap'.

Install

npm install --save-dev react-fastclick-alt

Component Usage

Wrap your component in an instance of this component, and it should respond to short taps with immediate click events.

import React from 'react';
import FastClick from 'react-fastclick-alt';
import ReactDOM from 'react-dom';
ReactDOM.render(<FastClick><MyApp/></FastClick>, document.getElementById('app'));

Note this is safe to do even if child components also render react-fastclick-alt because a touchend event that triggers a click will not be propagated (i.e. event.stopPropagation() is called when a tap is detected)

Properties

There are two optional props to this component:

threshold (Number)

How far a touch can move before it can no longer be converted to a click, in px. Defaults to 15px.

timeThreshold (Number)

How long a tap can be held before it can no longer be converted to a click, in milliseconds. Defaults to 125ms.

react-fastclick's People

Contributors

moodysalem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-fastclick's Issues

Does React-Fastclick needs Fastclick ?

Hello;
I don't get the what react-fastclick does. Thinking that it remove the 300ms delay from click event; I would like to know if for using react-fastclick I need first fastclick and what are the browser that it supports?

Unknown props warning

React warns about unknown props passed:

Warning: Unknown props `threshold`, `timeThreshold` on <span> tag. Remove these props from the element.

in this case here #L212, where props are assigned to span.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.