npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-simple-masonry-list

v0.1.3

Published

simple masonry list for react native

Downloads

3

Readme

react-native-simple-masonry-list

npm version

A simple masonry list implementation for react native. It uses the item's height to place items. If the item has a vertical margin then the margin value must be added to the height value.

Placement problem

If the user does not provide height values then the items will be placed just left to right and top to bottom by order. It may cause unbalanced column height and if it has more items, the height imbalance increases the probability. The below example show this. So it is recommended to fill the height of all items.

Installation

npm install react-native-simple-masonry-list

Usage

It requires data and renderItem props like FlatList.

import MasonryList from 'react-native-simple-masonry-list';

// ...

<MasonryList
  data={images}
  renderItem={({ item }) => <SomeComponent> ...</SomeComponent>}
  style={{ flex: 1 }}
/>;

Example

See example. This example code get unsplash random images using unsplash getting random photo api. It gets random 30 images from Unsplash API. The MasonryList split these images into 2 (or 3) columns in order. The previous image is placed higher regardless of the column, and the image of the same vertical offset is aligned from left to right.

If you want to run the example you must create env.json file to example folder and provide Unsplash access key.

Props

The props of the MasonryList extend the props of ScrollView. It is wrapped with a ScrollView container and all props values are used in the container except below values.

| | necessary | types | default | info | | --------------- | --------- | ---------------------------------------------------------------------------------------------- | --------- | --------------------------------- | | data | V | Array<T extends {height?: number}> | | Item list to display. | | renderItem | V | ({item: <T extends {height?: number}>, index: number, columnIndex: number}) => React.ReactNode | | render function of the item. | | columnCount | | number | 2 | Column count of the list | | columnViewStyle | | ViewStyle | (columnIndex: number) => ViewStyle | undefined | The style of each colum container |

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Next TODO

It uses ScrollView internally. So, it renders all items even if it has a huge count of items. So it may occur performance issue.

Mar-17-2022 19-07-23

In this example, you can see that adding more items takes up more time and memory when rendering.

License

MIT