-
Will there be support for SVG elements or not? Now the error appears. Since the SVG element is not compatible with the HTML element.
|
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 1 reply
-
Seems like the TS types will need to change from using |
Beta Was this translation helpful? Give feedback.
-
🎉 This issue has been resolved in version 9.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Beta Was this translation helpful? Give feedback.
-
Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
I checked working with SVG. Does not work. The height variable is always zero. |
Beta Was this translation helpful? Give feedback.
-
Could you please provide reproduction in codesandbox? |
Beta Was this translation helpful? Give feedback.
-
https://codesandbox.io/s/use-resize-observer-hsxycd?file=/src/App.tsx It is required to display a square in the middle of the browser. But instead of the browser dimensions, the dimensions of the square are substituted in height, width. |
Beta Was this translation helpful? Give feedback.
-
Here's a slightly modified version of that sandbox: As you can see the hook reports the same exact values that a raw ResizeObserver reports, so I see no issues with the hook based on this example. |
Beta Was this translation helpful? Give feedback.
-
Why doesn't it return the dimensions of the SVG container? |
Beta Was this translation helpful? Give feedback.
-
Not 100% sure, the ResizeObserver spec around SVGs is a bit weird. Here's some stuff I found, hope it helps:
Also I wonder if you could just wrap your SVG in a div and measure that instead? |
Beta Was this translation helpful? Give feedback.
Not 100% sure, the ResizeObserver spec around SVGs is a bit weird.
Here's some stuff I found, hope it helps:
Also I wonder if you could just wrap your SVG in a div and measure that instead?
Might help you depending on your exact use-case.