react-input-autosize
react-input-autosize copied to clipboard
Does not update when input element is hidden on first render
When the input element is hidden on first render (e.g. a parent element has display: none set), then the computed size of the sizer element is "auto" instead of "123px", and the input does not notice when it gets shown, it is only updated after it is rerendered
Somewhat hacky, but this can be fixed by adding a resize observer watching the size of the input
if (this.input.current)
new ResizeObserver(() => this.updateInputWidth()).observe(
this.input.current,
)
to the componentDidMount function