2016-10-17 16:45:59 +08:00
2016-10-15 15:11:48 +08:00
2016-10-15 16:57:30 +08:00
2016-10-17 16:45:59 +08:00
2016-10-15 16:57:30 +08:00
2016-10-15 16:57:30 +08:00
2016-10-15 16:57:30 +08:00
2016-10-15 16:57:30 +08:00
2016-09-29 22:57:05 +08:00
2016-10-15 16:57:30 +08:00
2016-10-17 16:45:59 +08:00
2016-10-12 17:54:08 +08:00
2016-10-08 18:18:10 +08:00
2016-10-15 16:57:30 +08:00

react-viewer

react image viewer.

Introduction

Because i can`t comfortable use viewerjs in react, so i create react-viewer to replace it.

Installation

npm install react-viewer --save

Usage

import * as React from 'react';
import Viewer from 'react-viewer';

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}
        onClose={() => { this.setState({ visible: false }); } }
        images={['']}
        />
      </div>
    );
  }
}

Props

props type default description required
visible string false Viewer visible true
onClose string - Specify a function that will be called when Visible close true
images string[] [] image source array true
activeIndex number 0 active image index false

TODO

  • add button icon
  • add toolbar
  • optimize image zoom
  • optimise image change

License

MIT

Description
react image viewer, supports rotation, scale, zoom and so on
Readme MIT 17 MiB
Languages
TypeScript 79.1%
JavaScript 13.3%
Less 7.6%