# masonry-react-native

> A simple React Native implementation of Masonry layout, using ScrollView.

Latest version **1.0.1** (published 2020-10-16) · MIT license · 0 weekly downloads

## Install

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

## 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.0.1 |
| Published | 2020-10-16 |
| First published | 2020-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrew |
| Maintainers | iandrew3 |
| Keywords | masonry, react, masonry layout, masonry list, react-native, scrollview |

## Links

- npm: https://www.npmjs.com/package/masonry-react-native
- Homepage: https://github.com/iAndrew25/masonry-react-native
- npm.io page: https://npm.io/package/masonry-react-native

## 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.0.1 (latest) — 2020-10-16
- 1.0.0 — 2020-10-16

## README

# masonry-react-native
A simple React Native implementation of Masonry layout, using ScrollView.

## Features
 * allows rendering any type of content inside a `View`.
 * calculates each column's height and adds a new `View` to the smallest column, so no space will be wasted.
 * can be used with `LayoutAnimation` for a nicer render animation.
 * API similar with `FlatList`
 
![preview](./example/preview.gif)

## Usage
### Install
Using Node Package Manager (`npm`):

```
$ npm install masonry-react-native
```

### Import
```javascript
import Masonry from 'masonry-react-native';
```

### Render
```javascript
<Masonry
	data={[
		{id: 0, text: 'Text 0'},
		{id: 1, text: 'Text 1'},
		{id: 2, text: 'Text 2'},
	]}
	numberOfColumns={3}
	keyExtractor={({id}) => id}
	renderItem={({item}) => (
		<Text>{item.text}</Text>
	)}
/>
```

### API
|Props|Type|Description|Default|
|-----|-----|-----|-----|
| numberOfColumns | number | number of columns | 2 |
| data | array | list of items | [] |
| keyExtractor | func | extracts unique id |  |
| ListHeaderComponen | element | element to be rendered in the list header |  |
| renderItem | func | element to be rendered inside the list |  |
| ...rest | object | the rest of props are passed to `ScrollView` |  |

## Authors
* **Andrew** - [iAndrew25](https://github.com/iAndrew25)

See also the list of [contributors](https://github.com/iAndrew25/masonry-react-native/graphs/contributors) who participated in this project.

## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

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