Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(labels): use getDerivedStateFromProps to get display state

Leonard Kimb24e7ec5f003
diff --git a/react/features/large-video/components/Labels.web.js b/react/features/large-video/components/Labels.web.js
index 703e1a513c..930337c619 100644
--- a/react/features/large-video/components/Labels.web.js
+++ b/react/features/large-video/components/Labels.web.js
@@ -32,6 +32,19 @@ type State = {
* @extends Component
*/
class Labels extends AbstractLabels<Props, State> {
+ /**
+ * Updates the state for whether or not the filmstrip is transitioning to
+ * a displayed state.
+ *
+ * @inheritdoc
+ */
+ static getDerivedStateFromProps(props, prevState) {
+ return {
+ filmstripBecomingVisible: !prevState.filmstripBecomingVisible
+ && props._filmstripVisible
+ };
+ }
+
/**
* Initializes a new {@code Labels} instance.
*
@@ -46,22 +59,6 @@ class Labels extends AbstractLabels<Props, State> {
};
}
- /**
- * Updates the state for whether or not the filmstrip is being toggled to
- * display after having being hidden.
- *
- * @inheritdoc
- * @param {Object} nextProps - The read-only props which this Component will
- * receive.
- * @returns {void}
- */
- componentWillReceiveProps(nextProps) {
- this.setState({
- filmstripBecomingVisible: nextProps._filmstripVisible
- && !this.props._filmstripVisible
- });
- }
-
/**
* Implements React's {@link Component#render()}.
*