Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/components/Tooltip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ class Tooltip extends PureComponent {
this.showTooltip = this.showTooltip.bind(this);
this.hideTooltip = this.hideTooltip.bind(this);
this.updateBounds = this.updateBounds.bind(this);
this.isAnimationCanceled = React.createRef(false);
}

// eslint-disable-next-line rulesdir/prefer-early-return
componentDidUpdate(prevProps) {
// if the tooltip text changed before the initial animation was finished, then the tooltip won't be shown
// we need to show the tooltip again
if (this.state.isVisible && this.isAnimationCanceled.current && this.props.text && prevProps.text !== this.props.text) {
this.isAnimationCanceled.current = false;
this.showTooltip();
}
}

/**
Expand Down Expand Up @@ -86,7 +97,9 @@ class Tooltip extends PureComponent {
duration: 140,
delay: 500,
useNativeDriver: false,
}).start();
}).start(({finished}) => {
this.isAnimationCanceled.current = !finished;
});
}
TooltipSense.activate();
}
Expand Down