Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-measure

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-measure - npm Package Compare versions

Comparing version 0.5.1 to 1.0.0

11

CHANGELOG.md
## CHANGELOG
### 1.0.0
Update get-node-dimensions to 1.0.0
`accurate` renamed to `useClone`
Added `cloneOptions` prop that gets passed to `getNodeDimensions`
Fixed build to not include `get-node-dimensions` library
Removed bower support
### 0.5.1

@@ -3,0 +14,0 @@ Use properties instead of constructor

127

dist/react-measure.js
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("React"), require("ReactDOM"), require("elementResizeDetectorMaker"));
module.exports = factory(require("react"), require("react-dom"), require("element-resize-detector"), require("get-node-dimensions"));
else if(typeof define === 'function' && define.amd)
define(["React", "ReactDOM", "elementResizeDetectorMaker"], factory);
define(["react", "react-dom", "element-resize-detector", "get-node-dimensions"], factory);
else if(typeof exports === 'object')
exports["Measure"] = factory(require("React"), require("ReactDOM"), require("elementResizeDetectorMaker"));
exports["Measure"] = factory(require("react"), require("react-dom"), require("element-resize-detector"), require("get-node-dimensions"));
else
root["Measure"] = factory(root["React"], root["ReactDOM"], root["elementResizeDetectorMaker"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_5__) {
root["Measure"] = factory(root["React"], root["ReactDOM"], root["elementResizeDetectorMaker"], root["getNodeDimensions"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_6__) {
return /******/ (function(modules) { // webpackBootstrap

@@ -82,5 +82,7 @@ /******/ // The module cache

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _get = function get(_x5, _x6, _x7) { var _again = true; _function: while (_again) { var object = _x5, property = _x6, receiver = _x7; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x5 = parent; _x6 = property; _x7 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -115,5 +117,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

value: {
accurate: _react.PropTypes.bool,
whitelist: _react.PropTypes.array,
blacklist: _react.PropTypes.array,
useClone: _react.PropTypes.bool,
cloneOptions: _react.PropTypes.object,
shouldMeasure: _react.PropTypes.bool,

@@ -126,5 +129,6 @@ onMeasure: _react.PropTypes.func

value: {
accurate: false,
whitelist: ['width', 'height', 'top', 'right', 'bottom', 'left'],
blacklist: [],
useClone: false,
cloneOptions: {},
shouldMeasure: true,

@@ -146,3 +150,3 @@ onMeasure: function onMeasure() {

this.measure = function () {
var accurate = arguments.length <= 0 || arguments[0] === undefined ? _this.props.accurate : arguments[0];
var useClone = arguments.length <= 0 || arguments[0] === undefined ? _this.props.useClone : arguments[0];

@@ -152,3 +156,3 @@ // bail out if we shouldn't measure

var dimensions = _this.getDimensions(_this._node, accurate);
var dimensions = _this.getDimensions(_this._node, useClone);
var isChildFunction = typeof _this.props.children === 'function';

@@ -221,6 +225,8 @@

key: 'getDimensions',
value: function getDimensions(node, clone) {
if (node === undefined) node = this._node;
value: function getDimensions() {
var node = arguments.length <= 0 || arguments[0] === undefined ? this._node : arguments[0];
var useClone = arguments.length <= 1 || arguments[1] === undefined ? this.props.useClone : arguments[1];
var cloneOptions = arguments.length <= 2 || arguments[2] === undefined ? this.props.cloneOptions : arguments[2];
return (0, _getNodeDimensions2['default'])(node, { clone: clone });
return (0, _getNodeDimensions2['default'])(node, _extends({ clone: useClone }, cloneOptions));
}

@@ -302,99 +308,6 @@ }, {

/* 6 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = getNodeDimensions;
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
var _getCloneDimensions = __webpack_require__(7);
var _getCloneDimensions2 = _interopRequireDefault(_getCloneDimensions);
function getNodeDimensions(node) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var rect = node.getBoundingClientRect();
var width = rect.width;
var height = rect.height;
if (!width || !height || options.clone) {
rect = (0, _getCloneDimensions2['default'])(node, options);
width = rect.width;
height = rect.height;
}
return {
width: width,
height: height,
top: rect.top,
right: rect.right,
bottom: rect.bottom,
left: rect.left
};
}
module.exports = exports['default'];
/***/ },
/* 7 */
/***/ function(module, exports) {
'use strict';
module.exports = __WEBPACK_EXTERNAL_MODULE_6__;
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = getCloneDimensions;
function getCloneDimensions(node, options) {
var parentNode = node.parentNode;
var context = document.createElement('div');
var clone = node.cloneNode(true);
var style = getComputedStyle(clone);
var rect = {};
// give the node some context to measure off of
// no height and hidden overflow hide node copy
context.style.height = 0;
context.style.overflow = 'hidden';
// clean up any attributes that might cause a conflict with the original node
// i.e. inputs that should focus or submit data
clone.setAttribute('id', '');
clone.setAttribute('name', '');
// set props to get a true dimension calculation
clone.style.display = options.display || style.getPropertyValue('display');
if (style.getPropertyValue('width') !== '') {
clone.style.width = 'auto';
}
if (style.getPropertyValue('height') !== '') {
clone.style.height = 'auto';
}
// append copy to context
context.appendChild(clone);
// append context to DOM so we can measure
parentNode.appendChild(context);
// get accurate width and height
rect = clone.getBoundingClientRect();
// destroy clone
parentNode.removeChild(context);
return rect;
}
module.exports = exports['default'];
/***/ }

@@ -401,0 +314,0 @@ /******/ ])

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM"),require("elementResizeDetectorMaker")):"function"==typeof define&&define.amd?define(["React","ReactDOM","elementResizeDetectorMaker"],t):"object"==typeof exports?exports.Measure=t(require("React"),require("ReactDOM"),require("elementResizeDetectorMaker")):e.Measure=t(e.React,e.ReactDOM,e.elementResizeDetectorMaker)}(this,function(e,t,r){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="dist/",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=o(n);t["default"]=i["default"],e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,i=t,u=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,i);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(u)}var a=Object.getPrototypeOf(n);if(null===a)return;e=a,t=i,r=u,o=!0,s=a=void 0}},l=r(2),a=(o(l),r(3)),c=o(a),f=r(4),p=o(f),d=r(6),h=o(d),Measure=function(e){function Measure(e){var t=this;n(this,Measure),s(Object.getPrototypeOf(Measure.prototype),"constructor",this).call(this,e),this.measure=function(){var e=arguments.length<=0||void 0===arguments[0]?t.props.accurate:arguments[0];if(t.props.shouldMeasure){var r=t.getDimensions(t._node,e),o="function"==typeof t.props.children;t._propsToMeasure.some(function(e){if(r[e]!==t._lastDimensions[e])return t.props.onMeasure(r),o&&t.setState({dimensions:r}),t._lastDimensions=r,!0})}},this.state={dimensions:{}},this._node=null,this._propsToMeasure=this._getPropsToMeasure(e),this._lastDimensions={}}return i(Measure,e),u(Measure,null,[{key:"propTypes",value:{accurate:l.PropTypes.bool,whitelist:l.PropTypes.array,blacklist:l.PropTypes.array,shouldMeasure:l.PropTypes.bool,onMeasure:l.PropTypes.func},enumerable:!0},{key:"defaultProps",value:{accurate:!1,whitelist:["width","height","top","right","bottom","left"],blacklist:[],shouldMeasure:!0,onMeasure:function(){return null}},enumerable:!0}]),u(Measure,[{key:"componentDidMount",value:function(){var e=this;this._node=c["default"].findDOMNode(this),this.measure(),(0,p["default"])().listenTo(this._node,function(){return e.measure()})}},{key:"componentWillReceiveProps",value:function(e){var t=(e.config,e.whitelist),r=e.blacklist;this.props.whitelist===t&&this.props.blacklist===r||(this._propsToMeasure=this._getPropsToMeasure({whitelist:t,blacklist:r}))}},{key:"componentWillUnmount",value:function(){(0,p["default"])().removeAllListeners(this._node),(0,p["default"])().uninstall(this._node),this._node=null}},{key:"getDimensions",value:function(e,t){return void 0===e&&(e=this._node),(0,h["default"])(e,{clone:t})}},{key:"_getPropsToMeasure",value:function(e){var t=e.whitelist,r=e.blacklist;return t.filter(function(e){return r.indexOf(e)<0})}},{key:"render",value:function(){var e=this.props.children;return l.Children.only("function"==typeof e?e(this.state.dimensions):e)}}]),Measure}(l.Component);t["default"]=Measure,e.exports=t["default"]},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(){return s||(s=(0,u["default"])({strategy:"scroll"})),s}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var i=r(5),u=o(i),s=null;e.exports=t["default"]},function(e,t){e.exports=r},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=e.getBoundingClientRect(),o=r.width,n=r.height;return o&&n&&!t.clone||(r=(0,u["default"])(e,t),o=r.width,n=r.height),{width:o,height:n,top:r.top,right:r.right,bottom:r.bottom,left:r.left}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var i=r(7),u=o(i);e.exports=t["default"]},function(e,t){"use strict";function r(e,t){var r=e.parentNode,o=document.createElement("div"),n=e.cloneNode(!0),i=getComputedStyle(n),u={};return o.style.height=0,o.style.overflow="hidden",n.setAttribute("id",""),n.setAttribute("name",""),n.style.display=t.display||i.getPropertyValue("display"),""!==i.getPropertyValue("width")&&(n.style.width="auto"),""!==i.getPropertyValue("height")&&(n.style.height="auto"),o.appendChild(n),r.appendChild(o),u=n.getBoundingClientRect(),r.removeChild(o),u}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r,e.exports=t["default"]}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom"),require("element-resize-detector"),require("get-node-dimensions")):"function"==typeof define&&define.amd?define(["react","react-dom","element-resize-detector","get-node-dimensions"],t):"object"==typeof exports?exports.Measure=t(require("react"),require("react-dom"),require("element-resize-detector"),require("get-node-dimensions")):e.Measure=t(e.React,e.ReactDOM,e.elementResizeDetectorMaker,e.getNodeDimensions)}(this,function(e,t,o,n){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="dist/",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),i=n(r);t["default"]=i["default"],e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},u=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),l=function(e,t,o){for(var n=!0;n;){var r=e,i=t,s=o;n=!1,null===r&&(r=Function.prototype);var u=Object.getOwnPropertyDescriptor(r,i);if(void 0!==u){if("value"in u)return u.value;var l=u.get;if(void 0===l)return;return l.call(s)}var a=Object.getPrototypeOf(r);if(null===a)return;e=a,t=i,o=s,n=!0,u=a=void 0}},a=o(2),c=(n(a),o(3)),p=n(c),f=o(4),d=n(f),h=o(6),v=n(h),Measure=function(e){function Measure(e){var t=this;r(this,Measure),l(Object.getPrototypeOf(Measure.prototype),"constructor",this).call(this,e),this.measure=function(){var e=arguments.length<=0||void 0===arguments[0]?t.props.useClone:arguments[0];if(t.props.shouldMeasure){var o=t.getDimensions(t._node,e),n="function"==typeof t.props.children;t._propsToMeasure.some(function(e){if(o[e]!==t._lastDimensions[e])return t.props.onMeasure(o),n&&t.setState({dimensions:o}),t._lastDimensions=o,!0})}},this.state={dimensions:{}},this._node=null,this._propsToMeasure=this._getPropsToMeasure(e),this._lastDimensions={}}return i(Measure,e),u(Measure,null,[{key:"propTypes",value:{whitelist:a.PropTypes.array,blacklist:a.PropTypes.array,useClone:a.PropTypes.bool,cloneOptions:a.PropTypes.object,shouldMeasure:a.PropTypes.bool,onMeasure:a.PropTypes.func},enumerable:!0},{key:"defaultProps",value:{whitelist:["width","height","top","right","bottom","left"],blacklist:[],useClone:!1,cloneOptions:{},shouldMeasure:!0,onMeasure:function(){return null}},enumerable:!0}]),u(Measure,[{key:"componentDidMount",value:function(){var e=this;this._node=p["default"].findDOMNode(this),this.measure(),(0,d["default"])().listenTo(this._node,function(){return e.measure()})}},{key:"componentWillReceiveProps",value:function(e){var t=(e.config,e.whitelist),o=e.blacklist;this.props.whitelist===t&&this.props.blacklist===o||(this._propsToMeasure=this._getPropsToMeasure({whitelist:t,blacklist:o}))}},{key:"componentWillUnmount",value:function(){(0,d["default"])().removeAllListeners(this._node),(0,d["default"])().uninstall(this._node),this._node=null}},{key:"getDimensions",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this._node:arguments[0],t=arguments.length<=1||void 0===arguments[1]?this.props.useClone:arguments[1],o=arguments.length<=2||void 0===arguments[2]?this.props.cloneOptions:arguments[2];return(0,v["default"])(e,s({clone:t},o))}},{key:"_getPropsToMeasure",value:function(e){var t=e.whitelist,o=e.blacklist;return t.filter(function(e){return o.indexOf(e)<0})}},{key:"render",value:function(){var e=this.props.children;return a.Children.only("function"==typeof e?e(this.state.dimensions):e)}}]),Measure}(a.Component);t["default"]=Measure,e.exports=t["default"]},function(t,o){t.exports=e},function(e,o){e.exports=t},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(){return u||(u=(0,s["default"])({strategy:"scroll"})),u}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var i=o(5),s=n(i),u=null;e.exports=t["default"]},function(e,t){e.exports=o},function(e,t){e.exports=n}])});

