Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding load more #5

Closed
TrixieL opened this issue Sep 28, 2017 · 1 comment
Closed

Adding load more #5

TrixieL opened this issue Sep 28, 2017 · 1 comment

Comments

@TrixieL
Copy link

TrixieL commented Sep 28, 2017

@xuopled Hi Cedric!

Again, thanks for answering my emails. I was wondering if we can have a feature which loads more photos when a button is clicked (in contrast with infinite scrolling). The number of photos shown by default as well as the number of photos to be loaded should be customizable; considering different screen sizes (mobiles and desktop).

Thanks!! :)

@cedricdelpoux
Copy link
Owner

Hi, you can achieve this with a custom wrapper. It is not the responsibility of react-responsive-masonry.

class MyWrapper extends Component {
  constructor() {
    this.state = {
      images = []
  }

  loadMore() {
   // Your load more magic
    this.setState({images: newImages})
  }

  render() {
    return (
        <ResponsiveMasonry columnsCountBreakPoints={{350: 1, 750: 2, 900: 3}}>
        	<Masonry>
        		{this.state.images.map((image, i) =>
        			<img key={i} src={image} style={{width: "100%", display: "block"}} />
        		)}
        	</Masonry>
    	</ResponsiveMasonry>
    )
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants