signal-desktop/patches/react-tooltip-lite+1.12.0.patch
2020-07-30 13:27:41 -07:00

60 lines
2.2 KiB
Diff

diff --git a/node_modules/react-tooltip-lite/dist/index.js b/node_modules/react-tooltip-lite/dist/index.js
index 32ce07d..6461913 100644
--- a/node_modules/react-tooltip-lite/dist/index.js
+++ b/node_modules/react-tooltip-lite/dist/index.js
@@ -80,7 +80,7 @@ function (_React$Component) {
_this.state = {
showTip: false,
- hasHover: false,
+ hasHover: 0,
ignoreShow: false,
hasBeenShown: false
};
@@ -232,7 +232,7 @@ function (_React$Component) {
var _this3 = this;
this.setState({
- hasHover: false
+ hasHover: 0
});
if (this.state.showTip) {
@@ -250,7 +250,7 @@ function (_React$Component) {
value: function startHover() {
if (!this.state.ignoreShow) {
this.setState({
- hasHover: true
+ hasHover: (this.state.hasHover || 0) + 1,
});
clearTimeout(this.hoverTimeout);
this.hoverTimeout = setTimeout(this.checkHover, this.props.hoverDelay);
@@ -260,7 +260,7 @@ function (_React$Component) {
key: "endHover",
value: function endHover() {
this.setState({
- hasHover: false
+ hasHover: Math.max((this.state.hasHover || 0) - 1, 0),
});
clearTimeout(this.hoverTimeout);
this.hoverTimeout = setTimeout(this.checkHover, this.props.mouseOutDelay || this.props.hoverDelay);
@@ -268,7 +268,7 @@ function (_React$Component) {
}, {
key: "checkHover",
value: function checkHover() {
- this.state.hasHover ? this.showTip() : this.hideTip();
+ this.state.hasHover > 0 ? this.showTip() : this.hideTip();
}
}, {
key: "render",
@@ -330,7 +330,9 @@ function (_React$Component) {
props[eventToggle] = this.toggleTip; // only use hover if they don't have a toggle event
} else if (useHover && !isControlledByProps) {
props.onMouseEnter = this.startHover;
- props.onMouseLeave = tipContentHover || mouseOutDelay ? this.endHover : this.hideTip;
+ props.onMouseLeave = this.endHover;
+ props.onFocus = this.startHover;
+ props.onBlur = this.endHover;
props.onTouchStart = this.targetTouchStart;
props.onTouchEnd = this.targetTouchEnd;