diff options
author | Francesco <firefelix@gmail.com> | 2015-06-10 14:12:03 +0200 |
---|---|---|
committer | Francesco <firefelix@gmail.com> | 2015-06-10 14:21:06 +0200 |
commit | 393e800c8be43cef75303ac48ce8b43d535ca9f1 (patch) | |
tree | 677fc9b19acd18c322458a1652fc328c982f8c51 /lib/TextareaAutosize.js | |
parent | 4ce236995fc6bce4956e8316ddb824444fcada64 (diff) | |
download | react-autosize-textarea-393e800c8be43cef75303ac48ce8b43d535ca9f1.zip react-autosize-textarea-393e800c8be43cef75303ac48ce8b43d535ca9f1.tar.gz react-autosize-textarea-393e800c8be43cef75303ac48ce8b43d535ca9f1.tar.bz2 |
refactored repo structure using web-lib-seed. Fix #1
Diffstat (limited to 'lib/TextareaAutosize.js')
-rw-r--r-- | lib/TextareaAutosize.js | 25 |
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 ); } |