Component doesn't update if Children resize
See original GitHub issueThe 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:
- Created 8 years ago
- Comments:10 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
fixed in
react-masonry-component@4.3.0