Web: Components: fixed the display of the context-menu-button

This commit is contained in:
Nikita Gopienko 2020-08-21 16:19:09 +03:00
parent 76d48fabdd
commit 7982449828

View File

@ -60,11 +60,12 @@ class ContextMenuButton extends React.Component {
super(props);
this.ref = React.createRef();
const displayType = props.displayType === 'auto' ? this.getTypeByWidth() : props.displayType;
this.state = {
isOpen: props.opened,
data: props.data,
displayType: props.displayType
displayType
};
this.throttledResize = throttle(this.resize, 300);
}
@ -132,7 +133,8 @@ class ContextMenuButton extends React.Component {
}
onDropDownItemClick = (item, e) => {
item.onClick && item.onClick(e);
const open = this.state.displayType === "dropdown";
item.onClick && item.onClick(e, open);
this.toggle(!this.state.isOpen);
}