Gathering detailed insights and metrics for @use-gesture/react
Gathering detailed insights and metrics for @use-gesture/react
Gathering detailed insights and metrics for @use-gesture/react
Gathering detailed insights and metrics for @use-gesture/react
react-native-gesture-handler
Declarative API exposing native platform touch and gesture system to React Native
@chakra-ui/react-use-pan-event
React hook to track pan events
@use-gesture/vanilla
Vanilla target for @use-gesture
react-native-draggable-flatlist
A drag-and-drop-enabled FlatList component for React Native
👇Bread n butter utility for component-tied mouse/touch gestures in React and Vanilla Javascript.
npm install @use-gesture/react
91
Supply Chain
98.4
Quality
77
Maintenance
100
Vulnerability
100
License
@use-gesture/vanilla@10.3.1
Published on 21 Mar 2024
@use-gesture/react@10.3.1
Published on 21 Mar 2024
@use-gesture/core@10.3.1
Published on 21 Mar 2024
@use-gesture/vanilla@10.3.0
Published on 16 Sept 2023
@use-gesture/react@10.3.0
Published on 16 Sept 2023
@use-gesture/core@10.3.0
Published on 16 Sept 2023
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
9,089 Stars
1,360 Commits
309 Forks
43 Watching
11 Branches
93 Contributors
Updated on 28 Nov 2024
Minified
Minified + Gzipped
TypeScript (98.85%)
JavaScript (1.11%)
Shell (0.04%)
Cumulative downloads
Total Downloads
Last day
0.2%
129,723
Compared to previous day
Last week
3.8%
692,518
Compared to previous week
Last month
5%
2,912,402
Compared to previous month
Last year
68.9%
29,016,846
Compared to previous year
1
1
@use-gesture is a library that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.
You can use it stand-alone, but to make the most of it you should combine it with an animation library like react-spring, though you can most certainly use any other.
The demos are real click them!
1#Yarn 2yarn add @use-gesture/react 3 4#NPM 5npm install @use-gesture/react
1#Yarn 2yarn add @use-gesture/vanilla 3 4#NPM 5npm install @use-gesture/vanilla
1import { useSpring, animated } from '@react-spring/web' 2import { useDrag } from '@use-gesture/react' 3 4function Example() { 5 const [{ x, y }, api] = useSpring(() => ({ x: 0, y: 0 })) 6 7 // Set the drag hook and define component movement based on gesture data. 8 const bind = useDrag(({ down, movement: [mx, my] }) => { 9 api.start({ x: down ? mx : 0, y: down ? my : 0 }) 10 }) 11 12 // Bind it to a component. 13 return <animated.div {...bind()} style={{ x, y, touchAction: 'none' }} /> 14}
1<!-- index.html --> 2<div id="drag" />
1// script.js
2const el = document.getElementById('drag')
3const gesture = new DragGesture(el, ({ active, movement: [mx, my] }) => {
4 setActive(active)
5 anime({
6 targets: el,
7 translateX: active ? mx : 0,
8 translateY: active ? my : 0,
9 duration: active ? 0 : 1000
10 })
11})
12
13// when you want to remove the listener
14gesture.destroy()
The example above makes a div
draggable so that it follows your mouse on drag, and returns to its initial position on release.
Make sure you always set touchAction
on a draggable element to prevent glitches with the browser native scrolling on touch devices.
@use-gesture/react exports several hooks that can handle different gestures:
Hook | Description |
---|---|
useDrag | Handles the drag gesture |
useMove | Handles mouse move events |
useHover | Handles mouse enter and mouse leave events |
useScroll | Handles scroll events |
useWheel | Handles wheel events |
usePinch | Handles the pinch gesture |
useGesture | Handles multiple gestures in one hook |
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/24 approved changesets -- score normalized to 1
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
49 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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