component-size
component-size copied to clipboard
React hook for determining the size of a component
not working with React.forwardRef
This fixes https://github.com/rehooks/component-size/issues/32 Solution is just this comment here https://github.com/rehooks/component-size/issues/32#issuecomment-829842342
Hi, When using `useComponentSize` with server side rendering we experience this warning. `Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output...
Reduced test case: https://stackblitz.com/edit/react-9vjncm Here we are logging the size every time its reference changes. The actual size never actually changes. As you can see, this results in 4 logs:...
When resizing the component (eg. by resizing the window) for some time, the ResizeObserver spits out: `Error: ResizeObserver loop limit exceeded` Here's discussion and a potential solution for this issue:...
Closes #25 I think this closes #21 : after trying it on a `path` in an SVG element on my site it appears to be returning a sensical value
Closes #26 Closes #24 - I am unsure if the flow type is correct since I don’t use flow - I added `resize-observer-polyfill` as a dev dep since it's bundled...
Previously this would not error at compile time: ``` ts import useComponentSize from '@rehooks/component-size'; import React = require('react'); declare const ref: React.RefObject; // No error useComponentSize(ref); ``` With this change,...
Thanks for the hook implementation. [A concern about disconnect method](https://github.com/rehooks/component-size/blob/c0abcb9702f173cd5d52710af8604b29f2fbac17/index.js#L45): [MDN docs say](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/disconnect) that the `disconnect` method doesn't receive any parameters, it rather disconnects all the connected observers. A question...
Hi, This follows the exact example: https://github.com/rehooks/component-size/blob/master/example.js exactly, and it breaks when there's a 100% height, (as per the example) or 100vh . Works if we set an exact height...