import React from 'react'; import { MessageType } from './Types'; export default class MessageInput extends React.Component { constructor(props) { super(props) this.resize = this.resize.bind(this); this.textarea = React.createRef(); } componentDidMount() { this.resize() } resize() { const el = this.textarea.current; const offset = el.offsetHeight - el.clientHeight; const height = el.scrollHeight + offset; el.style.height = `${height + offset}px`; } render() { const msg = this.props.data; return (
) } } const textInputStyle = { overflow: 'hidden', resize: 'none', display: 'block', boxSizing: 'border-box' } MessageInput.propTypes = { data: MessageType };