From b24e7ec5f003e68110b97ee51edbc21f6b1ecb4e Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Sun, 28 Oct 2018 19:10:33 -0700 Subject: [PATCH] ref(labels): use getDerivedStateFromProps to get display state --- .../large-video/components/Labels.web.js | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/react/features/large-video/components/Labels.web.js b/react/features/large-video/components/Labels.web.js index 703e1a513..930337c61 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 { + /** + * 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 { }; } - /** - * 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()}. *