Skip to content

Commit

Permalink
fixed hover bug
Browse files Browse the repository at this point in the history
  • Loading branch information
justinrhodes1 committed Feb 18, 2019
1 parent 199f8fd commit 10d2a1d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/Tooltip/index.js
Expand Up @@ -118,7 +118,7 @@ function (_Component) {
mount: true
});
if (!this.props.animation) this.setState({
mount: this.props.show
mount: false
});
/* eslint-disable */
}
Expand Down Expand Up @@ -268,11 +268,11 @@ function (_Component) {
margin: oneMovePropIsNeg ? adjustment : null,
animation: show ? "rpt-".concat(animation, " 0.2s") : "rpt-".concat(animation, "-out 0.15s")
});
return this.state.show && this.state.mount ? _react.default.createElement("div", {
return !animation && show || this.state.show && this.state.mount ? _react.default.createElement("div", {
className: classes.join(' '),
style: tooltipStyle,
onAnimationEnd: function onAnimationEnd() {
if (!show) _this3.setState({
if (!show && animation) _this3.setState({
mount: false
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-power-tooltip",
"version": "1.0.0",
"version": "1.0.1",
"description": "A powerful tooltip and menu component library for react.",
"main": "lib/index",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Tooltip/index.jsx
Expand Up @@ -43,7 +43,7 @@ class Tooltip extends Component {
/* eslint-disable */
if (!this.state.hasInitialized) this.setState({ show: this.props.show, hasInitialized: true });
if (this.props.show) this.setState({ mount: true });
if (!this.props.animation) this.setState({ mount: this.props.show });
if (!this.props.animation) this.setState({ mount: false });
/* eslint-disable */
}

Expand Down Expand Up @@ -185,11 +185,11 @@ class Tooltip extends Component {
animation: show ? `rpt-${animation} 0.2s` : `rpt-${animation}-out 0.15s`
};

return (this.state.show && this.state.mount) ? (
return ((!animation && show) || (this.state.show && this.state.mount)) ? (
<div
className={classes.join(' ')}
style={tooltipStyle}
onAnimationEnd={() => { if (!show) this.setState({ mount: false }) }}
onAnimationEnd={() => { if (!show && animation) this.setState({ mount: false }) }}
>
<div
style={{
Expand Down

0 comments on commit 10d2a1d

Please sign in to comment.