Skip to content

Commit 8e9cca0

Browse files
author
PanRagon
committed
fix: #759 - Disable tooltip when disable prop changes
1 parent 89429a9 commit 8e9cca0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ class ReactTooltip extends React.Component {
555555
*/
556556
updateTooltip(e) {
557557
const { delayShow, disable } = this.state;
558-
const { afterShow } = this.props;
558+
const { afterShow, disable: disableProp } = this.props;
559559
const placeholder = this.getTooltipContent();
560560
const eventTarget = e.currentTarget || e.target;
561561

@@ -565,7 +565,7 @@ class ReactTooltip extends React.Component {
565565
}
566566

567567
// if the tooltip is empty, disable the tooltip
568-
if (this.isEmptyTip(placeholder) || disable) {
568+
if (this.isEmptyTip(placeholder) || disable || disableProp) {
569569
return;
570570
}
571571

@@ -631,10 +631,10 @@ class ReactTooltip extends React.Component {
631631
const { disable } = this.state;
632632
const { isScroll } = options;
633633
const delayHide = isScroll ? 0 : this.state.delayHide;
634-
const { afterHide } = this.props;
634+
const { afterHide, disable: disableProp } = this.props;
635635
const placeholder = this.getTooltipContent();
636636
if (!this.mount) return;
637-
if (this.isEmptyTip(placeholder) || disable) return; // if the tooltip is empty, disable the tooltip
637+
if (this.isEmptyTip(placeholder) || disable || disableProp) return; // if the tooltip is empty, disable the tooltip
638638
if (hasTarget) {
639639
// Don't trigger other elements belongs to other ReactTooltip
640640
const targetArray = this.getTargetArray(this.props.id);

0 commit comments

Comments
 (0)