Skip to content

Commit

Permalink
Merge pull request #102 from oluckyman/hideTooltip-timeout
Browse files Browse the repository at this point in the history
Clear hide timeout on component unmount
  • Loading branch information
wwayne committed May 14, 2016
2 parents d778981 + 77f4c2b commit 34aabd4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ReactTooltip extends Component {
isCapture: props.isCapture || false
}
this.delayShowLoop = null
this.delayHideLoop = null
}

/* Bind this with method */
Expand Down Expand Up @@ -103,6 +104,7 @@ class ReactTooltip extends Component {

componentWillUnmount () {
clearTimeout(this.delayShowLoop)
clearTimeout(this.delayHideLoop)
this.unbindListener()
this.removeScrollListener()
this.mount = false
Expand Down Expand Up @@ -312,7 +314,8 @@ class ReactTooltip extends Component {
hideTooltip () {
const {delayHide} = this.state
clearTimeout(this.delayShowLoop)
setTimeout(() => {
clearTimeout(this.delayHideLoop)
this.delayHideLoop = setTimeout(() => {
this.setState({
show: false
})
Expand Down

0 comments on commit 34aabd4

Please sign in to comment.