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

[EuiResizableContainer] dynamically determining the "direction" prop leads to an error #4464

Closed
muhammadtalhas opened this issue Jan 30, 2021 · 3 comments
Labels

Comments

@muhammadtalhas
Copy link

I'd like to dictate the direction of resizable container depending on the size of the screen. I may be doing this the wrong way...

Relevant code snippets:
const { width } = useWindowDimensions();
...
<EuiResizableContainer direction={width <= 920 ? "vertical" : "horizontal"}> ....

As soon as it hits the threshold, The following error happens:

image

@muhammadtalhas
Copy link
Author

Just for clarification, width updates on a window resize.

@thompsongl
Copy link
Contributor

I think the problem is that we're not watching for/reacting to changes in the direction prop at all levels. Could be as simple as introducing a useMemo or useEffect, but it could also be as complex as needing to reinitialize each panel.

@thompsongl
Copy link
Contributor

Closing this in favor of #4555

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

No branches or pull requests

2 participants