react-measure
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -152,7 +152,2 @@ 'use strict'; | ||
_this._window = getWindowOf(_this._node); | ||
if (_this._resizeObserver !== null && _this._node !== null) { | ||
_this._resizeObserver.observe(_this._node); | ||
} | ||
var innerRef = _this.props.innerRef; | ||
@@ -167,2 +162,6 @@ | ||
} | ||
if (_this._resizeObserver !== null && _this._node !== null) { | ||
_this._resizeObserver.observe(_this._node); | ||
} | ||
}; | ||
@@ -169,0 +168,0 @@ |
@@ -146,7 +146,2 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
_this._window = getWindowOf(_this._node); | ||
if (_this._resizeObserver !== null && _this._node !== null) { | ||
_this._resizeObserver.observe(_this._node); | ||
} | ||
var innerRef = _this.props.innerRef; | ||
@@ -161,2 +156,6 @@ | ||
} | ||
if (_this._resizeObserver !== null && _this._node !== null) { | ||
_this._resizeObserver.observe(_this._node); | ||
} | ||
}; | ||
@@ -163,0 +162,0 @@ |
@@ -1209,7 +1209,2 @@ (function (global, factory) { | ||
_this._window = getWindowOf$1(_this._node); | ||
if (_this._resizeObserver !== null && _this._node !== null) { | ||
_this._resizeObserver.observe(_this._node); | ||
} | ||
var innerRef = _this.props.innerRef; | ||
@@ -1224,2 +1219,6 @@ | ||
} | ||
if (_this._resizeObserver !== null && _this._node !== null) { | ||
_this._resizeObserver.observe(_this._node); | ||
} | ||
}; | ||
@@ -1226,0 +1225,0 @@ |
{ | ||
"name": "react-measure", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Compute measurements of React components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -92,2 +92,18 @@ import React, { createRef } from 'react' | ||
}) | ||
it('should trigger onResize after setting innerRef', () => { | ||
const ref = createRef() | ||
let refOnResize = undefined; | ||
const onResize = () => refOnResize = ref.current | ||
render( | ||
<MeasureWith | ||
onResize={onResize} | ||
innerRef={ref} | ||
children={({ measureRef }) => <div id={'child'} ref={measureRef} />} | ||
/>, | ||
container | ||
) | ||
expect(refOnResize).not.toBe(null) | ||
expect(refOnResize.id).toBe('child') | ||
}) | ||
it('should trigger onResize when componentDidMount is called', () => { | ||
@@ -94,0 +110,0 @@ const onResize = jest.fn() |
@@ -93,6 +93,2 @@ import { Component, createElement } from 'react' | ||
if (this._resizeObserver !== null && this._node !== null) { | ||
this._resizeObserver.observe(this._node) | ||
} | ||
const { innerRef } = this.props | ||
@@ -106,2 +102,6 @@ if (innerRef) { | ||
} | ||
if (this._resizeObserver !== null && this._node !== null) { | ||
this._resizeObserver.observe(this._node) | ||
} | ||
} | ||
@@ -108,0 +108,0 @@ |
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
79601
1759