Customizable masonry Flatlist. it just behave like Flatlist but using ScrollView behind the scene

Overview

Would you like to support me?

react-native-masonry-grid

Customizable masonry Flatlist. it just behave like Flatlist but using ScrollView behind the scene

Installation

npm install react-native-masonry-grid

Preview

2-columns 3-columns 4-columns

Usage

import MasonryFlatlist from 'react-native-masonry-grid';

// ...
const DATA = [
  {
    name: 'Coffee Now!',
    url: 'https://mp-staging-ix.onshobbak.net/media/ninja-catalog-42/eac92236-0e4f-466a-9bc2-e68a04bb96ad_NowCoffeeNew.png',
    height: 136, // Mendatory and can be dynamic for each item
  }
]

<MasonryFlatlist
    data={DATA}
    numColumns={3} // for number of columns
    columnWrapperStyle={styles.columnWrapperStyle}
    showsVerticalScrollIndicator={false}
    style={styles.masonryFlatlist}
    renderItem={({ item, index }) => {
      return <Card data={item} height={item.height} onPress={() => {}} />;
    }}
  />

Props

interface Props extends ScrollViewProps {
  numColumns?: number;
  loading?: boolean;
  LoadingView?: React.ReactNode | React.ReactElement | null;

  columnWrapperStyle: StyleProp<ViewStyle>;
  ListHeaderComponent?: React.ReactNode | React.ReactElement | null;
  ListEmptyComponent?: typeof React.Fragment | React.ReactElement | null;
  ListFooterComponent?: React.ReactNode | React.ReactElement | null;
  ListHeaderComponentStyle?: StyleProp<ViewStyle>;
  contentContainerStyle?: StyleProp<ViewStyle>;
  containerStyle?: StyleProp<ViewStyle>;
  onRefresh?: RefreshControlProps['onRefresh'];
  onEndReached?: () => void;
  keyExtractor?: ((item: any, index: number) => string) | undefined;
  onEndReachedThreshold?: number;
  style?: StyleProp<ViewStyle>;
  data: any[];
  renderItem: ({ item, index }: { item: any; index: number }) => ReactElement;

}
name required default description
numColumns no 2 Number of columns you want to render.
columnWrapperStyle no null Optional custom style for multi-item rows generated when numColumns > 1.
loading no false for enabling loadingView.
LoadingView no null Loader component will be show when loading prop will true.
ref no null it will be forwardRef to ScrollView then you can use all props of scrollview by ref.

Note: Other props are the same as Flatlist. you can read flatlist docs for other props which are in props but not in the props table.

Contributing

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

License

MIT

You might also like...

This simple library allows you to create awesome responsive and highly customizable popups importing just one JavaScript file.

Creativa - Popup This is a simple library that allows you to create awesome popups importing just one JavaScript file. Getting started You can import

Mar 29, 2022

Hadmean is an internal tool generator. It is language agnostic, schema driven, extremely customizable, featured packed, user-friendly and has just one installation step.

Hadmean is an internal tool generator. It is language agnostic, schema driven, extremely customizable, featured packed, user-friendly and has just one installation step.

Hadmean Report a Bug · Request a Feature · Ask a Question Table of Contents About Quick Demo Motivation Why you should try Hadmean Getting Started Pre

Dec 29, 2022

JSPro is nothing but JavaScript Prototypes! The publisher is too lazy to write full name that's why it's just JSPro.

JSPro is nothing but JavaScript Prototypes! The publisher is too lazy to write full name that's why it's just JSPro. Whatever, it's a library of hundreds of awesome JavaScript Prototypes (you may know it as dot function) for lazy programmers. Just install the package with a little effort and leave the blames for the publisher.

Mar 10, 2022

A work-in-progress HTML sanitizer that strives for: performance like window.Sanitizer, readiness like DOMPurify, and ability to run in a WebWorker like neither of those.

Amuchina A work-in-progress HTML sanitizer that strives for: performance like window.Sanitizer, readiness like DOMPurify, and ability to run in a WebW

Sep 17, 2022

