react-textarea-autosize
Advanced tools
Comparing version 1.0.0 to 1.0.1
26
index.js
@@ -7,2 +7,10 @@ var React = require('react'); | ||
getInitialState: function() { | ||
if (this.props.onChange) { | ||
return { | ||
"_onChange": this.props.onChange | ||
}; | ||
} | ||
}, | ||
componentDidMount: function() { | ||
@@ -26,2 +34,12 @@ this.getDiffSize(); | ||
var styles = window.getComputedStyle(this.getDOMNode()); | ||
// If the textarea is set to border-box, it's not necessary to | ||
// subtract the padding. | ||
if (styles.getPropertyValue('box-sizing') === "border-box" || | ||
styles.getPropertyValue('-moz-box-sizing') === "border-box" || | ||
styles.getPropertyValue('-webkit-box-sizing') === "border-box") { | ||
this.diff = 0; | ||
return; | ||
} | ||
this.diff = ( | ||
@@ -44,4 +62,4 @@ parseInt(styles.getPropertyValue('padding-bottom') || 0, 10) + | ||
onChange: function(e) { | ||
if (this.props.onChange) { | ||
this.props.onChange(e); | ||
if (this.state._onChange) { | ||
this.state._onChange(e); | ||
} | ||
@@ -58,5 +76,3 @@ | ||
for (var key in this.props) { | ||
props[key] = this.props[key]; | ||
} | ||
props = objectAssign(this.props, props); | ||
@@ -63,0 +79,0 @@ return React.DOM.textarea(props, this.props.children); |
{ | ||
"name": "react-textarea-autosize", | ||
"description": "textarea component for React which grows with content", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Andrey Popp", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
62
0
5871