React Native Image Zoom
A performant and customizable image zoom component built with Reanimated v2+ and TypeScript. 🌃 🚀
Install / Use
npx skills add likashefqet/react-native-image-zoomInstalls into whichever agent you are using.
README
REACT NATIVE IMAGE ZOOM
A performant and customizable image zoom component
built with Reanimated v2+ and TypeScript. 🌃 🚀
Demo:

What's new
-
Enhanced Pan Gesture Handling: Improved the accuracy and responsiveness of pan gestures, ensuring smoother and more natural interactions when panning images.
-
Refined Single Tap Detection: The single tap gesture functionality has been enhanced to trigger more reliably, providing better consistency and control without interfering with other gestures.
-
Updated Example Integration:
- Added new examples demonstrating how to leverage the scale value for custom animation effects.
- Provided an example showcasing how to integrate the Image Zoom Component with react-native-reanimated-carousel, allowing for animated, zoomable image carousels.
-
TypeScript Support for Animated Props: Expanded TypeScript definitions to include support for animated props, ensuring better type safety and compatibility with Reanimated-based animations.
Features
-
Smooth Zooming Gestures: Ensure smooth and responsive zooming functionality, allowing users to easily zoom in and out of images using intuitive pinch and pan gestures.
-
Reset Zoom and Snap Back: The component automatically resets zoom and snaps back to the initial position when the gesture ends.
-
Double Tap to Zoom: Enable a double tap gesture for users to seamlessly zoom in and out of images. When double tap functionality is enabled, the automatic Reset Zoom and Snap Back feature will be disabled, allowing users to maintain their desired zoom level without automatic resets.
-
Single Tap Functionality: Detect and process single tap gestures to trigger specific actions or functionality as needed within the component
-
Customizable Zoom Settings: Utilize
minScale,maxScale, anddoubleTapScaleprops for precise control over minimum, maximum, and double tap zoom levels, tailoring the zoom behavior to application requirements -
Customizable Functionality: Enable or disable features such as panning (
isPanEnabled), pinching (isPinchEnabled), single tap handling (isSingleTapEnabled), and double tap zoom (isDoubleTapEnabled) based on specific application needs. -
Access Scale Animated Value: Provide a Reanimated shared value for the scale property, allowing you to access and utilize the current zoom scale in your own code.
-
Interactive Callbacks: The component provides interactive callbacks such as
onInteractionStart,onInteractionEnd,onPinchStart,onPinchEnd,onPanStart,onPanEnd,onSingleTap,onDoubleTapandonResetAnimationEndthat allow you to handle image interactions. -
Access Last Values on Reset: The
onResetAnimationEndcallback returns the last zoom and position values when the component resets (zooms out), providing more control and feedback for custom logic. -
Ref Handle: Customize the functionality further by utilizing the exposed
resetandzoommethods. The 'reset' method allows you to programmatically reset the image zoom as a side effect to another user action or event, in addition to the default double tap and pinch functionalities. The 'zoom' method allows you to programmatically zoom in the image to a given point (x, y) at a given scale level. -
Reanimated Compatibility: Compatible with
Reanimated v2&Reanimated v3, providing optimized performance and smoother animations during image manipulations`. -
TypeScript Support: Developed with
TypeScriptto enhance codebase maintainability and ensure type safety, reducing potential errors during development and refactoring processes -
Full React Native Image Props Support: The component supports all React Native Image props, making it easy to integrate with existing code and utilize all the features that React Native Image provides.
-
Zoomable Component: This component makes any child elements zoomable, ensuring they behave like the image zoom component. This is particularly useful when you need to replace the default image component with alternatives like Expo Image (see example) or Fast Image.
Getting Started
To use the ImageZoom component, you first need to install the package via npm or yarn. Run either of the following commands:
npm install @likashefqet/react-native-image-zoom
yarn add @likashefqet/react-native-image-zoom
[!CAUTION]
🚨
Please note that this library is compatible with
Reanimated v2&Reanimated v3and usesGestureHandler v2.If you haven't installed Reanimated and Gesture Handler yet, please follow the installation instructions for Reanimated and Gesture Handler.
[!NOTE]
Usage with modals on Android
On Android RNGH does not work by default because modals are not located under React Native Root view in native hierarchy. To fix that, components need to be wrapped with gestureHandlerRootHOC (it's no-op on iOS and web).
Usage
First, import the ImageZoom component from the @likashefqet/react-native-image-zoom library:
import { ImageZoom } from '@likashefqet/react-native-image-zoom';
To use the ImageZoom component, simply pass the uri prop with the URL of the image you want to zoom:
Basic Example
<ImageZoom uri={imageUri} />
Customized Example
<ImageZoom
ref={ref}
uri={uri}
minScale={minScale}
maxScale={maxScale}
scale={scale}
doubleTapScale={3}
isSingleTapEnabled
isDoubleTapEnabled
onInteractionStart={() => {
console.log('onInteractionStart');
onZoom();
}}
onInteractionEnd={() => console.log('onInteractionEnd')}
onPanStart={() => console.log('onPanStart')}
onPanEnd={() => console.log('onPanEnd')}
onPinchStart={() => console.log('onPinchStart')}
onPinchEnd={() => console.log('onPinchEnd')}
onSingleTap={() => console.log('onSingleTap')}
onDoubleTap={(zoomType) => {
console.log('onDoubleTap', zoomType);
onZoom(zoomType);
}}
onProgrammaticZoom={(zoomType) => {
console.log('onZoom', zoomType);
onZoom(zoomType);
}}
style={styles.image}
onResetAnimationEnd={(finished, values) => {
console.log('onResetAnimationEnd', finished);
console.log('lastScaleValue:', values?.SCALE.lastValue);
onAnimationEnd(finished);
}}
resizeMode="cover"
/>
Zoomable with Expo Image Example
<Zoomable
ref={ref}
minScale={minScale}
maxScale={maxScale}
scale={scale}
doubleTapScale={3}
isSingleTapEnabled
isDoubleTapEnabled
onInteractionStart={() => {
console.log('onInteractionStart');
onZoom();
}}
onInteractionEnd={() => console.log('onInteractionEnd')}
onPanStart={() => console.log('onPanStart')}
onPanEnd={() => console.log('onPanEnd')}
onPinchStart={() => console.log('onPinchStart')}
onPinchEnd={() => console.log('onPinchEnd')}
onSingleTap={() => console.log('onSingleTap')}
onDoubleTap={(zoomType) => {
console.log('onDoubleTap', zoomType);
onZoom(zoomType);
}}
onProgrammaticZoom={(zoomType) => {
console.log('onZoom', zoomType);
onZoom(zoomType);
}}
style={styles.image}
onResetAnimationEnd={(finished, values) => {
console.log('onResetAnimationEnd', finished);
console.log('lastScaleValue:', values?.SCALE.lastValue);
onAnimationEnd(finished);
}}
>
<Image style={styles.image} source={{ uri }} contentFit="cover" />
</Zoomable>
Properties
ImageZoom Props
All React Native Image Props &
| Property | Type | Default | Description |
| ------------------- | -------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| uri | String | '' (empty string) | The image's URI, which can be overridd
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
notion
385.5kNotion CLI/API for pages, Markdown content, data sources, files, comments, search, Workers, and raw API calls.
xurl
385.5kxurl CLI for authenticated X posts, replies, reads/search, DMs, media upload, followers, auth status, or raw v2 API calls.
browser-automation
385.5kUse when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.
