Skip to content

Commit 77f4c2b

Browse files
committed
Clear hide timeout on component unmount
1 parent d778981 commit 77f4c2b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class ReactTooltip extends Component {
7171
isCapture: props.isCapture || false
7272
}
7373
this.delayShowLoop = null
74+
this.delayHideLoop = null
7475
}
7576

7677
/* Bind this with method */
@@ -103,6 +104,7 @@ class ReactTooltip extends Component {
103104

104105
componentWillUnmount () {
105106
clearTimeout(this.delayShowLoop)
107+
clearTimeout(this.delayHideLoop)
106108
this.unbindListener()
107109
this.removeScrollListener()
108110
this.mount = false
@@ -312,7 +314,8 @@ class ReactTooltip extends Component {
312314
hideTooltip () {
313315
const {delayHide} = this.state
314316
clearTimeout(this.delayShowLoop)
315-
setTimeout(() => {
317+
clearTimeout(this.delayHideLoop)
318+
this.delayHideLoop = setTimeout(() => {
316319
this.setState({
317320
show: false
318321
})

0 commit comments

Comments
 (0)