Browse Source

ref(labels): use getDerivedStateFromProps to get display state

master
Leonard Kim 7 years ago
parent
commit
b24e7ec5f0
1 changed files with 13 additions and 16 deletions
  1. 13
    16
      react/features/large-video/components/Labels.web.js

+ 13
- 16
react/features/large-video/components/Labels.web.js View File

32
  * @extends Component
32
  * @extends Component
33
  */
33
  */
34
 class Labels extends AbstractLabels<Props, State> {
34
 class Labels extends AbstractLabels<Props, State> {
35
+    /**
36
+     * Updates the state for whether or not the filmstrip is transitioning to
37
+     * a displayed state.
38
+     *
39
+     * @inheritdoc
40
+     */
41
+    static getDerivedStateFromProps(props, prevState) {
42
+        return {
43
+            filmstripBecomingVisible: !prevState.filmstripBecomingVisible
44
+                && props._filmstripVisible
45
+        };
46
+    }
47
+
35
     /**
48
     /**
36
      * Initializes a new {@code Labels} instance.
49
      * Initializes a new {@code Labels} instance.
37
      *
50
      *
46
         };
59
         };
47
     }
60
     }
48
 
61
 
49
-    /**
50
-     * Updates the state for whether or not the filmstrip is being toggled to
51
-     * display after having being hidden.
52
-     *
53
-     * @inheritdoc
54
-     * @param {Object} nextProps - The read-only props which this Component will
55
-     * receive.
56
-     * @returns {void}
57
-     */
58
-    componentWillReceiveProps(nextProps) {
59
-        this.setState({
60
-            filmstripBecomingVisible: nextProps._filmstripVisible
61
-                && !this.props._filmstripVisible
62
-        });
63
-    }
64
-
65
     /**
62
     /**
66
      * Implements React's {@link Component#render()}.
63
      * Implements React's {@link Component#render()}.
67
      *
64
      *

Loading…
Cancel
Save