1.2.1 • Published 7 years ago

react-imageview v1.2.1

Weekly downloads
9
License
MIT
Repository
github
Last release
7 years ago

react-imageview

Imageview component built with react

Demo

You can find demo in folder example

Usage with React

1、Install the package

npm install react-imageview --save

2、Using as your need

// Example 1:

import React, { Component } from 'react'
import ImageView from 'react-imageview'

import 'react-imageview/dist/react-imageview.min.css'

class Main extends Component {
    state = {
        showViewer: false
    }
    render() {
        const imagelist = ['./1.png','./2.png','./3.png','./4.png']
        return (
            <div>
                {
                    !!this.state.showViewer && <ImageView imagelist={imagelist} />
                }
                <button onClick={e=>this.show()}>click me to show Alert</button>
            </div>
        )
    }
    show() {
        this.setState({
            showViewer: true
        })
    }
}

// Example 2:

import { SingleImgView } from 'react-imageview'
import 'react-imageview/dist/react-imageview.min.css'

// You can call SingleImgView.show anywhere and anytime, there will be only one View DOM node be added.

const imagelist = ['./1.png','./2.png','./3.png','./4.png']
SingleImgView.show({ imagelist });

Configuration

ParamTypeDescription
imagelistarrayThe list of images to view
disablePinchboolDisable pinch function
disableRotateboolDisable rotate function
disableDoubleTapboolDisable double tap function
longTapfunctionEvents called after the long tap

License

Copyright(c) 2016-2017 AlloyTeam. Licensed under MIT license.

1.2.1

7 years ago

1.1.2

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago