From 8e9cca016f8eb59036c0c4623b85bf3f465ba262 Mon Sep 17 00:00:00 2001 From: PanRagon Date: Tue, 12 Apr 2022 11:57:04 +0200 Subject: [PATCH] fix: #759 - Disable tooltip when disable prop changes --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 96fb0f37e..fba327d7e 100755 --- a/src/index.js +++ b/src/index.js @@ -555,7 +555,7 @@ class ReactTooltip extends React.Component { */ updateTooltip(e) { const { delayShow, disable } = this.state; - const { afterShow } = this.props; + const { afterShow, disable: disableProp } = this.props; const placeholder = this.getTooltipContent(); const eventTarget = e.currentTarget || e.target; @@ -565,7 +565,7 @@ class ReactTooltip extends React.Component { } // if the tooltip is empty, disable the tooltip - if (this.isEmptyTip(placeholder) || disable) { + if (this.isEmptyTip(placeholder) || disable || disableProp) { return; } @@ -631,10 +631,10 @@ class ReactTooltip extends React.Component { const { disable } = this.state; const { isScroll } = options; const delayHide = isScroll ? 0 : this.state.delayHide; - const { afterHide } = this.props; + const { afterHide, disable: disableProp } = this.props; const placeholder = this.getTooltipContent(); if (!this.mount) return; - if (this.isEmptyTip(placeholder) || disable) return; // if the tooltip is empty, disable the tooltip + if (this.isEmptyTip(placeholder) || disable || disableProp) return; // if the tooltip is empty, disable the tooltip if (hasTarget) { // Don't trigger other elements belongs to other ReactTooltip const targetArray = this.getTargetArray(this.props.id);