Changelog - 2026-11-03
useElementSize no longer throws where there is no ResizeObserver
Bug FixIn one line. useElementSize threw a ReferenceError in its effect on a host that has no ResizeObserver (an old WebView, some test hosts). It now stays at { width: 0, height: 0 } and observes nothing.
What changed
- No
ResizeObserver, no throw. The effect checks for it before it observes. The hook returns0by0, as it does before the first measure. - Everything else is the same. A host that has
ResizeObservermeasures as before.
Who is affected
- An app that renders
useElementSizeon a host withoutResizeObserver. The render no longer fails. Add a polyfill if you need a real size there. - All other apps. No action needed.
See Hooks.