📸 React Native Zoomable Image Viewer
A lightweight React Native component that allows pinch-to-zoom on images without panning — just like product image zoom in e-commerce apps.
✨ Features
- 🔍 Pinch to zoom (no pan)
- 🎨 Customizable styles
- 📏 Minimum scale:
1.0
- 🖼️ Resize modes:
'contain'
, 'cover'
, 'stretch'
, etc.
📦 Installation
npm install react-native-zoomable-image-viewer
🚀 Usage
🔹 Basic Example
import { ImageZoomView } from 'react-native-image-zoom-view';
<ImageZoomView
imageUrl="https://yourdomain.com/image.jpg"
/>
🔹 Set Resize Mode
import { ImageZoomView } from 'react-native-image-zoom-view';
<ImageZoomView
imageUrl="https://yourdomain.com/image.jpg"
resizeMode="contain" // or "cover", "stretch", etc.
/>
🔹 With Custom Styles
import { ImageZoomView } from 'react-native-image-zoom-view';
<ImageZoomView
imageUrl="https://yourdomain.com/image.jpg"
containerStyle={{ backgroundColor: '#fff' }}
imageContainerStyle={{ borderRadius: 10 }}
imageStyle={{ borderWidth: 2, borderColor: '#ccc' }}
/>
🔹 Fullscreen Image Zoom
import { ImageZoomView } from 'react-native-image-zoom-view';
import { Dimensions } from 'react-native';
const { width, height } = Dimensions.get('window');
<ImageZoomView
imageUrl="https://yourdomain.com/fullscreen.jpg"
imageContainerStyle={{ width, height }}
/>
🧩 Props
Prop | Type | Default | Description |
---|
imageUrl | string | required | URL of the image to display |
resizeMode | ImageResizeMode | 'contain' | Image resize mode (contain , etc.) |
containerStyle | ViewStyle | undefined | Style for the outermost container |
imageContainerStyle | ViewStyle | undefined | Style for the image wrapper |
imageStyle | ImageStyle | undefined | Style for the image itself |
🛡️ Requirements
react-native >= 0.60
react >= 16.8