Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Commit

Permalink
Fixes #78 onHide being called before onShow
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbansal committed Feb 18, 2017
1 parent 5156ef8 commit 2ffca3c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class ContextMenu extends Component {
}

handleShow = (e) => {
if (e.detail.id !== this.props.id) return;
if (e.detail.id !== this.props.id || this.state.isVisible) return;

const { x, y } = e.detail.position;

Expand All @@ -91,9 +91,11 @@ export default class ContextMenu extends Component {
}

handleHide = (e) => {
this.unregisterHandlers();
this.setState({isVisible: false});
callIfExists(this.props.onHide, e);
if (this.state.isVisible) {
this.unregisterHandlers();
this.setState({isVisible: false});
callIfExists(this.props.onHide, e);
}
}

handleEscape = (e) => {
Expand Down

0 comments on commit 2ffca3c

Please sign in to comment.