1.5.8 • Published 6 years ago

ImageViewer v1.5.8

Weekly downloads
24
License
MIT
Repository
github
Last release
6 years ago

download npm-version license

Overview

A pure JavaScript image viewer component for react-native apps with pan, pinch.etc, supporting both iOS and Android.

React Native required 0.33+

Show Cases

On IOS:

viewer-ios

On Android:

viewer-android

Installation

First, install react-native-image-viewer from npm:

npm install ImageViewer --save-dev

Or in package.json:

"dependencies": {
  "ImageViewer": "version"
}

Then use it:

// ES6 mudule
import ImageViewer from 'ImageViewer';

Usage

There are some code from example/src/index.js:

let imgsArr = [
    'http://scimg.jb51.net/allimg/160815/103-160Q509544OC.jpg',
    'http://img.sc115.com/uploads1/sc/jpgs/1508/apic22412_sc115.com.jpg',
    'http://h.hiphotos.baidu.com/zhidao/pic/item/0df431adcbef7609bca7d58a2adda3cc7cd99e73.jpg',
    'http://facebook.github.io/react/img/logo_og.png',
    'http://scimg.jb51.net/allimg/160815/103-160Q509544OC.jpg'
];

closeViewer(){
    this.setState({
        shown:false,
        curIndex:0
    })
}

<ImageViewer shown={this.state.shown}
             imageUrls={imgsArr}
             onClose={this.closeViewer.bind(this)}
             index={this.state.curIndex}>
</ImageViewer>

Configuration

OpthionDescriptionisRequired
shownwhether the ImageViewer is showrequired
imageUrlsit's a array of images' urlrequired
onClosehidden the ImageViewer when click on ImageViewerrequired
indexthe index of image url(in imageUrls) when open the ImageViewerrequired
failedUrlthe url for image preview loaded failurenot required

Feature

  • pan to image toggling
  • double click for image zooming
  • pinch for zoom image
  • animation for image showing

License

MIT

1.5.8

6 years ago

1.5.7

7 years ago

1.5.6

7 years ago

1.5.5

7 years ago

1.4.5

7 years ago

1.3.5

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

0.5.3

7 years ago