From 738b59fd42e27f8290de878c360f98ab95c304e3 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Thu, 18 Jan 2018 12:01:29 +0000 Subject: [PATCH] Call for update on window resize. --- .../context_menus/GenericElementContextMenu.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/components/views/context_menus/GenericElementContextMenu.js b/src/components/views/context_menus/GenericElementContextMenu.js index 2959fbbe..0a8d2692 100644 --- a/src/components/views/context_menus/GenericElementContextMenu.js +++ b/src/components/views/context_menus/GenericElementContextMenu.js @@ -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
{ this.props.element }
; }