Skip to content

Commit

Permalink
Avoid infinite loop caused by a bug in Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
uiur committed Sep 2, 2015
1 parent bb6e583 commit 4370bd5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/AutosizeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var AutosizeInput = React.createClass({
if (newInputWidth < this.props.minWidth) {
newInputWidth = this.props.minWidth;
}
if (newInputWidth !== this.state.inputWidth) {
if (Math.abs(newInputWidth - this.state.inputWidth) > 1) {
this.setState({
inputWidth: newInputWidth
});
Expand Down
2 changes: 1 addition & 1 deletion src/AutosizeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var AutosizeInput = React.createClass({
if (newInputWidth < this.props.minWidth) {
newInputWidth = this.props.minWidth;
}
if (newInputWidth !== this.state.inputWidth) {
if (Math.abs(newInputWidth - this.state.inputWidth) > 1) {
this.setState({
inputWidth: newInputWidth
});
Expand Down

0 comments on commit 4370bd5

Please sign in to comment.