Browse Source

ref(large-video): use componentDidUpdate to change background image

master
Leonard Kim 7 years ago
parent
commit
85f487cca5

+ 4
- 6
react/features/large-video/components/LargeVideoBackground.web.js View File

117
      * Starts or stops the interval to update the image displayed in the canvas.
117
      * Starts or stops the interval to update the image displayed in the canvas.
118
      *
118
      *
119
      * @inheritdoc
119
      * @inheritdoc
120
-     * @param {Object} nextProps - The read-only React {@code Component} props
121
-     * with which the new instance is to be initialized.
122
      */
120
      */
123
-    componentWillReceiveProps(nextProps: Props) {
124
-        if (this.props.hidden && !nextProps.hidden) {
121
+    componentDidUpdate(prevProps: Props) {
122
+        if (prevProps.hidden && !this.props.hidden) {
125
             this._clearCanvas();
123
             this._clearCanvas();
126
             this._setUpdateCanvasInterval();
124
             this._setUpdateCanvasInterval();
127
         }
125
         }
128
 
126
 
129
-        if ((!this.props.hidden && nextProps.hidden)
130
-            || !nextProps.videoElement) {
127
+        if ((!prevProps.hidden && this.props.hidden)
128
+            || !this.props.videoElement) {
131
             this._clearCanvas();
129
             this._clearCanvas();
132
             this._clearUpdateCanvasInterval();
130
             this._clearUpdateCanvasInterval();
133
         }
131
         }

Loading…
Cancel
Save