diff --git a/src/index.js b/src/index.js index 396fd633..ed9a626c 100755 --- a/src/index.js +++ b/src/index.js @@ -587,10 +587,13 @@ class ReactTooltip extends React.Component { } }; - clearTimeout(this.delayShowLoop); + if (this.delayShowLoop) { + clearTimeout(this.delayShowLoop); + } if (delayTime) { this.delayShowLoop = setTimeout(updateState, delayTime); } else { + this.delayShowLoop = null; updateState(); } } @@ -737,10 +740,22 @@ class ReactTooltip extends React.Component { * CLear all kinds of timeout of interval */ clearTimer() { - clearTimeout(this.delayShowLoop); - clearTimeout(this.delayHideLoop); - clearTimeout(this.delayReshow); - clearInterval(this.intervalUpdateContent); + if (this.delayShowLoop) { + clearTimeout(this.delayShowLoop); + this.delayShowLoop = null; + } + if (this.delayHideLoop) { + clearTimeout(this.delayHideLoop); + this.delayHideLoop = null; + } + if (this.delayReshow) { + clearTimeout(this.delayReshow); + this.delayReshow = null; + } + if (this.intervalUpdateContent) { + clearInterval(this.intervalUpdateContent); + this.intervalUpdateContent = null; + } } hasCustomColors() {