cedricdelpoux / react-responsive-masonry

React responsive masonry component built with css flexbox
https://cedricdelpoux.github.io/react-responsive-masonry/
MIT License
381 stars 37 forks source link

Items are not being distributed into columns appropriately #117

Closed brandonmcconnell closed 1 month ago

brandonmcconnell commented 7 months ago

I see lots of available space in one column, but extra items are still added to another column

Here is my impl:

<ResponsiveMasonry
  columnsCountBreakPoints={{ 350: 1, 750: 2, 1100: 3 }}
>
  <Masonry>
    ...
  </Masonry>
</ResponsiveMasonry>
dpaulos6 commented 7 months ago

tested it and it's works fine for me

Denis-Andreev commented 7 months ago

Check the source of lib, there are simple logic for elem distribution and working not as you expect

walshie4 commented 6 months ago

I see this happening as well especially as the dataset grows through an infinite scroll type fetch pattern. A couple columns end up growing much longer (FWIW our content is different sized which may contribute to the issue)

cmastro commented 5 months ago

I have the same issue when the dataset grows in a infinite scroll. If you call to an API and the array of elements grows with differents heights, the items are not being distributed appropriately.

cedricdelpoux commented 5 months ago

PR's are welcome if you want to help improving the distribution algorithm

cedricdelpoux commented 1 month ago

Published in 2.4.0