react-fluid-textarea
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -38,5 +38,4 @@ 'use strict'; | ||
_this.setState({ scrollHeight: 0 }, function () { | ||
_this.setState({ scrollHeight: _this.textarea.scrollHeight }); | ||
}); | ||
_this.textarea.style.height = 'auto'; | ||
_this.setState({ height: _this.textarea.scrollHeight }); | ||
@@ -57,2 +56,7 @@ (_this$props = _this.props).onInput.apply(_this$props, arguments); | ||
_createClass(ResizableTextArea, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.setState({ height: this.textarea.scrollHeight }); | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -62,3 +66,3 @@ value: function render() { | ||
lineHeight: '1.5em', | ||
height: this.state.scrollHeight, | ||
height: this.state.height, | ||
overflowY: 'hidden' | ||
@@ -80,6 +84,8 @@ }); | ||
ref: Function.prototype, | ||
onInput: Function.prototype | ||
onInput: Function.prototype, | ||
style: null | ||
}; | ||
ResizableTextArea.propTypes = { | ||
style: _propTypes2.default.object, | ||
ref: _propTypes2.default.func, | ||
@@ -86,0 +92,0 @@ onInput: _propTypes2.default.func |
{ | ||
"name": "react-fluid-textarea", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Automatically resizes your text area to the amount you type.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -10,6 +10,8 @@ import React from 'react'; | ||
} | ||
componentDidMount() { | ||
this.setState({ height: this.textarea.scrollHeight }); | ||
} | ||
onInput = (...args) => { | ||
this.setState({ scrollHeight: 0 }, () => { | ||
this.setState({ scrollHeight: this.textarea.scrollHeight }); | ||
}); | ||
this.textarea.style.height = 'auto'; | ||
this.setState({ height: this.textarea.scrollHeight }); | ||
@@ -27,3 +29,3 @@ this.props.onInput(...args); | ||
lineHeight: '1.5em', | ||
height: this.state.scrollHeight, | ||
height: this.state.height, | ||
overflowY: 'hidden', | ||
@@ -46,5 +48,7 @@ }; | ||
onInput: Function.prototype, | ||
style: null, | ||
}; | ||
ResizableTextArea.propTypes = { | ||
style: PropTypes.object, | ||
ref: PropTypes.func, | ||
@@ -51,0 +55,0 @@ onInput: PropTypes.func, |
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
7715
113