react-masonry-css icon indicating copy to clipboard operation
react-masonry-css copied to clipboard

Request to make columns as equal height as possible

Open blueedgetechno opened this issue 4 years ago • 12 comments

It will work perfectly but if some items of particular columns make the column abruptly longer move the last elements of column to other columns.

blueedgetechno avatar Sep 17 '20 19:09 blueedgetechno

Can you clarify what "column abruptly longer" mean? Maybe with code and a screenshot of the unexpected behaviour is possible

paulcollett avatar Sep 18 '20 11:09 paulcollett

view

and it's even more below.

blueedgetechno avatar Sep 18 '20 15:09 blueedgetechno

Thanks for the screen shot, I understand what you're asking now.

I'm aware of this behaviour and it's occurring because we don't actually handle this case, but i'm open to revisiting.

To implement it's slight performance trade off, as we need to calculate all the item heights and adjust the layout again, then again after each image has loaded. So for this plugin, avoiding all these re-layouts was actually the motivation behind making this plugin originally.. to be a fast and performant foremost.

If we were to do this I'd consider implementing it to be an "opt-in" feature to retain performance but support this feature to the smaller set of users who would need it. happy to discuss more

paulcollett avatar Sep 21 '20 01:09 paulcollett

yeah, that would be very convenient.

blueedgetechno avatar Sep 21 '20 04:09 blueedgetechno

@paulcollett having the same issue as here and in #73. The problem becomes especially bad if you use this package for something like unsplash.com. The more items you display, the larger the difference between the columns can become until you end up with just a single column that is actually filled till the end.

jaschaio avatar Jun 25 '21 19:06 jaschaio

this is a great alternative to the traditional masonry library 🙌 However, with such uneven columns, it's visually unusable for anything more than a few items as the page looks broken. Is this opt-in feature in the works by any chance?

Screen Shot 2021-09-07 at 3 29 52 PM

ryansrofe avatar Sep 07 '21 19:09 ryansrofe

Considering this is, understandably, intended behaviour we'll likely have to switch to infinite loading of our content but as @jaschaio pointed out, that only delays or potentially magnifies the issue.

Keeping an eye on this for future projects 🙏

ian-emsens-shd avatar Jan 18 '22 08:01 ian-emsens-shd

Does anybody have an alternative library they can recommend to get around this issue? It's bad enough with a few elements like in the screenshot above, but if you have over 100 (not uncommon for an image gallery) it leaves columns comically uneven, several screens of height different.

gregzaal avatar Jun 09 '22 09:06 gregzaal

did anyone find a solution for this?

wildlifechorus avatar Jan 18 '23 13:01 wildlifechorus

@mui/lab/Masonry Can it be handled?

liaojunhao avatar Feb 12 '23 17:02 liaojunhao

react-smart-masonry library works, but not sure about the performance.

haramishra avatar Mar 21 '23 03:03 haramishra

Does anybody have an alternative library they can recommend to get around this issue? It's bad enough with a few elements like in the screenshot above, but if you have over 100 (not uncommon for an image gallery) it leaves columns comically uneven, several screens of height different.

Absolutely True! I'm removing this library immediately. This is what I need https://www.npmjs.com/package/react-photo-gallery?activeTab=readme

Parth909 avatar Jan 14 '24 11:01 Parth909