Skip to content

Commit 32cbf2d

Browse files
committed
fix: always add mouseover/mouseout listeners
just prefer props.visible if specified
1 parent cffb9ee commit 32cbf2d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/tooltip.jsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ class Tooltip extends Component {
3030
render () {
3131
const child = Children.only(this.props.children)
3232

33-
const actionProps = this.props.visible == null ? {
34-
onMouseOver: (...args) => {
35-
child.props.onMouseOver && child.props.onMouseOver(...args)
36-
this.setState({ shouldShow: true })
37-
},
38-
onMouseOut: (...args) => {
39-
child.props.onMouseOut && child.props.onMouseOut(...args)
40-
this.setState({ shouldShow: false })
41-
},
42-
} : {}
43-
4433
return (
4534
<span className={this.props.wrapperClassName}>
4635
{cloneElement(child, {
@@ -50,7 +39,14 @@ class Tooltip extends Component {
5039
child.ref(node)
5140
}
5241
},
53-
...actionProps,
42+
onMouseOver: (...args) => {
43+
child.props.onMouseOver && child.props.onMouseOver(...args)
44+
this.setState({ shouldShow: true })
45+
},
46+
onMouseOut: (...args) => {
47+
child.props.onMouseOut && child.props.onMouseOut(...args)
48+
this.setState({ shouldShow: false })
49+
},
5450
})}
5551
{this._popper()}
5652
</span>

0 commit comments

Comments
 (0)