nickmcmillan / react-pig

Arrange images in a responsive, progressive-loading grid managed in JavaScript using CSS transforms.
56 stars 11 forks source link

pagination support? updating imageData props? #4

Open petahbred opened 5 years ago

petahbred commented 5 years ago

Hi,

Thanks for creating PIG react library!

Will there be support for pagination and/or being able to update the imageData prop so that new files will just be appended to the bottom of the view?

Thanks

vincentjflorio commented 2 years ago

@petahbred I had another solution for a gallery before that was paginated, and after switching to this, I tried to use state changes to update my imageData prop and it didn't work -- what did work is wrapping it with something and setting a key for both wrapper and Pig.

My understanding is there are so many callbacks and memos to keep this thing speedy that it's going to dig its claws in to avoid a change if it can. So I made the key a JSON stringified sliced array of whatever the images are. In our project they're so likely to never have the same order that each update changes that string, forced a re-render.

Not sure how an infinite scroll approach would work, perhaps through concatenating after the same process?