# react-gallery-viewer

> A high performant gallery viewer

Latest version **0.0.8** (published 2017-10-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-gallery-viewer
pnpm add react-gallery-viewer
yarn add react-gallery-viewer
bun add react-gallery-viewer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2017-10-25 |
| First published | 2017-10-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Piyush Tiwari |
| Maintainers | fyre91 |
| Keywords | react, react-component, react-gallery-viewer, react-gallery, react-image-viewer |

## Links

- npm: https://www.npmjs.com/package/react-gallery-viewer
- Repository: https://github.com/urbanclap-engg/react-gallery-viewer
- Homepage: https://github.com/urbanclap-engg/react-gallery-viewer#readme
- Issues: https://github.com/urbanclap-engg/react-gallery-viewer/issues
- npm.io page: https://npm.io/package/react-gallery-viewer

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^0.14.0 || ^15.0.1 || ^16.0.0
- [react-dom](https://npm.io/package/react-dom.md) ^0.14.0 || ^15.0.1 || ^16.0.0
- [classnames](https://npm.io/package/classnames.md) 2.2.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.8 (latest) — 2017-10-25
- 0.0.7 — 2017-10-20
- 0.0.6 — 2017-10-20
- 0.0.5 — 2017-10-20
- 0.0.4 — 2017-10-20
- 0.0.2 — 2017-10-20
- 0.0.1 — 2017-10-20

## README

# React Gallery Viewer for mobile device

## Introduction
A google like image viewer, which is highly performant. With fullscreen images and data and lots of images the DOM gets heavy and results in janks across low end devices, this package aims to solve that issue for mobile currently[Desktop maybe in future releases].


## Demo Link(Will only work for mobile)

https://www.urbanclap.com/weddings 


## Install

```bash
npm install --save react-gallery-viewer
npm run demo:watch
Open http://localhost:5000/
```


## Usage

````js
class BasicExample extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  showGallery = (index) => {
    this.setState({
      boolShowGallery: true,
      index
    })
  }
  closeGallery = () => {
    this.setState({
      boolShowGallery: false
    });
  }
  render() {
    const styles = require('../css/example.css');
    const imageArr = [
      'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQQaEde-HaYe-7YPwfkqKX_fIoDCv3tq6DYrLPCaiGh9rtZUATq33l2dJ2KPg',
      'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQtY0KKx3WeMtqsJPvwHrmh_IXQ5Adez1MJSc9TcVJGyP46tpN33gOwjYDb4g',
      'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQQaEde-HaYe-7YPwfkqKX_fIoDCv3tq6DYrLPCaiGh9rtZUATq33l2dJ2KPg',
      'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQtY0KKx3WeMtqsJPvwHrmh_IXQ5Adez1MJSc9TcVJGyP46tpN33gOwjYDb4g',
      'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQQaEde-HaYe-7YPwfkqKX_fIoDCv3tq6DYrLPCaiGh9rtZUATq33l2dJ2KPg'
    ];
    return (
      <div>
        <div className={styles.thumbnailContainer}>
          {
            imageArr.map((image, index) =>
              <div
                key={`thumb-${index}`}
                className={styles.thumbnail}
                onClick={this.showGallery.bind(this, index)}>
                <img src={image} />
              </div>
            )
          }
        </div>
        {
          this.state.boolShowGallery &&
          <div className={styles.containerClass}>
            <GalleryViewer
              closeIcon="http://image.ibb.co/djY7t6/close_icon.png"
              currentSlide={this.state.index}
              closeImageGallery={this.closeGallery}
              onCurrentIndexChange={this.onCurrentIndexChange}>
              {
                imageArr.map((image, index) =>
                  <div
                    className={styles.imageContainer}
                    key={`gallery-${index}`}>
                    <img src={image} />
                    <div className={styles.info}>
                      Image no {index}
                    </div>
                  </div>
                )
              }
            </GalleryViewer>
          </div>
        }
      </div>
    );
  }
}
`````

| Name         | Type    | Default | Description |
| ------------ | ------- | ------- | ----------- |
| slidesInDOM | Number | `3` | Number of slides to be kept in DOM |
| onCurrentIndexChange | Function | `` | Callback to be called after currentSlide changes |
| currentSlide | Number | `0` | Current Slide |
| boolDisableScroll | Boolean | `false` | To Disable scroll of the gallery |
| closeImageGallery | Function | `` | Callback to be called after the gallery closes |
| containerClass | String | `` | Class name to be applied on the container of gallery |
| closeIcon | Boolean | `` | Close icon image source to be used in gallery |
```

## Example

`npm run demo:watch` and then go to `http://localhost:5000/`

---
_Source: https://npm.io/package/react-gallery-viewer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
