use-pinch-ref
v0.1.3
Published
a react hook to support pinch element
Downloads
13
Readme
usePinch hook
fork from pinch-zoom but use React
install
npm install use-pinch-ref
yarn add use-pinch-ref
use
import usePinch from 'use-pinch-ref';
const App = () => {
const { pinchRef, coverRef } = usePinch<HTMLDivElement, HTMLDivElement>();
return (
<div ref={coverRef}>
<div ref={pinchRef}>34</div>
</div>
);
};
api
const {
pinchRef: RefObject;
coverRef: RefObject;
scaleState: boolean;
} = usePinch({
maxScale?: number;
minScale?: number;
startScale?: () => void;
endScale?: () => void;
enableWheel?: boolean;
enableTouch?: boolean;
forWardPinchRef?: RefObject;
forWardCoverRef?: RefObject;
deps?: any[];
})