Releases: maslianok/react-resize-detector
v12.0.2
v12.0.0
v11.0.0
What's Changed
⚠️ Migration guide
- The
onResize
function now receives a single object. Destructurewidth
andheight
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 toborder-box
, the returnedwidth
andheight
from theuseResizeDetector
hook will include the padding and border size of the element. Default behavior remains unchanged - padding and border size are not included. -
Rename
ReactResizeDetectorDimensions
toDimensions
- 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
⚠️ Breaking Changes
- Beginning with version 10, the library supports the
useResizeObserver
hook only - Drop support for React 16 and 17
v10.0.0-beta.2
⚠️ Breaking Changes
What's Changed
- Cleanup example code
- Regenerate example dependencies using pnpm
- Remove outdated tests
- Update latest bundlephobia gzip size
- Update dev dependencies
- Add pnpm-lock.yaml to prettierignore
- Run prettier + lint-fix once
- Bump TS target to es6
Full Changelog: v10.0.0-beta.1...v10.0.0-beta.2
v10.0.0-beta.1
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
- @hugo-vrijswijk made their first contribution in #249
Full Changelog: v9.1.1...v10.0.0-beta.1
v9.1.2-beta.0
What's Changed
- Fix ref
.current
set by using a proxy by @hugo-vrijswijk in #249
New Contributors
- @hugo-vrijswijk made their first contribution in #249
Full Changelog: v9.1.1...v9.1.2
v10.0.0-beta.0
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.