Socket
Book a DemoInstallSign in
Socket

react-native-gesture-image-viewer

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-gesture-image-viewer

๐Ÿ–ผ๏ธ React Native Image Viewer - Reanimated-powered image gestures with full control

latest
Source
npmnpm
Version
1.9.0
Version published
Weekly downloads
581
-15.31%
Maintainers
1
Weekly downloads
ย 
Created
Source

React Native Gesture Image Viewer

English | ํ•œ๊ตญ์–ด

React Native Gesture Image Viewer logo

Overview

Have you ever struggled with implementing complex gesture handling and animations when building image galleries or content viewers in React Native?

Existing libraries often have limited customization options or performance issues. react-native-gesture-image-viewer is a high-performance universal gesture viewer library built on React Native Reanimated and Gesture Handler, providing complete customization and intuitive gesture support for not only images but also videos, custom components, and any other content.

Gesture and zoom demo

Key Features

  • ๐ŸคŒ Complete Gesture Support - Pinch zoom, double-tap zoom, swipe navigation, pan when zoomed-in, and vertical drag to dismiss
  • ๐ŸŽ๏ธ High-Performance Animations - Smooth and responsive animations at 60fps and beyond, powered by React Native Reanimated
  • ๐ŸŽจ Full Customization - Total control over components, styles, and gesture behavior
  • ๐ŸŽ›๏ธ External Control API - Trigger actions programmatically from buttons or other UI components
  • ๐Ÿงฉ Multi-Instance Management - Manage multiple viewers independently using unique IDs
  • ๐Ÿงฌ Flexible Integration - Use with Modal, React Native Modal, ScrollView, FlatList, FlashList, Expo Image, FastImage, and more
  • ๐Ÿง  Full TypeScript Support - Great developer experience with type inference and safety
  • ๐ŸŒ Cross-Platform - Runs on iOS, Android, and Web with Expo Go and New Architecture compatibility
  • ๐Ÿช„ Easy-to-Use API - Simple and intuitive API that requires minimal setup

Quick Start

๐Ÿ“š Documentation

Full documentation is available at: https://react-native-gesture-image-viewer.pages.dev

Examples & Demo

Basic Usage

react-native-gesture-image-viewer is a library focused purely on gesture interactions for complete customization.

import { useCallback, useState } from 'react';
import { ScrollView, Image, Modal, View, Text, Button, Pressable } from 'react-native';
import {
  GestureViewer,
  GestureTrigger,
  useGestureViewerController,
  useGestureViewerEvent,
} from 'react-native-gesture-image-viewer';

function App() {
  const images = [...];
  const [visible, setVisible] = useState(false);
  const [selectedIndex, setSelectedIndex] = useState(0);

  const { goToIndex, goToPrevious, goToNext, currentIndex, totalCount } = useGestureViewerController();

  const openModal = (index: number) => {
    setSelectedIndex(index);
    setVisible(true);
  };

  const renderImage = useCallback((imageUrl: string) => {
    return <Image source={{ uri: imageUrl }} style={{ width: '100%', height: '100%' }} resizeMode="contain" />;
  }, []);

  useGestureViewerEvent('zoomChange', (data) => {
    console.log(`Zoom changed from ${data.previousScale} to ${data.scale}`);
  });

  return (
    <View>
      {images.map((uri, index) => (
        <GestureTrigger key={uri} onPress={() => openModal(index)}>
          <Pressable>
            <Image source={{ uri }} />
          </Pressable>
        </GestureTrigger>
      ))}
      <Modal transparent visible={visible}>
        <GestureViewer
          data={images}
          initialIndex={selectedIndex}
          renderItem={renderImage}
          ListComponent={ScrollView}
          onDismiss={() => setVisible(false)}
        />
        <View>
          <Button title="Prev" onPress={goToPrevious} />
          <Button title="Jump to index 2" onPress={() => goToIndex(2)} />
          <Button title="Next" onPress={goToNext} />
          <Text>{`${currentIndex + 1} / ${totalCount}`}</Text>
        </View>
      </Modal>
    </View>
  );
}

Contributing

For details on how to contribute to the project and set up the development environment, please refer to the Contributing Guide.

License

MIT

Keywords

react-native

FAQs

Package last updated on 18 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts