Eui: [EuiResizableContainer] dynamically determining the "direction" prop leads to an error

Created on 30 Jan 2021  路  3Comments  路  Source: elastic/eui

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

engineer bug

Most helpful comment

Closing this in favor of #4555

All 3 comments

Just for clarification, width updates on a window resize.

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.

Closing this in favor of #4555

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nickofthyme picture nickofthyme  路  4Comments

stacey-gammon picture stacey-gammon  路  4Comments

j-m picture j-m  路  3Comments

peteharverson picture peteharverson  路  4Comments

sebastienlabine picture sebastienlabine  路  3Comments