# react-quick-pinch-zoom

> A react component that providing multi-touch gestures for zooming and dragging on any DOM element.

Latest version **5.1.1** (published 2025-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-quick-pinch-zoom
pnpm add react-quick-pinch-zoom
yarn add react-quick-pinch-zoom
bun add react-quick-pinch-zoom
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.1.1 |
| Published | 2025-10-29 |
| First published | 2019-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 81.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 331 |
| Author | David |
| Maintainers | retyui |
| Keywords | drag, gesture, pan, pinch, pinchzoom, react, reactjs, touch, zoom |

## Links

- npm: https://www.npmjs.com/package/react-quick-pinch-zoom
- Repository: https://github.com/retyui/react-quick-pinch-zoom
- Homepage: https://github.com/retyui/react-quick-pinch-zoom#readme
- Issues: https://github.com/retyui/react-quick-pinch-zoom/issues
- npm.io page: https://npm.io/package/react-quick-pinch-zoom

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) >=2.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 5.1.1 (latest) — 2025-10-29
- 4.2.0-beta.0 (next) — 2022-03-18
- 5.1.0 — 2023-11-21
- 5.0.0 — 2023-10-04
- 4.9.0 — 2023-05-22
- 4.8.0 — 2023-05-16
- 4.7.0 — 2023-05-15
- 4.6.0 — 2022-12-08
- 4.5.0 — 2022-08-31
- 4.4.1 — 2022-05-04
- 4.4.0 — 2022-04-29
- 4.3.0 — 2022-04-04
- 4.2.0 — 2022-03-18
- 4.1.0 — 2022-02-17
- 4.0.2 — 2021-01-14
- … 8 more at https://npm.io/package/react-quick-pinch-zoom/versions

## README

# react-quick-pinch-zoom

[![react-quick-pinch-zoom on npm](https://img.shields.io/npm/v/react-quick-pinch-zoom.svg)](https://www.npmjs.com/package/react-quick-pinch-zoom)
[![npm downloads](https://img.shields.io/npm/dm/react-quick-pinch-zoom.svg)](https://www.npmtrends.com/react-quick-pinch-zoom)
[![react-quick-pinch-zoom install size](https://packagephobia.com/badge?p=react-quick-pinch-zoom)](https://packagephobia.com/result?p=react-quick-pinch-zoom)
[![Code quality](https://github.com/retyui/react-quick-pinch-zoom/actions/workflows/nodejs.yml/badge.svg)](https://github.com/retyui/react-quick-pinch-zoom/actions/workflows/nodejs.yml)

A react component that lets you zooming and dragging on any DOM element using multi-touch gestures on mobile devices
and mouse-events\wheel on desktop devices.
Based on this module [manuelstofer/pinchzoom](https://github.com/manuelstofer/pinchzoom)

### Component features:

- 🔮 Simple. Easy to use;
- 🍎 It works with mobile touch gestures and desktop mouse events;
- ⚡ Fast, 60 FPS on mobile devices.

## Links

- [API documentation](docs/api/README.md)
- [Web demos](https://react-quick-pinch-zoom.netlify.app/)

## Install

```bash
npm i --save react-quick-pinch-zoom
```
or
```bash
yarn add react-quick-pinch-zoom
```

## Screenshots

[![](https://github.com/retyui/react-quick-pinch-zoom/blob/master/docs/img/demo.gif?raw=true)](https://media.giphy.com/media/ggJk8Rmysy6TcKJj5K/giphy.mp4)

[Video...](https://media.giphy.com/media/ggJk8Rmysy6TcKJj5K/giphy.mp4)

## Usage

```jsx harmony
import React, { useCallback, useRef } from "react";
import QuickPinchZoom, { make3dTransformValue } from "react-quick-pinch-zoom";

const IMG_URL =
  "https://user-images.githubusercontent.com/4661784/" +
  "56037265-88219f00-5d37-11e9-95ef-9cb24be0190e.png";

export const App = () => {
  const imgRef = useRef();
  const onUpdate = useCallback(({ x, y, scale }) => {
    const { current: img } = imgRef;

    if (img) {
      const value = make3dTransformValue({ x, y, scale });

      img.style.setProperty("transform", value);
    }
  }, []);

  return (
    <QuickPinchZoom onUpdate={onUpdate}>
      <img ref={imgRef} src={IMG_URL} />
    </QuickPinchZoom>
  );
};
```

## License

MIT © [retyui](https://github.com/retyui)

---
_Source: https://npm.io/package/react-quick-pinch-zoom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
