From 4370bd5002f9fa2cdf302447a84a66e3ead6618e Mon Sep 17 00:00:00 2001 From: Kazato Sugimoto Date: Wed, 2 Sep 2015 17:48:36 +0900 Subject: [PATCH] Avoid infinite loop caused by a bug in Safari --- lib/AutosizeInput.js | 2 +- src/AutosizeInput.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/AutosizeInput.js b/lib/AutosizeInput.js index 001455f..d9574dc 100644 --- a/lib/AutosizeInput.js +++ b/lib/AutosizeInput.js @@ -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 }); diff --git a/src/AutosizeInput.js b/src/AutosizeInput.js index b089d0b..037fbd6 100644 --- a/src/AutosizeInput.js +++ b/src/AutosizeInput.js @@ -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 });