react-viewer-mobile
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

react-viewer-mobile

react image viewer for mobile

Introduction

react-viewer for mobile.

Installation

npm install react-viewer-mobile --save

Usage

import * as React from 'react';
import Viewer from 'react-viewer-mobile';
import 'react-viewer-mobile/dist/index.css';
 
class App extends React.Component<any, any> {
  constructor() {
    super();
 
    this.state = {
      visible: false,
    };
  }
 
  render() {
    return (
      <div>
        <button onClick={() => { this.setState({ visible: !this.state.visible }); } }>show</button>
        <Viewer
        visible={this.state.visible}
        images={[src: '', alt: '']}
        />
      </div>
    );
  }
}

Props

props type default description required
visible string false Viewer visible true
images {src: string, alt: string}[] [] image source array true
activeIndex number 0 active image index false
zIndex number 1000 Viewer css z-index false

Gesture support

  • slide
  • pinch

License

MIT

Package Sidebar

Install

npm i react-viewer-mobile

Weekly Downloads

14

Version

0.1.6

License

MIT

Unpacked Size

77.4 kB

Total Files

19

Last publish

Collaborators

  • infeng