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.

Component doesn't update if Children resize

See original GitHub issue

The React-Masonry-Component does not update if a child component changes size - it causing overlapping issues/general ugliness. There should be a way to monitor children component for size changes.

For example in this scenario. If ChildOne’s state is updated it will be re-rendered but the Masonry component would not be and therefore not realigned properly (unless it was listening for the same changes - which is not always practical).

<Masonry options={options}>
   <ChildOne />
   <ChildTwo />
</Masonry 

Am I doing something wrong or is this an actual bug/not fixable?

Cheers!

might be the same issue as #2

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
erkartik91commented, Mar 6, 2016

I added reference to my Masonry instance using the following code ref={function(c) {this.masonry = c.masonry;}.bind(this)}

and now can manually trigger resize using the following code this.masonry.layout()

Hope this helps.

3reactions
aframcommented, Nov 3, 2016

fixed in react-masonry-component@4.3.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

React isn't updating child properties in nextjs - Stack Overflow
I've tried using event listeners, both in the component directly and as an effect and it does the same thing every time. It...
Read more >
Bad resizing of component children - Figma Community Forum
I tried that, but it doesn't work. I tried to take out the whole group/frame. We've been using this component for a long...
Read more >
Re-render a React Component on Window Resize | Pluralsight
Under normal conditions, React will re-render a component when its props or state changes. To trigger a re-render of MyComponent ; Now we...
Read more >
resize - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The resize CSS property sets whether an element is resizable, and if so, in which directions.
Read more >
Why React Child Components Don't Update on Prop Changes
In React, it's a common problem to have child components that don't re-render when you expect them to. In particular, a common problems...
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