jaredLunde / masonic

🧱 High-performance masonry layouts for React
https://codesandbox.io/s/0oyxozv75v
MIT License
804 stars 50 forks source link

Cat images overlap on the demo #85

Closed chenxiaoyao6228 closed 3 years ago

chenxiaoyao6228 commented 3 years ago

Describe the bug Cat images overlap on the demo

To Reproduce see: https://codesandbox.io/s/masonic-inside-of-a-scrollable-div-example-k9l6c?file=/src/index.js

Expected behavior expect not to overlap

Screenshots image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

wiktoriavh commented 3 years ago

Same issue here image

I am on Desktop, Windows 10, Vivaldi (Chromium) Browser.

samwyzz commented 3 years ago

Facing a similar behavior.

Not to mention on the initial render of the masonry grid, all cells that could be fit inside the window are not displayed. Only upon scrolling do the cells get appended. Also these appended cells have a different vertical gap than the cells that are displayed on the initial render.

Based on my limited understanding, I believe this behavior is related to the cell height and itemHeightEstimate attribute.

This is a confusing aspect of masonic, since the purpose of masonry layouts is to have cells of varying heights and not having a single universal height. I don't understand how a generalized height estimate could apply to cells with a major difference in height. For example a grid with some cells with a height of a say 1000px and some with a height of 50px. What would be the heightEstimate in this case ?

Edit:

First "page" load yield hidden cells #70 Newly loaded items from infiniteLoader seem to be placed in 1 column #17