@@ -7,5 +7,7 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
var _get = function get(_x5, _x6, _x7) { var _again = true; _function: while (_again) { var object = _x5, property = _x6, receiver = _x7; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x5 = parent; _x6 = property; _x7 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

@@ -40,5 +42,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

value: {
accurate: _react.PropTypes.bool,
whitelist: _react.PropTypes.array,
blacklist: _react.PropTypes.array,
useClone: _react.PropTypes.bool,
cloneOptions: _react.PropTypes.object,
shouldMeasure: _react.PropTypes.bool,

@@ -51,5 +54,6 @@ onMeasure: _react.PropTypes.func

value: {
accurate: false,
whitelist: ['width', 'height', 'top', 'right', 'bottom', 'left'],
blacklist: [],
useClone: false,
cloneOptions: {},
shouldMeasure: true,

@@ -71,3 +75,3 @@ onMeasure: function onMeasure() {

this.measure = function () {
var accurate = arguments.length <= 0 || arguments[0] === undefined ? _this.props.accurate : arguments[0];
var useClone = arguments.length <= 0 || arguments[0] === undefined ? _this.props.useClone : arguments[0];

@@ -77,3 +81,3 @@ // bail out if we shouldn't measure

var dimensions = _this.getDimensions(_this._node, accurate);
var dimensions = _this.getDimensions(_this._node, useClone);
var isChildFunction = typeof _this.props.children === 'function';

@@ -146,6 +150,8 @@

key: 'getDimensions',
value: function getDimensions(node, clone) {
if (node === undefined) node = this._node;
value: function getDimensions() {
var node = arguments.length <= 0 || arguments[0] === undefined ? this._node : arguments[0];
var useClone = arguments.length <= 1 || arguments[1] === undefined ? this.props.useClone : arguments[1];
var cloneOptions = arguments.length <= 2 || arguments[2] === undefined ? this.props.cloneOptions : arguments[2];
return (0, _getNodeDimensions2['default'])(node, { clone: clone });
return (0, _getNodeDimensions2['default'])(node, _extends({ clone: useClone }, cloneOptions));
}

@@ -152,0 +158,0 @@ }, {

{
"name": "react-measure",
"version": "0.5.1",
"version": "1.0.0",
"description": "Compute measurements of React components.",
"main": "lib/react-measure.js",
"files": ["dist", "lib"],
"files": [
"dist",
"lib"
],
"scripts": {

@@ -42,3 +45,3 @@ "build": "npm run build:lib && NODE_ENV=production webpack --config webpack.prod.config.js",

"element-resize-detector": "^1.1.9",
"get-node-dimensions": "^0.1.1"
"get-node-dimensions": "^1.0.0"
},

@@ -45,0 +48,0 @@ "devDependencies": {

@@ -12,4 +12,2 @@ ## React Measure

`bower install react-measure --save`
```html

@@ -60,3 +58,3 @@ <script src="https://unpkg.com/react-measure/dist/react-measure.js"></script>

<Measure>
{dimensions =>
{ dimensions =>
<div>

@@ -76,6 +74,2 @@ {Object.keys(dimensions).map((dimension, i) =>

#### `accurate`: PropTypes.bool
Tries to give the most accurate measure by cloning the element and measuring it. Use if you your item is hidden or you want know to find out what height/width you need to get to.
#### `whitelist`: PropTypes.array

@@ -89,2 +83,10 @@

#### `useClone`: PropTypes.bool
Tries to give the most accurate measure by cloning the element and measuring it. Use if you your item is hidden or you want know to find out what height/width you need to get to.
#### `cloneOptions`: PropTypes.Object
Passes clone options to [getNodeDimensions](https://github.com/souporserious/get-node-dimensions).
#### `shouldMeasure`: PropTypes.bool

@@ -91,0 +93,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc