Skip to content

Commit

Permalink
Never update inputWidth state ifautoresize is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
i-like-robots committed Feb 18, 2019
1 parent afdc62f commit d632d6a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ class Input extends React.Component {
}

updateInputWidth () {
let inputWidth

if (this.props.autoresize) {
// scrollWidth is designed to be fast not accurate.
// +2 is completely arbitrary but does the job.
inputWidth = Math.ceil(this.sizer.scrollWidth) + 2
if (!this.props.autoresize) {
return
}

// scrollWidth is designed to be fast not accurate.
// +2 is completely arbitrary but does the job.
const inputWidth = Math.ceil(this.sizer.scrollWidth) + 2

if (inputWidth !== this.state.inputWidth) {
this.setState({ inputWidth })
}
Expand Down

0 comments on commit d632d6a

Please sign in to comment.