File tree Expand file tree Collapse file tree 3 files changed +5451
-5468
lines changed Expand file tree Collapse file tree 3 files changed +5451
-5468
lines changed Original file line number Diff line number Diff line change 124124 },
125125 "dependencies" : {
126126 "@babel/runtime" : " ^7.14.6" ,
127- "@reach/observe-rect" : " ^1.2.0" ,
128127 "@types/d3-array" : " ^3.0.1" ,
129128 "@types/d3-scale" : " ^4.0.1" ,
130129 "@types/d3-shape" : " ^3.0.1" ,
Original file line number Diff line number Diff line change 1- import observeRect from '@reach/observe-rect'
21import React from 'react'
32
43import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect'
@@ -39,14 +38,14 @@ export default function useRect(
3938 return
4039 }
4140
42- const observer = observeRect ( element as Element , ( newRect : DOMRect ) => {
43- setRect ( newRect )
41+ const observer = new ResizeObserver ( ( entries ) => {
42+ setRect ( entries [ 0 ] ?. contentRect )
4443 } )
4544
46- observer . observe ( )
45+ observer . observe ( element as Element )
4746
4847 return ( ) => {
49- observer . unobserve ( )
48+ observer . unobserve ( element as Element )
5049 }
5150 } , [ element , enabled ] )
5251
You can’t perform that action at this time.
0 commit comments