# react-masonry-infinite-scroll

> Masonry Layout with Infinite Scroll

Latest version **1.1.1** (published 2017-12-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-masonry-infinite-scroll
pnpm add react-masonry-infinite-scroll
yarn add react-masonry-infinite-scroll
bun add react-masonry-infinite-scroll
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2017-12-12 |
| First published | 2017-10-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | kurumkan |
| Maintainers | kurumkan |
| Keywords | masonry, masonry-layout, react, infinite, scroll |

## Links

- npm: https://www.npmjs.com/package/react-masonry-infinite-scroll
- Repository: https://github.com/kurumkan/react-masonry-infinite-scroll
- Homepage: https://github.com/kurumkan/react-masonry-infinite-scroll#readme
- Issues: https://github.com/kurumkan/react-masonry-infinite-scroll/issues
- npm.io page: https://npm.io/package/react-masonry-infinite-scroll

## 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

- 1.1.1 (latest) — 2017-12-12
- 1.1.0 — 2017-12-11
- 1.0.9 — 2017-10-08
- 1.0.8 — 2017-10-08
- 1.0.7 — 2017-10-08
- 1.0.6 — 2017-10-08
- 1.0.5 — 2017-10-06
- 1.0.4 — 2017-10-06
- 1.0.3 — 2017-10-06
- 1.0.2 — 2017-10-06
- 1.0.1 — 2017-10-06
- 1.0.0 — 2017-10-06

## README

# React Masonry Layout with Infinite Scroll

## Installation

```
npm install --save react-masonry-infinite-scroll
```

## Demo
[Live demo](https://github.com/kurumkan/pinterest-clone-fcc)

![Screenshot](https://res.cloudinary.com/dzjiv8sye/image/upload/v1507299172/masonry-screenshot_rturd5.png)


## How to use
First add Grid container for the layout.
And then insert GridItems into it:

```
import { Grid, GridItem } from 'react-masonry-infinite-scroll';

...

notifyReadyState() {
  console.log('Grid is ready!');
}

render() {
	return (

   		<Grid
          columnWidth={260}
          fitWidth={true}
          gutter={5}
          loadMore={this.props.getPins}
          limit={6}
          scrollThreshold={400}
          itemsLeft={this.props.itemsLeft}
          notifyReadyState={this.notifyReadyState}
        >
			{ this.renderGrid() }
		</Grid>
 	);
 }


renderGrid() {
	return (
    	this.props.images(img => (
        	<GridItem>
                <img src={ img }  onLoad={ this.context.imageLoaded } />
            </GridItem>
        ))
    );
}

```
## Props
| name               | type          | default     | description|
| -------------      | ------------- |-------------|-------------|
| `columnWidth`      | `number`      |`100`        |Width of each grid element|
| `fitWidth `        | `bool`        |`false`      |Should the grid be centered horizontally|
| `gutter`           |  `number`     |`5`          |Vertical distance between grid| items
| `itemsLeft`        | `number`      |`0`          |How many items left to load. If 0 stop calling `loadMore()` function|
| `limit`            | `number`      |`1`          |How many items to load on scroll|
| `scrollThreshold ` | `number`      |`300`        |The distance in pixels before the end of the items that will trigger a call to `loadMore()`.|

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