# react-masonry-infinite

> React component for masonry infinite grid. Based on Bricks.js, React Infinite Scroller and React Masonry Layout.

Latest version **1.2.2** (published 2017-12-23) · MIT license · 0 weekly downloads

## Install

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

## 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.2.2 |
| Published | 2017-12-23 |
| First published | 2016-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 173 |
| Author | Georgiy Tarasov |
| Maintainers | skoob13 |
| Keywords | react, masonry, react-component, infinite, scroll |

## Links

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

## Dependencies (3)

- [bricks.js](https://npm.io/package/bricks.js.md) ^1.7.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10
- [react-infinite-scroller](https://npm.io/package/react-infinite-scroller.md) ^1.0.12

## 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.2.2 (latest) — 2017-12-23
- 1.2.1 — 2017-06-26
- 1.2.0 — 2017-06-26
- 1.1.0 — 2016-08-29
- 1.0.4 — 2016-08-28
- 1.0.2 — 2016-08-28
- 1.0.1 — 2016-08-28

## README

# React Masonry Infinite

[![npm](https://img.shields.io/npm/dy/localeval.svg)](https://npmjs.com/react-masonry-infinite)

Very simple React.js component for masonry grid. Based on [Bricks.js](https://github.com/callmecavs/bricks.js), [React Infinite Scroller](https://github.com/CassetteRocks/react-infinite-scroller) and [React Masonry Layout](https://github.com/scarletsky/react-masonry-layout).

Component is mostly suitable for static data, but can be used with dynamic with instance methods.

### Demo
[Demo page](https://skoob13.github.io/react-masonry-infinite)

### Features
- Masonry layout
- Perfomance of Bricks.js ([Bricks.js homepage](http://callmecavs.com/bricks.js/))
- Infinite scroll from a box

### Instalation

Using `NPM`

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

Using `yarn`

```sh
  yarn add react-masonry-infinite 
```

### Basic example
```js
import MasonryInfiniteScroller from 'react-masonry-infinite';

...
<MasonryInfiniteScroller
    hasMore={this.state.hasMore}
    loadMore={() => this.setState({ elements: this.state.elements.push("Element") })}
>
    {
        this.state.elements.map(id =>
            <div key={id} />
        )
    }
</MasonryInfiniteScroller>
...
```

### Props

|Props|Type|Default|Description|
|:-:|:-:|:--|:--|
|        className          |       String      |        `''`      | CSS className for root element           |
|      pack        |       Boolean      |    `false`   | Flag to force pack on every update |
|      packed        |       String      |    `data-packed`   | An attribute added to the grid items after they're positioned within the grid. If the attribute is not prefixed with `data-`, it will be added. See [Bricks.js](https://github.com/callmecavs/bricks.js) |
|       sizes         |       Array       |    `[{ columns: 1, gutter: 20 }, { mq: '768px', columns: 2, gutter: 20 }, { mq: '1024px', columns: 3, gutter: 20 }]` | An array of objects describing the grid's properties at different breakpoints. When defining your sizes, note the rules of [Bricks.js](https://github.com/callmecavs/bricks.js) |
|       position        |       Boolean      |         `true`       | A Boolean indicating that the grid items should be positioned using the `top` and `left` CSS properties. |
|       style        |       Object      |         `{}`       | The inline style |

And other [React Infinite Scroller](https://github.com/CassetteRocks/react-infinite-scroller) props.

### Methods

|Method|Description|
|:-:|:--|
|forcePack|Packs Bricks.js instance (usefull when data is dynamic)|
|forceUpdate|Updates Bricks.js instance|
|createNewInstance|Recreates Bricks.js instance. E.g. when you need to dynamically handle amount of columns.|

### License
MIT

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