summaryrefslogtreecommitdiffstats
path: root/lib/TextareaAutosize.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/TextareaAutosize.js')
-rw-r--r--lib/TextareaAutosize.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/TextareaAutosize.js b/lib/TextareaAutosize.js
index f4ab8ff..07d447b 100644
--- a/lib/TextareaAutosize.js
+++ b/lib/TextareaAutosize.js
@@ -1,38 +1,41 @@
'use strict';
-const React = require('react'),
- autosize = require('autosize');
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-const TextareaAutosize = React.createClass({
+var React = require('react'),
+ autosize = require('autosize');
+
+var TextareaAutosize = React.createClass({
+ displayName: 'TextareaAutosize',
propTypes: {
onResize: React.PropTypes.func
},
- getDefaultProps() {
+ getDefaultProps: function getDefaultProps() {
return {
rows: 1
};
},
- componentDidMount() {
+ componentDidMount: function componentDidMount() {
autosize(this.refs.textarea.getDOMNode());
if (this.props.onResize) {
this.refs.textarea.getDOMNode().addEventListener('autosize:resized', this.props.onResize);
}
},
- componentWillUnmount() {
+ componentWillUnmount: function componentWillUnmount() {
if (this.props.onResize) {
this.refs.textarea.getDOMNode().removeEventListener('autosize:resized');
}
},
- render() {
- return (
- <textarea {...this.props} ref='textarea'>
- {this.props.children}
- </textarea>
+ render: function render() {
+ return React.createElement(
+ 'textarea',
+ _extends({}, this.props, { ref: 'textarea' }),
+ this.props.children
);
}