Skip to content

Commit

Permalink
fix: lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
sangar-1028 committed May 23, 2023
1 parent 89c6fa9 commit 952a962
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/components/Hoverable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ class Hoverable extends Component {
document.addEventListener('touchmove', this.enableHover);
}

componentDidUpdate(prevProps) {
if (prevProps.disabled === this.props.disabled) {
return;
}

this.setState({isHovered: false});

if (this.props.disabled) {
this.disableHover();
} else {
this.enableHover();
}
}

componentWillUnmount() {
document.removeEventListener('touchstart', this.disableHover);
document.removeEventListener('touchmove', this.enableHover);
}

componentDidUpdate(prevProps) {
if (prevProps.disabled !== this.props.disabled) {
this.setState({isHovered: false});

if (this.props.disabled) {
this.disableHover();
} else {
this.enableHover();
}
}
}

/**
* Sets the hover state of this component to true and execute the onHoverIn callback.
*
Expand Down

0 comments on commit 952a962

Please sign in to comment.