@reach/rect
Advanced tools
Comparing version 0.8.2 to 0.8.6
@@ -10,2 +10,3 @@ 'use strict'; | ||
var observeRect = _interopDefault(require('@reach/observe-rect')); | ||
var utils = require('@reach/utils'); | ||
@@ -71,3 +72,3 @@ /** | ||
var observerRef = react.useRef(null); | ||
react.useLayoutEffect(function () { | ||
utils.useIsomorphicLayoutEffect(function () { | ||
var cleanup = function cleanup() { | ||
@@ -74,0 +75,0 @@ observerRef.current && observerRef.current.unobserve(); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("prop-types");var r,t=(r=require("@reach/observe-rect"))&&"object"==typeof r&&"default"in r?r.default:r,u=function(r){var t=r.onChange,u=r.observe,c=void 0===u||u,o=r.children,s=e.useRef(null);return o({ref:s,rect:n(s,c,t)})};function n(r,u,n){void 0===u&&(u=!0);var c=e.useRef(!1),o=e.useState(null),s=o[0],f=o[1],a=e.useRef(null);return e.useLayoutEffect((function(){var e=function(){a.current&&a.current.unobserve()};return r.current?(a.current||(a.current=t(r.current,(function(e){n&&n(e),f(e)}))),c.current||(c.current=!0,f(r.current.getBoundingClientRect())),u&&a.current.observe(),e):(console.warn("You need to place the ref"),e)}),[u,n]),s}exports.Rect=u,exports.default=u,exports.useRect=n; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("prop-types");var r,t=(r=require("@reach/observe-rect"))&&"object"==typeof r&&"default"in r?r.default:r,u=require("@reach/utils"),n=function(r){var t=r.onChange,u=r.observe,n=void 0===u||u,o=r.children,s=e.useRef(null);return o({ref:s,rect:c(s,n,t)})};function c(r,n,c){void 0===n&&(n=!0);var o=e.useRef(!1),s=e.useState(null),i=s[0],a=s[1],f=e.useRef(null);return u.useIsomorphicLayoutEffect((function(){var e=function(){f.current&&f.current.unobserve()};return r.current?(f.current||(f.current=t(r.current,(function(e){c&&c(e),a(e)}))),o.current||(o.current=!0,a(r.current.getBoundingClientRect())),n&&f.current.observe(),e):(console.warn("You need to place the ref"),e)}),[n,c]),i}exports.Rect=n,exports.default=n,exports.useRect=c; | ||
//# sourceMappingURL=rect.cjs.production.min.js.map |
@@ -1,4 +0,5 @@ | ||
import { useRef, useState, useLayoutEffect } from 'react'; | ||
import { useRef, useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import observeRect from '@reach/observe-rect'; | ||
import { useIsomorphicLayoutEffect } from '@reach/utils'; | ||
@@ -64,3 +65,3 @@ /** | ||
var observerRef = useRef(null); | ||
useLayoutEffect(function () { | ||
useIsomorphicLayoutEffect(function () { | ||
var cleanup = function cleanup() { | ||
@@ -67,0 +68,0 @@ observerRef.current && observerRef.current.unobserve(); |
{ | ||
"name": "@reach/rect", | ||
"version": "0.8.2", | ||
"version": "0.8.6", | ||
"description": "Measure React elements position in the DOM", | ||
@@ -19,2 +19,3 @@ "author": "React Training <hello@reacttraining.com>", | ||
"@reach/observe-rect": "^1.0.5", | ||
"@reach/utils": "^0.8.6", | ||
"prop-types": "^15.7.2", | ||
@@ -34,3 +35,3 @@ "tslib": "^1.10.0" | ||
], | ||
"gitHead": "ed24a5bb43a87adc36179283ca1de2c5af4ea26e" | ||
"gitHead": "0c71a018a11055b17815f0fb127cdcd981cd760e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
28332
249
6
+ Added@reach/utils@^0.8.6
+ Added@reach/utils@0.8.6(transitive)
+ Addedwarning@4.0.3(transitive)