What I'm trying to achieve is a textarea that auto resizes when user continues to type or pastes a long text into text area.
This is what I have.
class TextArea extends InputBase {
render() {
const { label, placeholder, wrap, rows, cols, disabled, style, textStyle, textClass, value } = this.props;
return (
<div className={formClass} style={style}>
{!!label && (<label className="control-label" htmlFor={this.id}>{label}</label>)}
<textarea id={this.id} className={`form-control ${textClass}`} placeholder={placeholder} disabled={disabled} style={textStyle}
rows={rows} cols={cols} wrap={wrap} value={this.state.value || ''}
onChange={this.onChange} onBlur={this.onBlur} onFocus={this.onFocus} onKeyPress={this.onKeyPresses} onKeyUp={this.onKeyUp}>{value}</textarea>
</div>
);
}
}
Any suggestion for how I might be able to resize the textarea so it will expand according to the length of content in textarea.