digidem / react-dimensions

[Looking for maintainers]

Home Page:http://lab.digital-democracy.org/react-dimensions/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle other layout changes

langri-sha opened this issue · comments

I was wondering whether it would be possible to optimally track other events that cause the parent container to recalculate it's dimensions? For instance, if a flexbox sibling suddenly becomes greedier, the parent container will resize, but the window dimensions are still the same.

Good question. There is no resize event on anything other than window. I am thinking maybe we should calculate width and height on every render, so if you resized the flexbox you would just re-render this component. Not sure about performance implications?

This is definitely needed. The classic resize plugin for jQuery did this by setting up a timer, which has the advantage that it will always work, even when your content is hosted inside some other framework (in React's case, this would cover situations where Component.render() has not been called again, but the browser has resized content some other way).

I just submitted an implementation of "always calculate width/height on each render" in PR #17.

Still needs some work, but let me know what you think.

LOL...just noticed the other PRs addressing some of the same things. 😄

Any movement on this issue? It would be very nice if the recalculation occurred not just on window resizes..

Thanks!

Sweet thanks @gmaclennan !