@reach/rect
Advanced tools
Comparing version 0.15.3 to 0.16.0
@@ -126,3 +126,6 @@ 'use strict'; | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
var observer; | ||
if (!observe) { | ||
return; | ||
} | ||
var elem = element; // State initializes before refs are placed, meaning the element state will | ||
@@ -143,15 +146,13 @@ // be undefined on the first render. We still want the rect on the first | ||
return cleanup; | ||
return; | ||
} | ||
observer = observeRect__default['default'](elem, function (rect) { | ||
var observer = observeRect__default['default'](elem, function (rect) { | ||
onChangeRef.current == null ? void 0 : onChangeRef.current(rect); | ||
setRect(rect); | ||
}); | ||
observe && observer.observe(); | ||
return cleanup; | ||
function cleanup() { | ||
observer && observer.unobserve(); | ||
} | ||
observer.observe(); | ||
return function () { | ||
observer.unobserve(); | ||
}; | ||
}, [observe, element, nodeRef]); | ||
@@ -158,0 +159,0 @@ return rect; |
@@ -100,3 +100,6 @@ 'use strict'; | ||
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(function () { | ||
var observer; | ||
if (!observe) { | ||
return; | ||
} | ||
var elem = element; // State initializes before refs are placed, meaning the element state will | ||
@@ -114,15 +117,13 @@ // be undefined on the first render. We still want the rect on the first | ||
return cleanup; | ||
return; | ||
} | ||
observer = observeRect__default['default'](elem, function (rect) { | ||
var observer = observeRect__default['default'](elem, function (rect) { | ||
onChangeRef.current == null ? void 0 : onChangeRef.current(rect); | ||
setRect(rect); | ||
}); | ||
observe && observer.observe(); | ||
return cleanup; | ||
function cleanup() { | ||
observer && observer.unobserve(); | ||
} | ||
observer.observe(); | ||
return function () { | ||
observer.unobserve(); | ||
}; | ||
}, [observe, element, nodeRef]); | ||
@@ -129,0 +130,0 @@ return rect; |
@@ -116,3 +116,6 @@ import { useRef, useEffect, useState } from 'react'; | ||
useIsomorphicLayoutEffect(function () { | ||
var observer; | ||
if (!observe) { | ||
return; | ||
} | ||
var elem = element; // State initializes before refs are placed, meaning the element state will | ||
@@ -133,15 +136,13 @@ // be undefined on the first render. We still want the rect on the first | ||
return cleanup; | ||
return; | ||
} | ||
observer = observeRect(elem, function (rect) { | ||
var observer = observeRect(elem, function (rect) { | ||
onChangeRef.current == null ? void 0 : onChangeRef.current(rect); | ||
setRect(rect); | ||
}); | ||
observe && observer.observe(); | ||
return cleanup; | ||
function cleanup() { | ||
observer && observer.unobserve(); | ||
} | ||
observer.observe(); | ||
return function () { | ||
observer.unobserve(); | ||
}; | ||
}, [observe, element, nodeRef]); | ||
@@ -148,0 +149,0 @@ return rect; |
{ | ||
"name": "@reach/rect", | ||
"version": "0.15.3", | ||
"version": "0.16.0", | ||
"description": "Measure React elements position in the DOM", | ||
@@ -17,3 +17,3 @@ "author": "React Training <hello@reacttraining.com>", | ||
"@reach/observe-rect": "1.2.0", | ||
"@reach/utils": "0.15.3", | ||
"@reach/utils": "0.16.0", | ||
"prop-types": "^15.7.2", | ||
@@ -42,3 +42,3 @@ "tiny-warning": "^1.0.3", | ||
], | ||
"gitHead": "aac3d3e1902ec32656476bcdccd7b56207384fcd" | ||
"gitHead": "e4c6093db14e3cc24c26794a002dbd8c866c0387" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
456
19810
+ Added@reach/utils@0.16.0(transitive)
- Removed@reach/utils@0.15.3(transitive)
Updated@reach/utils@0.16.0