Use componentDidUpdate to update peers view dimensions

master
Torjus 2018-07-13 10:40:03 +02:00
parent 99ebaf4fab
commit 8c0d5036f9
1 changed files with 4 additions and 4 deletions

View File

@ -23,9 +23,9 @@ class Peers extends React.Component
this.updateDimensions(); this.updateDimensions();
} }
updateDimensions(props = this.props) updateDimensions()
{ {
const n = props.videoStreams ? props.videoStreams : 0; const n = this.props.videoStreams ? this.props.videoStreams : 0;
if (n == 0) if (n == 0)
{ {
@ -72,9 +72,9 @@ class Peers extends React.Component
window.removeEventListener('resize', this.resizeUpdate.bind(this)); window.removeEventListener('resize', this.resizeUpdate.bind(this));
} }
componentWillReceiveProps(nextProps) componentDidUpdate()
{ {
this.updateDimensions(nextProps); this.updateDimensions();
} }
render() render()