Skip to content

Commit e8b9d84

Browse files
authored
fix: do not delay show if tooltip is already shown (#676)
1 parent 336aecc commit e8b9d84

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ class ReactTooltip extends React.Component {
539539
const { delayShow, disable } = this.state;
540540
const { afterShow } = this.props;
541541
const placeholder = this.getTooltipContent();
542-
const delayTime = parseInt(delayShow, 10);
543542
const eventTarget = e.currentTarget || e.target;
544543

545544
// 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 {
552551
return;
553552
}
554553

554+
const delayTime = !this.state.show ? parseInt(delayShow, 10) : 0;
555+
555556
const updateState = () => {
556557
if (
557558
(Array.isArray(placeholder) && placeholder.length > 0) ||
@@ -575,7 +576,7 @@ class ReactTooltip extends React.Component {
575576
};
576577

577578
clearTimeout(this.delayShowLoop);
578-
if (delayShow) {
579+
if (delayTime) {
579580
this.delayShowLoop = setTimeout(updateState, delayTime);
580581
} else {
581582
updateState();

0 commit comments

Comments
 (0)