FortuneSheet is an online spreedsheet component library that provides out-of-the-box features just like Excel

FortuneSheet FortuneSheet is an online spreedsheet component library that provides out-of-the-box features just like Excel English | 简体中文 Purpose The

Jan 3, 2023

Allow moving/copying/and creation embeds for blocks with drag-n-drop just like Logseq or Roam

Allow moving/copying/and creation embeds for blocks with drag-n-drop just like Logseq or Roam

Demo Features Drag-n-drop for list items in the same pane and between different panes 3 modes: move block, copy block, embed block Automatic reference

Dec 26, 2022

Agetos is a web-platform messaging service founded in 2022. It has no purpose. Just like the other applications.

Agetos is a web-platform messaging service founded in 2022. It has no purpose. Just like the other applications.

Start with a simple idea 🤳 Turn it into an awesome app 🔥 About Agetos is a web-platform messaging service founded in 2022. It has no purpose. Just l

Aug 4, 2022

🖼 A jQuery plugin to view images just like in Windows. Browser support IE7+!

⚠️ Attention! This repository will be maintained just in small iteration. The plugin is easy to use, but its customization can be troublesome. To impr

Dec 30, 2022

Multiple level dropdown works with Bootstrap 5, just like native support.

Bootstrap 5 Multiple Level Dropdown. For Bootstrap 4, please visit Bootstrap 4 Multiple Level Dropdown Using official HTML without adding extra CSS st

Dec 13, 2022
Releases(v0.0.2)
Owner
Numan
Software engineer. JavaScript | React Native | React | NodeJS | Algorithms
Numan
A basic USDZ file (Pixar Universal Scene Description) loader for ThreeJS

Three USDZ Loader A basic USDZ (binary Universal Scene Description) reader for Three.js The plugins supports animation as well as loading multiple USD

Pierre-Olivier NAHOUM 37 Dec 13, 2022
I want to catch the best scene of my life. The browser wants to, too.

Scroll Cat I want to catch the best scene of my life. The browser wants to, too. There are too many good works in the world that are a hundred times b

木杉 14 Sep 6, 2022
Minimalistic portfolio/photography site with masonry grid, page transitions and big images.

Gatsby Starter Portfolio: Emilia Minimalistic portfolio/photography site with masonry grid, page transitions and big images. Themeable with Theme UI.

Cryptob3auty 1 May 20, 2022
Script para crear un layout tipo masonry.

light-masonry Script para crear un layout tipo masonry. Solo es necesario tener el contenedor junto a sus hijos que se acomodaran en este tipo de layo

Lenin Felix 2 Feb 4, 2022
Hash.js is a 0.5 KB script that lets you in a super simple way manipulate everything behind # in urls.

Hash.js - URL Hash Manipulation Hash.js is a 0.5 KB script that lets you in a super simple way manipulate everything behind # in urls. Tested in lates

Jonny Strömberg 152 Aug 1, 2022
Freewall is a cross-browser and responsive jQuery plugin to help you create grid, image and masonry layouts for desktop, mobile, and tablet...

Freewall Freewall is a cross-browser and responsive jQuery plugin to help you create many types of grid layouts: flexible layouts, images layouts, nes

Minh Nguyen 1.9k Dec 27, 2022
A javascript plugin to filter elements from a "masonry" grid.

Isolde Isolde is a lightweight, flexible, and responsive javascript plugin allow you to filter elements from a "masonry" grid. Quick start Install Thi

Tristan BOULANGER 24 Oct 13, 2022
Simple, responsive and lightweight Masonry Grid jQuery Plugin.

jquery-masonry-grid Simple, responsive and lightweight Masonry Grid jQuery Plugin. Installation Add the script before closing the <body> tag (make sur

Peter Breitzler 8 Jun 9, 2022
Minimalist dependancy free Masonry layout library

MiniMasonry.js Minimalist dependency free Masonry layout library MiniMasonry is a lightweight dependency free Masonry layout. It will compute elements

Spope 343 Dec 4, 2022
Jaime Gómez-Obregón 119 Dec 24, 2022