1.3.2 • Published 9 months ago

react-native-gallery-preview v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

react-native-gallery-preview

GalleryPreview is a flexible modal component for easy gallery previews with full gesture support. Using Reanimated and React Native Gesture Handler, it gives a smooth and simple user experience for both iOS and Android.

Features

  • Smooth Gesture Interactions and Animations: Experience fluid and responsive animations and gestures for a delightful user interface.
  • 🔍 Double Tap and Pinch to zoom: Users can effortlessly zoom in and out of images with simple double-tap and pinch gestures
  • 👆 Pull down to close: Intuitive pull-down gesture to close the gallery preview, making navigation seamless.
  • ↔️ RTL Support
  • 📱 Supports both iOS and Android: Fully compatible with both iOS and Android devices, ensuring a consistent experience across platforms.
  • 📱 Compatible with Expo

    Get started

    Before you can use GalleryPreview, you need to set up react-native-reanimated and react-native-gesture-handler. Follow the links below for detailed installation guides:

  • Setting up Reanimated

  • Setting up React Native Gesture Handler

    Once the dependencies are installed, you can add react-native-gallery-preview to your project:

    npm install react-native-gallery-preview
    # or
    yarn add react-native-gallery-preview

Example

import React, { useState } from 'react';
import { Button, View } from 'react-native';
import GalleryPreview from 'react-native-gallery-preview';

export const App = () => {
  const [isVisible, setIsVisible] = useState(false);

  const images = [
    { uri: 'https://example.com/image1.jpg' },
    { uri: 'https://example.com/image2.jpg' },
    // Add more images here
  ];

  return (
    <View>
      <Button title="Open Gallery Preview" onPress={() => setIsVisible(true)} />
      <GalleryPreview
        isVisible={isVisible}
        onRequestClose={() => setIsVisible(false)}
        images={images}
      />
    </View>
  );
};

Props

Prop NameTypeDescriptionDefault
isVisiblebooleanControls the visibility of the image viewer modal.-
onRequestClose() => voidFunction to close the image viewer modal.-
imagesImageItemURI[]Array of image URIs to be displayed.-
initialIndex?numberThe initial index of the image to be displayed when the viewer is opened.0
gap?numberThe gap between images in the viewer.24
simultaneousRenderedImages?numberThe number of images rendered simultaneously for optimization.6
OverlayComponent?(props: GalleryOverlayProps) => React.ReactNodeOptional component to be rendered above the image viewer.-
ImageComponent?(props: GalleryImageComponentProps) => React.JSX.ElementOptional custom component to render each image.-
springConfig?SpringConfigSpring configuration for animations.{ damping: 1000, mass: 1, stiffness: 250, restDisplacementThreshold: 0.02, restSpeedThreshold: 4 }
doubleTabEnabled?booleanEnable or disable double-tap to zoom functionality.true
pinchEnabled?booleanEnable or disable pinch to zoom functionality.true
swipeToCloseEnabled?booleanEnable or disable swipe to close functionality.true
backgroundColor?stringThe background color of the modal, DefaultHeader, and StatusBar.#000
headerTextColor?stringColor of text in the header.#fff
1.3.2

9 months ago

1.2.0

10 months ago

1.2.3

10 months ago

1.1.4

11 months ago

1.3.1

9 months ago

1.2.2

10 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.1.3

12 months ago

1.1.2

12 months ago

1.1.1

12 months ago

1.1.0

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago