Skip to content

ResizeSensor 5.0 changes

Adi Dahiya edited this page Sep 29, 2021 · 1 revision

ResizeSensor in Blueprint v5.0 features some breaking changes compared to v4.0. Although you may not use this component directly, it is used in other components like Popover and Tooltip. To help you migrate to the new implementation, @blueprintjs/popover2 v4.x contains a new component called ResizeSensor2 (which, in turn, is used in Popover2).

⚠️ The breaking changes listed below apply to direct usage of <ResizeSensor2> and advanced Popover2/Tooltip2 usage via renderTarget (e.g. <Popover2 renderTarget={...}> and <Tooltip2 renderTarget={...}>). Standard usage of Popover2/Tooltip2 does not require any intervention since those components inject a ResizeSensor2-compatible wrapper DOM element for you.

  • The child of <ResizeSensor2> can only be a single DOM element or React component.
  • The child (target) of <ResizeSensor2> must be a native DOM element or utilize React.forwardRef() to forward any injected ref to the underlying DOM element.
    • In addition, if you attach a ref to the child yourself, you must pass the same value to <ResizeSensor2> with the targetRef prop (otherwise, the component won't be able to attach one itself).
Clone this wiki locally