Socket
Socket
Sign inDemoInstall

react-native-image-viewing

Package Overview
Dependencies
513
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-image-viewing

React Native modal component for viewing images as a sliding gallery


Version published
Maintainers
2
Weekly downloads
23,049
decreased by-11.38%

Weekly downloads

Readme

Source

react-native-image-viewing

React Native modal component for viewing images as a sliding gallery.

npm version styled with prettier

  • 🔥Pinch zoom for both iOS and Android
  • 🔥Double tap to zoom for both iOS and Android
  • 🔥Supports swipe-to-close animation
  • 🔥Custom header and footer components
  • 🔥Uses VirtualizedList to optimize image loading and rendering

Try with Expo: https://expo.io/@antonkalinin/react-native-image-viewing

Installation

yarn add react-native-image-viewing

or

npm install --save react-native-image-viewing

Usage

import ImageView from "react-native-image-viewing";

const images = [
  {
    uri: "https://images.unsplash.com/photo-1571501679680-de32f1e7aad4",
  },
  {
    uri: "https://images.unsplash.com/photo-1573273787173-0eb81a833b34",
  },
  {
    uri: "https://images.unsplash.com/photo-1569569970363-df7b6160d111",
  },
];

const [visible, setIsVisible] = useState(false);

<ImageView
  images={images}
  imageIndex={0}
  visible={visible}
  onRequestClose={() => setIsVisible(false)}
/>
See Example

Props

Prop nameDescriptionTypeRequired
imagesArray of images to displayImageSource[]true
keyExtractorUniqely identifying each image(imageSrc: ImageSource, index: number) => stringfalse
imageIndexCurrent index of image to displaynumbertrue
visibleIs modal shown or notbooleantrue
onRequestCloseFunction called to close the modalfunctiontrue
onImageIndexChangeFunction called when image index has been changedfunctionfalse
onLongPressFunction called when image long pressedfunction (event: GestureResponderEvent, image: ImageSource)false
delayLongPressDelay in ms, before onLongPress is called: default 800numberfalse
animationTypeAnimation modal presented with: default fadenone, fade, slidefalse
presentationStyleModal presentation style: default: fullScreen Android: Use overFullScreen to hide StatusBarfullScreen, pageSheet, formSheet, overFullScreenfalse
backgroundColorBackground color of the modal in HEX (#000000EE)stringfalse
swipeToCloseEnabledClose modal with swipe up or down: default truebooleanfalse
doubleTapToZoomEnabledZoom image by double tap on it: default truebooleanfalse
HeaderComponentHeader component, gets current imageIndex as a propcomponent, functionfalse
FooterComponentFooter component, gets current imageIndex as a propcomponent, functionfalse
  • type ImageSource = ImageURISource | ImageRequireSource

Contributing

To start contributing clone this repo and then run inside react-native-image-viewing folder:

yarn

Then go inside example folder and run:

yarn & yarn start

This will start packager for expo so you can change /src/ImageViewing and see changes in expo example app.

License

MIT

Keywords

FAQs

Last updated on 18 Apr 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc