ReactJS / HammerJS integration. Support touch events in your React app.
Installations
npm install rc-hammerjs
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.16.0
NPM Version
6.13.1
Score
81.2
Supply Chain
98.5
Quality
77.1
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
react-component
Download Statistics
Total Downloads
51,063,523
Last Day
3,515
Last Week
57,676
Last Month
328,191
Last Year
4,483,012
GitHub Statistics
11 Stars
138 Commits
4 Forks
4 Watching
12 Branches
24 Contributors
Bundle Size
39.93 kB
Minified
13.77 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.6.10
Package Id
rc-hammerjs@0.6.10
Size
4.34 kB
NPM Version
6.13.1
Node Version
10.16.0
Publised On
26 May 2020
Total Downloads
Cumulative downloads
Total Downloads
51,063,523
Last day
-78.6%
3,515
Compared to previous day
Last week
-27.7%
57,676
Compared to previous week
Last month
-13.5%
328,191
Compared to previous month
Last year
-8.9%
4,483,012
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
rc-hammerjs
Fork from React-HammerJS.
ReactJS / HammerJS integration. Support touch events in your React app.
If you're looking for native tap event handling in ReactJS, check out my react-tappable package.
Installation
The easiest way to use React-HammerJS is to install it from NPM and include it in your own React build process (using Browserify, etc).
You can also use the standalone build by including dist/hammer.js
in your page. If you use this, make sure you have already included React, and it is available as a global variable.
npm install rc-hammerjs --save
Usage
React-HammerJS wraps a React component, binding Hammer events to it so it can fire the handlers specified.
Properties
The following events are supported:
onTap
onDoubleTap
onPan
onPanCancel
onPanEnd
onPanStart
onPinch
onPinchCancel
onPinchEnd
onPinchIn
onPinchOut
onPinchStart
onPress
onPressUp
onRotate
onRotateCancel
onRotateEnd
onRotateMove
onRotateStart
onSwipe
You can also provide an action
property which is like the onTap
event handler but will also be fired onPress
.
If you provide the prop direction
the pan
and swipe
events will support Hammer.DIRECTION_(NONE/LEFT/RIGHT/UP/DOWN/HORIZONTAL/VERTICAL/ALL)
.
The options
property can be used to configure the Hammer manager. These properties will be merged with the default ones.
Example
var Hammer = require('rc-hammerjs');
// Default options
<Hammer onTap={handleTap} onSwipe={handleSwipe}><div>Tap Me</div></Hammer>
// Custom options
var options = {
touchAction:'compute',
recognizers: {
tap: {
time: 600,
threshold: 100
}
}
};
<Hammer onTap={handleTap} options={options}><div>Tap Me</div></Hammer>
Disabled Events
As a default, the pinch
and rotate
events are disabled in hammer.js, as they would make actions on an element "blocking". You may enable these events using the options object which is a attribute on the react <Hammer>
element.
For example, to activate the pinch
event on a canvas
element:
<Hammer
onPinch={handlePinch}
options={{
recognizers: {
pinch: { enable: true }
}
}}>
<canvas></canvas>
</Hammer>
Disabled events are detailed in the hammer.js api documentation:
License
MIT Licensed. Copyright (c) Jed Watson 2016.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 5/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 8 are checked with a SAST tool
Score
3.2
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More