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

Commit 2ffca3c

Browse files
committed
Fixes #78 onHide being called before onShow
1 parent 5156ef8 commit 2ffca3c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ContextMenu.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class ContextMenu extends Component {
8181
}
8282

8383
handleShow = (e) => {
84-
if (e.detail.id !== this.props.id) return;
84+
if (e.detail.id !== this.props.id || this.state.isVisible) return;
8585

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

@@ -91,9 +91,11 @@ export default class ContextMenu extends Component {
9191
}
9292

9393
handleHide = (e) => {
94-
this.unregisterHandlers();
95-
this.setState({isVisible: false});
96-
callIfExists(this.props.onHide, e);
94+
if (this.state.isVisible) {
95+
this.unregisterHandlers();
96+
this.setState({isVisible: false});
97+
callIfExists(this.props.onHide, e);
98+
}
9799
}
98100

99101
handleEscape = (e) => {

0 commit comments

Comments
 (0)