question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WindowScroll + Masonry + AutoSizer + CellMeasurer cells are not resized

See original GitHub issue

I have made a small setup to display a bug when using WindowScroll + Masonry + AutoSizer + CellMeasurer.

The expectation is that cellRenderer will receive proper style with proper width but in fact it always gets defaultWidth:

https://codesandbox.io/s/73921rmy0x

I have fixed it with the line //FIXME NASTY HACK but it think it should be done differently.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (21 by maintainers)

github_iconTop GitHub Comments

4reactions
kirill-konshincommented, Mar 8, 2018

Finally had time for this, and managed to make this work.

I’ve found in the masonry example the reset method, which calls

cache.cleanAll();
cellPositioner.reset(...things);
masonryRef.clearCellPositions(); // instead of recomputeCellPositions

That’s exactly what I was looking for.

https://codesandbox.io/s/6x6qkoprk sandbox updated, bug is gone.

I presume this does not perform well especially if scrolled deep.

2reactions
bvaughncommented, Jan 22, 2018

I was saying that looks like it becomes pointless to call measure function for Masonry because it does nothing.

Correct. The CellMeasurerCache is used for both Masonry as well as List/Grid/Table. Masonry is not built to support async measurements. The other three are. That’s why the docs list the Masonry constraint.

Your follow up question is better suited for Stack Overflow or Slack than GitHub. I suggest asking there!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Virtualized Masonry does not resize with the browser
I am using react-virtualized Masonry component. You can see how the items rearrange and the component is correctly resized when the browser ...
Read more >
Rendering large lists with React Virtualized - LogRocket Blog
AutoSizer. It automatically adjusts the width and height of another component. CellMeasurer. It automatically measures a cell's contents by ...
Read more >
A React virtualized, autosizing masonry component
An autosizing virtualized masonry component which only renders items ... Overscanning allows the tab key to focus on the next (not yet ...
Read more >
types/react-virtualized@9.21.21 - jsDocs.io
Decorator component that automatically adjusts the width and height of a single child. Child component should not be declared as a child but ......
Read more >
How to use the react-virtualized.AutoSizer function in ... - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found