@likashefqet/react-native-image-zoom
Version:
A performant zoomable image written in Reanimated v2+ 🚀
72 lines • 1.32 kB
JavaScript
import { useGestures } from '../hooks/useGestures';
import { useZoomableLayout } from '../hooks/useZoomableLayout';
import { useZoomableHandle } from '../hooks/useZoomableHandle';
export const useZoomable = ({
minScale,
maxScale,
scale,
doubleTapScale,
maxPanPointers,
isPanEnabled,
isPinchEnabled,
isSingleTapEnabled,
isDoubleTapEnabled,
onInteractionStart,
onInteractionEnd,
onPinchStart,
onPinchEnd,
onPanStart,
onPanEnd,
onSingleTap,
onDoubleTap,
onProgrammaticZoom,
onResetAnimationEnd,
onLayout,
ref
}) => {
const {
width,
height,
center,
onZoomableLayout
} = useZoomableLayout({
onLayout
});
const {
animatedStyle,
gestures,
reset,
zoom,
getInfo
} = useGestures({
width,
height,
center,
minScale,
maxScale,
scale,
doubleTapScale,
maxPanPointers,
isPanEnabled,
isPinchEnabled,
isSingleTapEnabled,
isDoubleTapEnabled,
onInteractionStart,
onInteractionEnd,
onPinchStart,
onPinchEnd,
onPanStart,
onPanEnd,
onSingleTap,
onDoubleTap,
onProgrammaticZoom,
onResetAnimationEnd
});
useZoomableHandle(ref, reset, zoom, getInfo);
return {
animatedStyle,
gestures,
onZoomableLayout
};
};
//# sourceMappingURL=useZoomable.js.map