import * as React from "react"; import calculateNodeHeight, { purgeCache, } from "~/vendor/calculate-node-height"; const noop = () => {}; let uid = 0; export default class TextareaAutosize extends React.Component { static defaultProps = { inputRef: noop, onChange: noop, onHeightChange: noop, useCacheForDOMMeasurements: false, }; constructor(props) { super(props); this.state = { height: (props.style && props.style.height) || 0, minHeight: -Infinity, maxHeight: Infinity, }; this._uid = uid++; this._controlled = props.value !== undefined; this._resizeLock = false; } render() { const { inputRef, maxRows, minRows, onHeightChange, useCacheForDOMMeasurements, ...props } = this.props; props.style = { ...props.style, height: this.state.height }; const maxHeight = Math.max( props.style.maxHeight || Infinity, this.state.maxHeight ); if (maxHeight < this.state.height) { props.style.overflow = "hidden"; } return