Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not calculating innerHeight with child component in consideration #133

Open
Joegrundman opened this issue Feb 15, 2018 · 2 comments
Open

Comments

@Joegrundman
Copy link

When passing in a react component as child, the child's height is not included in the calculated innerHeight on first render. If the screen is resized, the resize now calculates the innerHeight including the child component, causing offset issues.

@whydna
Copy link

whydna commented Nov 9, 2018

any fix for this?

@Joegrundman
Copy link
Author

I made a work-around. In componentDidMount i call requestAnimationFrame with the callback firing a 'resize' event. requestAnimationFrame ensures that the css has finished being applied, then the triggered 'resize' event triggers a recalculation.

IIRC, I had to make a special case for the development environment. The additional events meant requestAnimationFrame was too soon, so i think i added a setTimeout callback for 100ms in development. Not great, but works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants