react-textarea-autosize
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -83,5 +83,14 @@ 'use strict'; | ||
// Re-render with the new content then recalculate the height as required. | ||
onNextFrame(this._resizeComponent); | ||
this.onNextFrameActionId = onNextFrame(this._resizeComponent); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
//remove any scheduled events to prevent manipulating the node after it's | ||
//been unmounted | ||
if (this.onNextFrameActionId) { | ||
clearNextFrameAction(this.onNextFrameActionId); | ||
} | ||
} | ||
}, { | ||
key: '_onChange', | ||
@@ -179,7 +188,14 @@ value: function _onChange(e) { | ||
if (window.requestAnimationFrame) { | ||
window.requestAnimationFrame(cb); | ||
return window.requestAnimationFrame(cb); | ||
} | ||
return window.setTimeout(cb, 1); | ||
} | ||
function clearNextFrameAction(nextFrameId) { | ||
if (window.cancelAnimationFrame) { | ||
window.cancelAnimationFrame(nextFrameId); | ||
} else { | ||
window.setTimeout(cb, 1); | ||
window.clearTimeout(nextFrameId); | ||
} | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "react-textarea-autosize", | ||
"description": "textarea component for React which grows with content", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Andrey Popp", |
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
27312
242