-
-
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
Components with adaptive size #162
Comments
Hey @Teyras Is there any chance you could throw together a codesandbox.io example? |
Hi @ctrlplusb, thanks for your great work on this lib! I'm hitting a similar scenario, related to having a responsive item inside a flexbox layout. I understand this is a common pitfall, but I just can't seem to get it to work. I made an example here: https://codesandbox.io/s/9jrnp207rr As described by @Teyras, the container adapts to width increases but not decreases. Any help much appreciated. |
Hey @vasturiano, I added width=100% to your flexGrow div to ensure sizing propagates correctly for this case. 👍 |
Thanks for the quick reply @ctrlplusb! I see, though making a flex element Here's the fixed example, with a flex sibling: https://codesandbox.io/s/n5llmynjp Thanks again for the awesome lib! |
Hi @ctrlplusb, I have a very similar situation to Vasturiano's except I have two siblings with adaptive size. Unfortunately, the The problem is the same, it works for increasing size but not decreasing size. After reading through this issue, I tried a few things like giving both siblings The same thing happens with CSS Grid: https://codesandbox.io/s/react-sizeme-flexgrow-responsive-00p6s Any help would be greatly appreciated. |
Got it! Looks like this workaround works just fine: #120 (comment) But I'm confused as to why this double-nesting is necessary in the first place? Anyway, this should do fine for our PWA layout. Here's the "fixed" example with flex: https://codesandbox.io/s/react-sizeme-flexgrow-responsive-4w5fi CSS Grid: https://codesandbox.io/s/react-sizeme-flexgrow-responsive-00p6s |
Let's say I have a component with
width: 100%
wrapped withsizeMe
. Inside this component, I draw a canvas that has the exact same width, but specified in pixels (taken from the injected props). When I enlarge the window, it works as expected - the canvas gets bigger (of course - I don't need to shrink the canvas that makes the parent component wider). Is there a way to make the width adapt to window size after I resize it to a smaller size?The text was updated successfully, but these errors were encountered: