Skip to content

Commit

Permalink
Trigger textarea resize when value changes
Browse files Browse the repository at this point in the history
e.g. after clearing dones input
  • Loading branch information
aduth committed Dec 13, 2017
1 parent 9fd6574 commit 609772b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/autosize-textarea/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ export default class AutosizeTextarea extends Component {
this.resize();
}

componentDidUpdate( prevProps ) {
if ( this.props.value !== prevProps.value ) {
this.resize();
}
}

resize = () => {
const { base } = this;
base.style.height = '0';
Expand Down

0 comments on commit 609772b

Please sign in to comment.