Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@luu-truong/react-native-image-viewer

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luu-truong/react-native-image-viewer

Lightweight image viewer for React Native

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Native Image Viewer

  • Double tap to zoom image
  • Pinch to zoom image
  • Swipe down to close
  • Caption and summaries

Installation

Yarn:

yarn add @luu-truong/react-native-image-viewer react-native-gesture-handler

NPM:

npm install @luu-truong/react-native-image-viewer react-native-gesture-handler

To complete installation you must following this guide to setup react-native-gesture-handler

Usage:


import ImageViewer from '@luu-truong/react-native-image-viewer';

function Example() {
  const [visible, setVisible] = React.useState(false);
  
  const images = [
    {
      source: {
        uri: 'https://...',
        headers: {
          'X-Custom-Header': 'foo',
        },
        width: 1200,
        height: 600
      },
      title: 'blah blah'
    },
    {
      source: require('image.png'),
    }
  ];
  
  return (
    <>
      <ImageViewer images={images} visible={visible} onClose={() => setVisible(false)} imageProps={{
        initialWidth: 200,
        initialHeight: 200,
        renderFooter: (title?: string) => (<Text>{title}</Text>)
      }} />
    </>
  );
}

Documentation

Image Viewer Component Props:

NameTypeRequiredDescription
debugbooleannoPrint debug message. Default: false
imagePropsobjectnoProps passed to Image component. See Image Component Props
visiblebooleanyes
imagesArrayyes
initialIndexnumbernoShow image index at initialize
onClose() => voidyesCallback when close image viewer
animationTypestringno

Image Component Props:

NameTypeRequiredDescription
initialWidthnumbernoDefault: 200
initialHeightnumbernoDefault: 200
renderFooter(title?: string) => JSX.Elementnullno
debugbooleannoDefault: false

Examples

If you want to play with the API but don't feel like to trying it on a real device. Clone the repo and go to demo folder and run:

yarn install

If you want to try IOS, run pod install in the ios folder.

Run yarn start to start metro server.

Run yarn ios to playing with iOS simulator Run yarn android to playing with Android simulator

React native support

versionreact-native version
1.x.x0.64.0+

Keywords

FAQs

Package last updated on 28 Jan 2022

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc