'use strict';
import React from 'react';
import TextareaAutosize from 'react-textarea-autosize';
let InputTextAreaToggable = React.createClass({
propTypes: {
editable: React.PropTypes.bool.isRequired,
rows: React.PropTypes.number.isRequired,
required: React.PropTypes.string,
defaultValue: React.PropTypes.string
},
getInitialState() {
return {
value: this.props.defaultValue
};
},
handleChange(event) {
this.setState({value: event.target.value});
this.props.onChange(event);
},
render() {
let className = 'form-control ascribe-textarea';
let textarea = null;
if (this.props.editable){
className = className + ' ascribe-textarea-editable';
textarea = (
{this.state.value}; } return textarea; } }); export default InputTextAreaToggable;