-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Pitfalls when using flex layouts #120
Comments
Just wanted to share my experience in case it helps others. I also ran into this, but more than just needing any old div, I wanted to take up the whole width and height of the client area created by the flexbox. Unfortunately, this did't work so well with Edge (it would grow on resize, but not shrink), until I tried using relative and absolutely positioned divs. Now it works great in all browsers I tested. <SizeMe monitorHeight>
{({ size }) =>
<div style={{ position: 'relative', height: '100%' }}>
<div style={{ position: 'absolute', width: '100%', height: size.height }}>
{/* remaining content here */}
</div>
</div>
}
</SizeMe> My size-aware content is mostly using react-window controls, passing the This works great for me. YMMV, of course. |
Turns out the sizeme component isn't a complete drop-in replacement: * props are size:{width, height} rather than just width/height * its own props need tuning, and in particular extra markup around the child Credit to ctrlplusb/react-sizeme#120 (comment) for the latter
The behaviour of element-resize-detector causes a div to be injected which helps with tracking. Unfortunately this can break your flex layouts. To resolve you need to create a wrapping div around the flex layout div.
The text was updated successfully, but these errors were encountered: