
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
react-fastclick
Advanced tools
Instantly make your desktop / hybrid apps more responsive on touch devices.
React Fastclick automatically adds fastclick touch events to elements with onClick attributes (and those that require special functionality, such as inputs) to prevent the delay that occurs on some touch devices.
Use npm to install react-fastclick
npm install react-fastclick
Include react-fastclick
in your main javascript file before any of your components are created, and you're done.
Now any calls to onClick or elements with special functionality, such as inputs, will have fast touch events added automatically - no need to write any additional listeners.
ES6
import 'react-fastclick';
ES5
require('react-fastclick');
touchend
event. This means that it may have some keys that are unusual for a click event.In order to simulate a click as best as possible, this event is populated with the following keys / values. All positions are taken from the last know touch position.
{
// Simulate left click
button: 0,
type: 'click',
// Additional key to tell the difference between
// a regular click and a flastclick
fastclick: true,
// From touch positions
clientX,
clientY,
pageX,
pageY,
screenX,
screenY
}
On some devices the elements flicker after being touched. This can be prevented by setting the css property -webkit-tap-highlight-color
to transparent.
Either target html, body
(to prevent the flickering on all elements) or target the specific element you don't want to flicker e.g. button
.
html, body {
-webkit-tap-highlight-color: transparent;
}
React Fastclick 2.1.2 has been tested with React 15, and should support older versions listed below.
React Fastclick version 2.x.x has been tested with React 0.12, 0.13 and 0.14, and should work with even older versions.
FAQs
Fast Touch Events for React
The npm package react-fastclick receives a total of 4,335 weekly downloads. As such, react-fastclick popularity was classified as popular.
We found that react-fastclick demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.