rc-resize-observer
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -31,2 +31,3 @@ import * as React from 'react'; | ||
onResize: ResizeObserverCallback; | ||
setChildNode: (node: RefNode) => void; | ||
destroyObserver(): void; | ||
@@ -33,0 +34,0 @@ render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactElement<unknown, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>[] | null; |
@@ -49,4 +49,8 @@ "use strict"; | ||
var ref_1 = require("rc-util/lib/ref"); | ||
var resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill")); | ||
var util_1 = require("./util"); | ||
var INTERNAL_PREFIX_KEY = 'rc-observer-key'; // Still need to be compatible with React 15, we use class component here | ||
@@ -104,2 +108,6 @@ | ||
_this.setChildNode = function (node) { | ||
_this.childNode = node; | ||
}; | ||
return _this; | ||
@@ -158,4 +166,2 @@ } | ||
value: function render() { | ||
var _this2 = this; | ||
var children = this.props.children; | ||
@@ -173,20 +179,6 @@ var childNodes = toArray_1.default(children); | ||
if (React.isValidElement(childNode)) { | ||
var _ref = childNode.ref; | ||
if (React.isValidElement(childNode) && util_1.supportRef(childNode)) { | ||
var ref = childNode.ref; | ||
childNodes[0] = React.cloneElement(childNode, { | ||
ref: function ref(node) { | ||
_this2.childNode = node; // Should forward ref | ||
if (!_ref) { | ||
return; | ||
} | ||
var type = _typeof(_ref); | ||
if (type === 'function') { | ||
_ref(node); | ||
} else if (type === 'object') { | ||
_ref.current = node; | ||
} | ||
} | ||
ref: ref_1.composeRef(ref, this.setChildNode) | ||
}); | ||
@@ -193,0 +185,0 @@ } |
@@ -31,2 +31,3 @@ import * as React from 'react'; | ||
onResize: ResizeObserverCallback; | ||
setChildNode: (node: RefNode) => void; | ||
destroyObserver(): void; | ||
@@ -33,0 +34,0 @@ render(): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | React.ReactElement<unknown, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>[] | null; |
@@ -49,4 +49,8 @@ "use strict"; | ||
var ref_1 = require("rc-util/lib/ref"); | ||
var resize_observer_polyfill_1 = __importDefault(require("resize-observer-polyfill")); | ||
var util_1 = require("./util"); | ||
var INTERNAL_PREFIX_KEY = 'rc-observer-key'; // Still need to be compatible with React 15, we use class component here | ||
@@ -104,2 +108,6 @@ | ||
_this.setChildNode = function (node) { | ||
_this.childNode = node; | ||
}; | ||
return _this; | ||
@@ -158,4 +166,2 @@ } | ||
value: function render() { | ||
var _this2 = this; | ||
var children = this.props.children; | ||
@@ -173,20 +179,6 @@ var childNodes = toArray_1.default(children); | ||
if (React.isValidElement(childNode)) { | ||
var _ref = childNode.ref; | ||
if (React.isValidElement(childNode) && util_1.supportRef(childNode)) { | ||
var ref = childNode.ref; | ||
childNodes[0] = React.cloneElement(childNode, { | ||
ref: function ref(node) { | ||
_this2.childNode = node; // Should forward ref | ||
if (!_ref) { | ||
return; | ||
} | ||
var type = _typeof(_ref); | ||
if (type === 'function') { | ||
_ref(node); | ||
} else if (type === 'object') { | ||
_ref.current = node; | ||
} | ||
} | ||
ref: ref_1.composeRef(ref, this.setChildNode) | ||
}); | ||
@@ -193,0 +185,0 @@ } |
{ | ||
"name": "rc-resize-observer", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Resize observer for React", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
"classnames": "^2.2.1", | ||
"rc-util": "^4.11.1", | ||
"rc-util": "^4.13.0", | ||
"resize-observer-polyfill": "^1.5.1" | ||
@@ -46,0 +46,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
28157
14
518
Updatedrc-util@^4.13.0