1.1.1 • Published 6 years ago

react-masonry-infinite-scroll v1.1.1

Weekly downloads
7
License
ISC
Repository
github
Last release
6 years ago

React Masonry Layout with Infinite Scroll

Installation

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

Demo

Live demo

Screenshot

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

nametypedefaultdescription
columnWidthnumber100Width of each grid element
fitWidthboolfalseShould the grid be centered horizontally
gutternumber5Vertical distance between griditems
itemsLeftnumber0How many items left to load. If 0 stop calling loadMore() function
limitnumber1How many items to load on scroll
scrollThresholdnumber300The distance in pixels before the end of the items that will trigger a call to loadMore().
1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago