0.1.0 • Published 6 years ago

react-imgviewer v0.1.0

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

react-imgviewer

NPM version

react react-imgviewer.

Introduction

Installation

npm install react-imgviewer --save

Usage

import React, { Component } from 'react';
import PhotoViewer from 'react-imgviewer'
import 'react-imgviewer/lib/index.css';

export default class App extends Component {
  constructor() {
    super();
    this.state = {
      activeIndex: 0,
      imagesList: [{
        url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
      }]
    };
  }

  render() {
    return (
      <div>
          <PhotoViewer
              photos={imagesList}
              activeIndex={this.state.activeIndex}
              cwidth={300}
             />
        </div>
    );
  }
}

Props

propstypedefaultdescriptionrequired
photosarray-image listtrue
cwidthnumber300photos parent container widthfalse
cheightnumber400photos parent container heightfalse
activeIndexnumber0active image indexfalse
onActiveChangefunccallback when active image index changefalse

License

MIT