# react-with-gesture
**Repository Path**: mirrors_fkhadra/react-with-gesture
## Basic Information
- **Project Name**: react-with-gesture
- **Description**: 👇Little helper for component-tied mouse/touch gestures
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-08
- **Last Updated**: 2026-01-31
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
npm install react-with-gesture
Wraps a component into a div that receives MouseDown and TouchStart events, then captures movement until release.
Demo: https://codesandbox.io/embed/jzn14k0ppy
* `down`, true on mouse-down or finger-touch
* `x/y`, screen coordinates
* `xDelta/yDelta`, coordinates relative to initial coordinates, great for sliding/dragging gestures
* `xInitial/yInitial`, coordinates of the first click/touch
```jsx
import { withGesture } from 'react-with-gesture'
@withGesture
class Something extends React.Component {
render() {
const { down, x, y, xDelta, yDelta, xInitial, yInitial } = this.props
return Drag me! coordinates: {x}, {y}
}
}
```
or ...
```jsx
withGesture(
({ down, x, y, xDelta, yDelta, xInitial, yInitial }) =>
Drag me! coordinates: {x}, {y}
)
```
or ...
```jsx
import { Gesture } from 'react-with-gesture'
class Something extends React.Component {
render() {
return (
{({ down, x, y, xDelta, yDelta, xInitial, yInitial }) =>
Drag me! coordinates: {x}, {y}
}
)
}
}
```