Skip to content

Releases: maslianok/react-resize-detector

v11.0.0

28 May 15:31
d46ada8
Compare
Choose a tag to compare

What's Changed

⚠️ Migration guide

  • The onResize function now receives a single object. Destructure width and height parameters as follows:
- onResize: (width, height) => {
+ onResize: ({ width, height, entry }) => {
    if (width && height) {
        ...
    }
}

When the element is mounted, width and height will always be numbers. When unmounted, they will be null.
Ensure to add null checks before accessing element dimensions to address TypeScript errors.

Note that entry, a ResizeObserverEntry triggered by ResizeObserver, is now accessible. This provides access to borderBoxSize, contentBoxSize, and target, useful for custom logic or calculating border/padding size.
Refer to the ResizeObserverEntry documentation.

  • If observerOptions.box is set to border-box, the returned width and height from the useResizeDetector hook will include the padding and border size of the element. Default behavior remains unchanged - padding and border size are not included.

  • Rename ReactResizeDetectorDimensions to Dimensions

- import type { ReactResizeDetectorDimensions } from "react-resize-detector/build/types/types"
+ import type { Dimensions } from "react-resize-detector"

Full Changelog: v10.0.0...v11.0.0

v10.0.0

13 Jan 16:10
4b60055
Compare
Choose a tag to compare

⚠️ Breaking Changes

v10.0.0-beta.2

12 Jan 08:21
3e792f8
Compare
Choose a tag to compare

v10.0.0-beta.1

04 Jan 15:06
5996935
Compare
Choose a tag to compare
v10.0.0-beta.1 Pre-release
Pre-release

What's Changed

  • Fix ref .current set by using a proxy by @hugo-vrijswijk in #249
  • Update dependencies
  • Remove unused ChildFunctionProps type export

New Contributors

Full Changelog: v9.1.1...v10.0.0-beta.1

v9.1.2-beta.0

04 Jan 14:58
5996935
Compare
Choose a tag to compare
v9.1.2-beta.0 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v9.1.1...v9.1.2

v10.0.0-beta.0

23 Dec 11:08
Compare
Choose a tag to compare
v10.0.0-beta.0 Pre-release
Pre-release

We've streamlined the library by eliminating all methods except hooks.
Starting from this version the useResizeObserver hook is the only way to attach the observer.

v9.1.1

23 Dec 11:05
Compare
Choose a tag to compare
  • fix useResizeDetector in React StrictMode #247

v9.1.0

09 Apr 13:38
Compare
Choose a tag to compare

useResizeDetector performance optimization and refactoring.
No API changes.

v9.0.0

08 Apr 18:17
Compare
Choose a tag to compare

This version introduces a new logic for the useResizeDetector hook.
The hook now stores the ref in the internal state, allowing us to handle ref changes.

There should be no breaking changes.
Now it's safe to delete refreshMode="debounce" refreshRate={0} props that many of you used as a workaround.

v8.0.4

18 Feb 13:49
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v8.0.3...v8.0.4