ref(large-video): use componentDidUpdate to change background image
This commit is contained in:
parent
b24e7ec5f0
commit
85f487cca5
|
@ -117,17 +117,15 @@ export class LargeVideoBackground extends Component<Props> {
|
||||||
* Starts or stops the interval to update the image displayed in the canvas.
|
* Starts or stops the interval to update the image displayed in the canvas.
|
||||||
*
|
*
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
* @param {Object} nextProps - The read-only React {@code Component} props
|
|
||||||
* with which the new instance is to be initialized.
|
|
||||||
*/
|
*/
|
||||||
componentWillReceiveProps(nextProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
if (this.props.hidden && !nextProps.hidden) {
|
if (prevProps.hidden && !this.props.hidden) {
|
||||||
this._clearCanvas();
|
this._clearCanvas();
|
||||||
this._setUpdateCanvasInterval();
|
this._setUpdateCanvasInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!this.props.hidden && nextProps.hidden)
|
if ((!prevProps.hidden && this.props.hidden)
|
||||||
|| !nextProps.videoElement) {
|
|| !this.props.videoElement) {
|
||||||
this._clearCanvas();
|
this._clearCanvas();
|
||||||
this._clearUpdateCanvasInterval();
|
this._clearUpdateCanvasInterval();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue