diff --git a/packages/compose/README.md b/packages/compose/README.md index 6092aa98a0a09..626aa400c0ec5 100644 --- a/packages/compose/README.md +++ b/packages/compose/README.md @@ -406,6 +406,13 @@ _Returns_ Hook which allows to listen the resize event of any target element when it changes sizes. _Note: `useResizeObserver` will report `null` until after first render_ +Simply a re-export of `react-resize-aware` so refer to its documentation +for more details. + +_Related_ + +- + _Usage_ ```js @@ -421,10 +428,6 @@ const App = () => { }; ``` -_Returns_ - -- `Array`: An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height` - # **useThrottle** Throttles a function with Lodash's `throttle`. A new throttled function will diff --git a/packages/compose/src/hooks/use-resize-observer/index.js b/packages/compose/src/hooks/use-resize-observer/index.js index a46539e10438d..e992b57fa6b83 100644 --- a/packages/compose/src/hooks/use-resize-observer/index.js +++ b/packages/compose/src/hooks/use-resize-observer/index.js @@ -7,7 +7,10 @@ import useResizeAware from 'react-resize-aware'; * Hook which allows to listen the resize event of any target element when it changes sizes. * _Note: `useResizeObserver` will report `null` until after first render_ * - * @return {Array} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height` + * Simply a re-export of `react-resize-aware` so refer to its documentation + * for more details. + * + * @see https://github.com/FezVrasta/react-resize-aware * * @example * diff --git a/packages/compose/src/hooks/use-resize-observer/index.native.js b/packages/compose/src/hooks/use-resize-observer/index.native.js index 477b4b77d993b..981412b4f86e9 100644 --- a/packages/compose/src/hooks/use-resize-observer/index.native.js +++ b/packages/compose/src/hooks/use-resize-observer/index.native.js @@ -10,7 +10,7 @@ import { useState, useCallback } from '@wordpress/element'; /** * Hook which allows to listen the resize event of any target element when it changes sizes. * - * @return {Array} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height` + * @return {[JSX.Element, { width: number, height: number } | null]} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height` * * @example * diff --git a/packages/compose/tsconfig.json b/packages/compose/tsconfig.json index e2db3de66affc..ce10937541992 100644 --- a/packages/compose/tsconfig.json +++ b/packages/compose/tsconfig.json @@ -19,11 +19,13 @@ "src/hooks/use-constrained-tabbing/**/*", "src/hooks/use-debounce/**/*", "src/hooks/use-instance-id/**/*", + "src/hooks/use-isomorphic-layout-effect/**/*", "src/hooks/use-focus-return/**/*", "src/hooks/use-previous/**/*", "src/hooks/use-media-query/**/*", "src/hooks/use-reduced-motion/**/*", "src/hooks/use-merge-refs/**/*", + "src/hooks/use-resize-observer/**/*", "src/utils/**/*" ] }