mirror of
https://github.com/nickzuber/meteorite.git
synced 2024-09-11 11:36:03 +03:00
Improve tooltip being unmounted
This commit is contained in:
parent
38f5db20a3
commit
71c45adb98
@ -53,7 +53,7 @@ class Tooltip extends React.Component {
|
||||
}, 500);
|
||||
}
|
||||
|
||||
onMouseLeave = () => {
|
||||
removeTooltip = () => {
|
||||
clearTimeout(this.timeout);
|
||||
const tooltipElement = this.getTooltipElement();
|
||||
if (tooltipElement) {
|
||||
@ -64,7 +64,8 @@ class Tooltip extends React.Component {
|
||||
render () {
|
||||
return this.props.children({
|
||||
onMouseEnter: this.onMouseEnter,
|
||||
onMouseLeave: this.onMouseLeave,
|
||||
onMouseLeave: this.removeTooltip,
|
||||
onMouseDown: this.removeTooltip,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -73,7 +74,8 @@ export const withTooltip = WrappedComponent => ({tooltip, tooltipOffsetX, toolti
|
||||
<Tooltip
|
||||
message={tooltip}
|
||||
tooltipOffsetX={tooltipOffsetX}
|
||||
tooltipOffsetY={tooltipOffsetY}>
|
||||
tooltipOffsetY={tooltipOffsetY}
|
||||
>
|
||||
{mouseEvents => tooltip ? (
|
||||
<WrappedComponent {...props} {...mouseEvents} />
|
||||
) : (
|
||||
|
Loading…
Reference in New Issue
Block a user