Closed giulioz closed 4 years ago
what is a good way to detect these changes?
No idea, I'm trying to investigate.
A silly solution could be to expose an API to imperatively invalidate the layout:
const { invalidateSize } = useFlex()
useEffect(invalidateSize, [width, height]);
@giulioz hmmm should it resize on Box change btw? And what resizes, a Box or content inside a Box?
I guess it's easier to do for the first variant (recalculate Box parameters)
i dont think resize can be easily detected. manual invalidate is probably the way to go. that also allows for some cool tricks, like users can offset their contents and not inform the flex layout, which works like css transforms.
There seems to be some issues with layout recalc when Box sizes change, especially when using
useLoader