From e8b9d84c68e31a112d2ffcdfc5b322d4ec87ff8a Mon Sep 17 00:00:00 2001 From: Jimmy Harrison Date: Thu, 25 Feb 2021 22:10:29 -0500 Subject: [PATCH] fix: do not delay show if tooltip is already shown (#676) --- src/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index c396bf1a0..69b7d7abf 100755 --- a/src/index.js +++ b/src/index.js @@ -539,7 +539,6 @@ class ReactTooltip extends React.Component { const { delayShow, disable } = this.state; const { afterShow } = this.props; const placeholder = this.getTooltipContent(); - const delayTime = parseInt(delayShow, 10); const eventTarget = e.currentTarget || e.target; // Check if the mouse is actually over the tooltip, if so don't hide the tooltip @@ -552,6 +551,8 @@ class ReactTooltip extends React.Component { return; } + const delayTime = !this.state.show ? parseInt(delayShow, 10) : 0; + const updateState = () => { if ( (Array.isArray(placeholder) && placeholder.length > 0) || @@ -575,7 +576,7 @@ class ReactTooltip extends React.Component { }; clearTimeout(this.delayShowLoop); - if (delayShow) { + if (delayTime) { this.delayShowLoop = setTimeout(updateState, delayTime); } else { updateState();