Call for update on window resize.
This commit is contained in:
parent
c340032bd1
commit
738b59fd42
|
@ -24,6 +24,21 @@ export default class GenericElementContextMenu extends React.Component {
|
|||
element: PropTypes.element.isRequired,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.resize = this.resize.bind(this);
|
||||
window.addEventListener("resize", this.resize.bind(this));
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener("resize", this.resize.bind(this));
|
||||
}
|
||||
|
||||
resize() {
|
||||
if (this.props.onResize) {
|
||||
this.props.onResize();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div>{ this.props.element }</div>;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue