#305: re-measure height on window resize

This commit is contained in:
SleepWalker 2017-10-23 22:41:11 +03:00
parent b9dcbf8647
commit b032cef120

View File

@ -37,6 +37,7 @@ export default class MeasureHeight extends PureComponent<{
componentDidMount() { componentDidMount() {
this.measure(); this.measure();
window.addEventListener('resize', this.measure);
} }
componentDidUpdate(prevProps: typeof MeasureHeight.prototype.props) { componentDidUpdate(prevProps: typeof MeasureHeight.prototype.props) {
@ -45,6 +46,10 @@ export default class MeasureHeight extends PureComponent<{
} }
} }
componentWillUnmount() {
window.removeEventListener('resize', this.measure);
}
render() { render() {
const props: Object = omit(this.props, [ const props: Object = omit(this.props, [
'shouldMeasure', 'shouldMeasure',