Skip to content

Commit

Permalink
fix: #759 - Disable tooltip when disable prop changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PanRagon committed Apr 12, 2022
1 parent 89429a9 commit 8e9cca0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8e9cca0

Please sign in to comment.