瀏覽代碼

Merge pull request #3584 from virtuacoplenny/lenny/update-lifecycles-1

Remove some usages of deprecated lifecycle methods
master
virtuacoplenny 6 年之前
父節點
當前提交
f349357d3c
沒有連結到貢獻者的電子郵件帳戶。
共有 29 個檔案被更改,包括 269 行新增370 行删除
  1. 1
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
  2. 1
    1
      ios/sdk/src/JitsiMeetView.m
  3. 12
    12
      react/features/always-on-top/AlwaysOnTop.js
  4. 2
    2
      react/features/base/dialog/components/AbstractDialog.js
  5. 32
    67
      react/features/base/dialog/components/StatelessDialog.web.js
  6. 11
    4
      react/features/base/label/components/CircularLabel.native.js
  7. 16
    7
      react/features/base/react/components/native/SideBar.js
  8. 11
    1
      react/features/base/toolbox/components/AbstractButton.js
  9. 4
    12
      react/features/deep-linking/components/DeepLinkingMobilePage.web.js
  10. 27
    39
      react/features/desktop-picker/components/DesktopPicker.js
  11. 3
    3
      react/features/device-selection/components/AudioInputPreview.js
  12. 8
    17
      react/features/device-selection/components/DeviceSelection.js
  13. 24
    34
      react/features/invite/components/InfoDialogButton.web.js
  14. 22
    22
      react/features/invite/components/info-dialog/InfoDialog.web.js
  15. 11
    14
      react/features/invite/components/info-dialog/PasswordForm.web.js
  16. 13
    16
      react/features/large-video/components/Labels.web.js
  17. 4
    6
      react/features/large-video/components/LargeVideoBackground.web.js
  18. 2
    2
      react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js
  19. 15
    8
      react/features/recording/components/AbstractRecordingLabel.js
  20. 1
    30
      react/features/recording/components/LiveStream/AbstractStreamKeyForm.js
  21. 1
    1
      react/features/recording/components/LiveStream/native/StreamKeyForm.js
  22. 10
    20
      react/features/recording/components/LiveStream/web/LiveStreamButton.js
  23. 1
    1
      react/features/recording/components/LiveStream/web/StreamKeyForm.js
  24. 5
    15
      react/features/recording/components/Recording/web/RecordButton.js
  25. 8
    11
      react/features/speaker-stats/components/SpeakerStats.js
  26. 5
    5
      react/features/toolbox/components/web/Toolbox.js
  27. 14
    14
      react/features/welcome/components/AbstractWelcomePage.js
  28. 1
    1
      react/features/welcome/components/BlankPage.native.js
  29. 4
    4
      react/features/welcome/components/WelcomePage.native.js

+ 1
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java 查看文件

262
         // the respective conference again if the first invocation was followed
262
         // the respective conference again if the first invocation was followed
263
         // by leaving the conference. However, React and, respectively,
263
         // by leaving the conference. However, React and, respectively,
264
         // appProperties/initialProperties are declarative expressions i.e. one
264
         // appProperties/initialProperties are declarative expressions i.e. one
265
-        // and the same URL will not trigger componentWillReceiveProps in the
265
+        // and the same URL will not trigger an automatic re-render in the
266
         // JavaScript source code. The workaround implemented bellow introduces
266
         // JavaScript source code. The workaround implemented bellow introduces
267
         // imperativeness in React Component props by defining a unique value
267
         // imperativeness in React Component props by defining a unique value
268
         // per loadURLObject: invocation.
268
         // per loadURLObject: invocation.

+ 1
- 1
ios/sdk/src/JitsiMeetView.m 查看文件

268
     // conference again if the first invocation was followed by leaving the
268
     // conference again if the first invocation was followed by leaving the
269
     // conference. However, React and, respectively,
269
     // conference. However, React and, respectively,
270
     // appProperties/initialProperties are declarative expressions i.e. one and
270
     // appProperties/initialProperties are declarative expressions i.e. one and
271
-    // the same URL will not trigger componentWillReceiveProps in the JavaScript
271
+    // the same URL will not trigger an automatic re-render in the JavaScript
272
     // source code. The workaround implemented bellow introduces imperativeness
272
     // source code. The workaround implemented bellow introduces imperativeness
273
     // in React Component props by defining a unique value per loadURLObject:
273
     // in React Component props by defining a unique value per loadURLObject:
274
     // invocation.
274
     // invocation.

+ 12
- 12
react/features/always-on-top/AlwaysOnTop.js 查看文件

205
         this._hideToolbarAfterTimeout();
205
         this._hideToolbarAfterTimeout();
206
     }
206
     }
207
 
207
 
208
+    /**
209
+     * Sets a timeout to hide the toolbar when the toolbar is shown.
210
+     *
211
+     * @inheritdoc
212
+     * @returns {void}
213
+     */
214
+    componentDidUpdate(prevProps: *, prevState: State) {
215
+        if (!prevState.visible && this.state.visible) {
216
+            this._hideToolbarAfterTimeout();
217
+        }
218
+    }
219
+
208
     /**
220
     /**
209
      * Removes all listeners.
221
      * Removes all listeners.
210
      *
222
      *
223
         window.removeEventListener('mousemove', this._mouseMove);
235
         window.removeEventListener('mousemove', this._mouseMove);
224
     }
236
     }
225
 
237
 
226
-    /**
227
-     * Sets a timeout to hide the toolbar when the toolbar is shown.
228
-     *
229
-     * @inheritdoc
230
-     * @returns {void}
231
-     */
232
-    componentWillUpdate(nextProps: *, nextState: State) {
233
-        if (!this.state.visible && nextState.visible) {
234
-            this._hideToolbarAfterTimeout();
235
-        }
236
-    }
237
-
238
     /**
238
     /**
239
      * Implements React's {@link Component#render()}.
239
      * Implements React's {@link Component#render()}.
240
      *
240
      *

+ 2
- 2
react/features/base/dialog/components/AbstractDialog.js 查看文件

49
     }
49
     }
50
 
50
 
51
     /**
51
     /**
52
-     * Implements React's {@link Component#componentWillMount()}. Invoked
52
+     * Implements React's {@link Component#componentDidMount()}. Invoked
53
      * immediately before mounting occurs.
53
      * immediately before mounting occurs.
54
      *
54
      *
55
      * @inheritdoc
55
      * @inheritdoc
56
      */
56
      */
57
-    componentWillMount() {
57
+    componentDidMount() {
58
         this._mounted = true;
58
         this._mounted = true;
59
     }
59
     }
60
 
60
 

+ 32
- 67
react/features/base/dialog/components/StatelessDialog.web.js 查看文件

102
         this._onDialogDismissed = this._onDialogDismissed.bind(this);
102
         this._onDialogDismissed = this._onDialogDismissed.bind(this);
103
         this._onKeyDown = this._onKeyDown.bind(this);
103
         this._onKeyDown = this._onKeyDown.bind(this);
104
         this._onSubmit = this._onSubmit.bind(this);
104
         this._onSubmit = this._onSubmit.bind(this);
105
+        this._renderFooter = this._renderFooter.bind(this);
105
         this._setDialogElement = this._setDialogElement.bind(this);
106
         this._setDialogElement = this._setDialogElement.bind(this);
106
-
107
-        this._Footer = this._createFooterConstructor(props);
108
-    }
109
-
110
-    /**
111
-     * React Component method that executes before the component is updated.
112
-     *
113
-     * @inheritdoc
114
-     * @param {Object} nextProps - The next properties, before the update.
115
-     * @returns {void}
116
-     */
117
-    componentWillUpdate(nextProps) {
118
-        // If button states have changed, update the Footer constructor function
119
-        // so buttons of the proper state are rendered.
120
-        if (nextProps.okDisabled !== this.props.okDisabled
121
-                || nextProps.cancelDisabled !== this.props.cancelDisabled
122
-                || nextProps.submitDisabled !== this.props.submitDisabled) {
123
-            this._Footer = this._createFooterConstructor(nextProps);
124
-        }
125
     }
107
     }
126
 
108
 
127
     /**
109
     /**
142
         return (
124
         return (
143
             <Modal
125
             <Modal
144
                 autoFocus = { true }
126
                 autoFocus = { true }
145
-                footer = { this._Footer }
127
+                footer = { this._renderFooter }
146
                 heading = { titleString || t(titleKey) }
128
                 heading = { titleString || t(titleKey) }
147
                 i18n = { this.props.i18n }
129
                 i18n = { this.props.i18n }
148
                 onClose = { this._onDialogDismissed }
130
                 onClose = { this._onDialogDismissed }
174
         );
156
         );
175
     }
157
     }
176
 
158
 
177
-    _onCancel: () => Function;
159
+    _renderFooter: () => React$Node;
178
 
160
 
179
     /**
161
     /**
180
-     * Returns a functional component to be used for the modal footer.
162
+     * Returns a ReactElement to display buttons for closing the modal.
181
      *
163
      *
182
-     * @param {Object} options - The configuration for how the buttons in the
183
-     * footer should display. Essentially {@code StatelessDialog} props should
184
-     * be passed in.
164
+     * @param {Object} propsFromModalFooter - The props passed in from the
165
+     * {@link ModalFooter} component.
185
      * @private
166
      * @private
186
      * @returns {ReactElement}
167
      * @returns {ReactElement}
187
      */
168
      */
188
-    _createFooterConstructor(options) {
169
+    _renderFooter(propsFromModalFooter) {
189
         // Filter out falsy (null) values because {@code ButtonGroup} will error
170
         // Filter out falsy (null) values because {@code ButtonGroup} will error
190
         // if passed in anything but buttons with valid type props.
171
         // if passed in anything but buttons with valid type props.
191
         const buttons = [
172
         const buttons = [
192
-            this._renderOKButton(options),
193
-            this._renderCancelButton(options)
173
+            this._renderOKButton(),
174
+            this._renderCancelButton()
194
         ].filter(Boolean);
175
         ].filter(Boolean);
195
 
176
 
196
-        return function Footer(modalFooterProps) {
197
-            return (
198
-                <ModalFooter showKeyline = { modalFooterProps.showKeyline } >
199
-                    {
200
-
201
-                        /**
202
-                         * Atlaskit has this empty span (JustifySim) so...
203
-                         */
204
-                    }
205
-                    <span />
206
-                    <ButtonGroup>
207
-                        { buttons }
208
-                    </ButtonGroup>
209
-                </ModalFooter>
210
-            );
211
-        };
177
+        return (
178
+            <ModalFooter showKeyline = { propsFromModalFooter.showKeyline } >
179
+                {
180
+
181
+                    /**
182
+                     * Atlaskit has this empty span (JustifySim) so...
183
+                     */
184
+                }
185
+                <span />
186
+                <ButtonGroup>
187
+                    { buttons }
188
+                </ButtonGroup>
189
+            </ModalFooter>
190
+        );
212
     }
191
     }
213
 
192
 
214
     _onCancel: () => void;
193
     _onCancel: () => void;
257
     /**
236
     /**
258
      * Renders Cancel button.
237
      * Renders Cancel button.
259
      *
238
      *
260
-     * @param {Object} options - The configuration for the Cancel button.
261
-     * @param {boolean} options.cancelDisabled - True if the cancel button
262
-     * should not be rendered.
263
-     * @param {string} options.cancelTitleKey - The translation key to use as
264
-     * text on the button.
265
-     * @param {boolean} options.isModal - True if the cancel button should not
266
-     * be rendered.
267
      * @private
239
      * @private
268
      * @returns {ReactElement|null} The Cancel button if enabled and dialog is
240
      * @returns {ReactElement|null} The Cancel button if enabled and dialog is
269
      * not modal.
241
      * not modal.
270
      */
242
      */
271
-    _renderCancelButton(options = {}) {
272
-        if (options.cancelDisabled
273
-                || options.isModal
274
-                || options.hideCancelButton) {
243
+    _renderCancelButton() {
244
+        if (this.props.cancelDisabled
245
+            || this.props.isModal
246
+            || this.props.hideCancelButton) {
275
             return null;
247
             return null;
276
         }
248
         }
277
 
249
 
286
                 key = 'cancel'
258
                 key = 'cancel'
287
                 onClick = { this._onCancel }
259
                 onClick = { this._onCancel }
288
                 type = 'button'>
260
                 type = 'button'>
289
-                { t(options.cancelTitleKey || 'dialog.Cancel') }
261
+                { t(this.props.cancelTitleKey || 'dialog.Cancel') }
290
             </Button>
262
             </Button>
291
         );
263
         );
292
     }
264
     }
294
     /**
266
     /**
295
      * Renders OK button.
267
      * Renders OK button.
296
      *
268
      *
297
-     * @param {Object} options - The configuration for the OK button.
298
-     * @param {boolean} options.okDisabled - True if the button should display
299
-     * as disabled and clicking should have no effect.
300
-     * @param {string} options.okTitleKey - The translation key to use as text
301
-     * on the button.
302
-     * @param {boolean} options.submitDisabled - True if the button should not
303
-     * be rendered.
304
      * @private
269
      * @private
305
      * @returns {ReactElement|null} The OK button if enabled.
270
      * @returns {ReactElement|null} The OK button if enabled.
306
      */
271
      */
307
-    _renderOKButton(options = {}) {
308
-        if (options.submitDisabled) {
272
+    _renderOKButton() {
273
+        if (this.props.submitDisabled) {
309
             return null;
274
             return null;
310
         }
275
         }
311
 
276
 
318
                 appearance = 'primary'
283
                 appearance = 'primary'
319
                 form = 'modal-dialog-form'
284
                 form = 'modal-dialog-form'
320
                 id = { OK_BUTTON_ID }
285
                 id = { OK_BUTTON_ID }
321
-                isDisabled = { options.okDisabled }
286
+                isDisabled = { this.props.okDisabled }
322
                 key = 'submit'
287
                 key = 'submit'
323
                 onClick = { this._onSubmit }
288
                 onClick = { this._onSubmit }
324
                 type = 'button'>
289
                 type = 'button'>
325
-                { t(options.okTitleKey || 'dialog.Ok') }
290
+                { t(this.props.okTitleKey || 'dialog.Ok') }
326
             </Button>
291
             </Button>
327
         );
292
         );
328
     }
293
     }

+ 11
- 4
react/features/base/label/components/CircularLabel.native.js 查看文件

64
         this.state = {
64
         this.state = {
65
             pulseAnimation: new Animated.Value(0)
65
             pulseAnimation: new Animated.Value(0)
66
         };
66
         };
67
+    }
67
 
68
 
68
-        this._maybeToggleAnimation({}, props);
69
+    /**
70
+     * Implements {@code Component#componentDidMount}.
71
+     *
72
+     * @inheritdoc
73
+     */
74
+    componentDidMount() {
75
+        this._maybeToggleAnimation({}, this.props);
69
     }
76
     }
70
 
77
 
71
     /**
78
     /**
72
-     * Implements {@code Component#componentWillReceiveProps}.
79
+     * Implements {@code Component#componentDidUpdate}.
73
      *
80
      *
74
      * @inheritdoc
81
      * @inheritdoc
75
      */
82
      */
76
-    componentWillReceiveProps(newProps: Props) {
77
-        this._maybeToggleAnimation(this.props, newProps);
83
+    componentDidUpdate(prevProps: Props) {
84
+        this._maybeToggleAnimation(prevProps, this.props);
78
     }
85
     }
79
 
86
 
80
     /**
87
     /**

+ 16
- 7
react/features/base/react/components/native/SideBar.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
-import React, { Component, type Node } from 'react';
3
+import React, { PureComponent, type Node } from 'react';
4
 import { Animated, TouchableWithoutFeedback, View } from 'react-native';
4
 import { Animated, TouchableWithoutFeedback, View } from 'react-native';
5
 
5
 
6
 import styles, { SIDEBAR_WIDTH } from './styles';
6
 import styles, { SIDEBAR_WIDTH } from './styles';
46
 /**
46
 /**
47
  * A generic animated side bar to be used for left-side, hamburger-style menus.
47
  * A generic animated side bar to be used for left-side, hamburger-style menus.
48
  */
48
  */
49
-export default class SideBar extends Component<Props, State> {
49
+export default class SideBar extends PureComponent<Props, State> {
50
+    /**
51
+     * Implements React's {@link Component#getDerivedStateFromProps()}.
52
+     *
53
+     * @inheritdoc
54
+     */
55
+    static getDerivedStateFromProps(props: Props, prevState: State) {
56
+        return {
57
+            showOverlay: props.show || prevState.showOverlay
58
+        };
59
+    }
60
+
50
     /**
61
     /**
51
      * Initializes a new {@code SideBar} instance.
62
      * Initializes a new {@code SideBar} instance.
52
      *
63
      *
74
     }
85
     }
75
 
86
 
76
     /**
87
     /**
77
-     * Implements React's {@link Component#componentWillReceiveProps()}.
88
+     * Implements React's {@link Component#componentDidUpdate()}.
78
      *
89
      *
79
      * @inheritdoc
90
      * @inheritdoc
80
      */
91
      */
81
-    componentWillReceiveProps({ show }: Props) {
82
-        (show === this.props.show) || this._setShow(show);
92
+    componentDidUpdate() {
93
+        this._setShow(this.props.show);
83
     }
94
     }
84
 
95
 
85
     /**
96
     /**
148
      * @returns {void}
159
      * @returns {void}
149
      */
160
      */
150
     _setShow(show) {
161
     _setShow(show) {
151
-        show && this.setState({ showOverlay: true });
152
-
153
         Animated
162
         Animated
154
             .timing(
163
             .timing(
155
                 /* value */ this.state.sliderAnimation,
164
                 /* value */ this.state.sliderAnimation,

+ 11
- 1
react/features/base/toolbox/components/AbstractButton.js 查看文件

206
         return buttonStyles;
206
         return buttonStyles;
207
     }
207
     }
208
 
208
 
209
+    /**
210
+     * Get the tooltip to display when hovering over the button.
211
+     *
212
+     * @private
213
+     * @returns {string}
214
+     */
215
+    _getTooltip() {
216
+        return this.tooltip || '';
217
+    }
218
+
209
     /**
219
     /**
210
      * Helper function to be implemented by subclasses, which must return a
220
      * Helper function to be implemented by subclasses, which must return a
211
      * boolean value indicating if this button is disabled or not.
221
      * boolean value indicating if this button is disabled or not.
258
             iconName: this._getIconName(),
268
             iconName: this._getIconName(),
259
             label: this._getLabel(),
269
             label: this._getLabel(),
260
             styles: this._getStyles(),
270
             styles: this._getStyles(),
261
-            tooltip: this.tooltip
271
+            tooltip: this._getTooltip()
262
         };
272
         };
263
 
273
 
264
         return (
274
         return (

+ 4
- 12
react/features/deep-linking/components/DeepLinkingMobilePage.web.js 查看文件

81
     constructor(props: Props) {
81
     constructor(props: Props) {
82
         super(props);
82
         super(props);
83
 
83
 
84
+        this.state = {
85
+            joinURL: generateDeepLinkingURL()
86
+        };
87
+
84
         // Bind event handlers so they are only bound once per instance.
88
         // Bind event handlers so they are only bound once per instance.
85
         this._onDownloadApp = this._onDownloadApp.bind(this);
89
         this._onDownloadApp = this._onDownloadApp.bind(this);
86
         this._onOpenApp = this._onOpenApp.bind(this);
90
         this._onOpenApp = this._onOpenApp.bind(this);
87
     }
91
     }
88
 
92
 
89
-    /**
90
-     * Initializes the text and URL of the `Start a conference` / `Join the
91
-     * conversation` button which takes the user to the mobile app.
92
-     *
93
-     * @inheritdoc
94
-     */
95
-    componentWillMount() {
96
-        this.setState({
97
-            joinURL: generateDeepLinkingURL()
98
-        });
99
-    }
100
-
101
     /**
93
     /**
102
      * Implements the Component's componentDidMount method.
94
      * Implements the Component's componentDidMount method.
103
      *
95
      *

+ 27
- 39
react/features/desktop-picker/components/DesktopPicker.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
 import Tabs from '@atlaskit/tabs';
3
 import Tabs from '@atlaskit/tabs';
4
-import React, { Component } from 'react';
4
+import React, { PureComponent } from 'react';
5
 import { connect } from 'react-redux';
5
 import { connect } from 'react-redux';
6
 
6
 
7
 import { Dialog, hideDialog } from '../../base/dialog';
7
 import { Dialog, hideDialog } from '../../base/dialog';
94
     types: Array<string>
94
     types: Array<string>
95
 };
95
 };
96
 
96
 
97
+
97
 /**
98
 /**
98
  * React component for DesktopPicker.
99
  * React component for DesktopPicker.
99
  *
100
  *
100
  * @extends Component
101
  * @extends Component
101
  */
102
  */
102
-class DesktopPicker extends Component<Props, State> {
103
+class DesktopPicker extends PureComponent<Props, State> {
104
+    /**
105
+     * Implements React's {@link Component#getDerivedStateFromProps()}.
106
+     *
107
+     * @inheritdoc
108
+     */
109
+    static getDerivedStateFromProps(props) {
110
+        return {
111
+            types: DesktopPicker._getValidTypes(props.desktopSharingSources)
112
+        };
113
+    }
114
+
115
+    /**
116
+     * Extracts only the valid types from the passed {@code types}.
117
+     *
118
+     * @param {Array<string>} types - The types to filter.
119
+     * @private
120
+     * @returns {Array<string>} The filtered types.
121
+     */
122
+    static _getValidTypes(types = []) {
123
+        return types.filter(
124
+            type => VALID_TYPES.includes(type));
125
+    }
126
+
103
     _poller = null;
127
     _poller = null;
104
 
128
 
105
     state = {
129
     state = {
133
         this._updateSources = this._updateSources.bind(this);
157
         this._updateSources = this._updateSources.bind(this);
134
 
158
 
135
         this.state.types
159
         this.state.types
136
-            = this._getValidTypes(this.props.desktopSharingSources);
160
+            = DesktopPicker._getValidTypes(this.props.desktopSharingSources);
137
     }
161
     }
138
 
162
 
139
     /**
163
     /**
146
         this._startPolling();
170
         this._startPolling();
147
     }
171
     }
148
 
172
 
149
-    /**
150
-     * Notifies this mounted React Component that it will receive new props.
151
-     * Sets a default selected source if one is not already set.
152
-     *
153
-     * @inheritdoc
154
-     * @param {Object} nextProps - The read-only React Component props that this
155
-     * instance will receive.
156
-     * @returns {void}
157
-     */
158
-    componentWillReceiveProps(nextProps: Props) {
159
-        const { desktopSharingSources } = nextProps;
160
-
161
-        /**
162
-         * Do only reference check in order to not calculate the types on every
163
-         * update. This is enough for our use case and we don't need value
164
-         * checking because if the value is the same we won't change the
165
-         * reference for the desktopSharingSources array.
166
-         */
167
-        if (desktopSharingSources !== this.props.desktopSharingSources) {
168
-            this.setState({
169
-                types: this._getValidTypes(desktopSharingSources)
170
-            });
171
-        }
172
-    }
173
-
174
     /**
173
     /**
175
      * Clean up component and DesktopCapturerSource store state.
174
      * Clean up component and DesktopCapturerSource store state.
176
      *
175
      *
241
         return selectedSource;
240
         return selectedSource;
242
     }
241
     }
243
 
242
 
244
-    /**
245
-     * Extracts only the valid types from the passed {@code types}.
246
-     *
247
-     * @param {Array<string>} types - The types to filter.
248
-     * @returns {Array<string>} The filtered types.
249
-     */
250
-    _getValidTypes(types = []) {
251
-        return types.filter(
252
-            type => VALID_TYPES.includes(type));
253
-    }
254
-
255
     _onCloseModal: (?string, string) => void;
243
     _onCloseModal: (?string, string) => void;
256
 
244
 
257
     /**
245
     /**

+ 3
- 3
react/features/device-selection/components/AudioInputPreview.js 查看文件

63
      * @inheritdoc
63
      * @inheritdoc
64
      * @returns {void}
64
      * @returns {void}
65
      */
65
      */
66
-    componentWillReceiveProps(nextProps: Props) {
67
-        if (nextProps.track !== this.props.track) {
68
-            this._listenForAudioUpdates(nextProps.track);
66
+    componentDidUpdate(prevProps: Props) {
67
+        if (prevProps.track !== this.props.track) {
68
+            this._listenForAudioUpdates(this.props.track);
69
             this._updateAudioLevel(0);
69
             this._updateAudioLevel(0);
70
         }
70
         }
71
     }
71
     }

+ 8
- 17
react/features/device-selection/components/DeviceSelection.js 查看文件

151
     }
151
     }
152
 
152
 
153
     /**
153
     /**
154
-     * Checks if audio / video permissions were granted.
154
+     * Checks if audio / video permissions were granted. Updates audio input and
155
+     * video input previews.
155
      *
156
      *
156
      * @param {Object} prevProps - Previous props this component received.
157
      * @param {Object} prevProps - Previous props this component received.
157
      * @param {Object} prevState - Previous state this component had.
158
      * @param {Object} prevState - Previous state this component had.
174
                 });
175
                 });
175
             });
176
             });
176
         }
177
         }
177
-    }
178
-
179
-    /**
180
-     * Updates audio input and video input previews.
181
-     *
182
-     * @inheritdoc
183
-     * @param {Object} nextProps - The read-only props which this Component will
184
-     * receive.
185
-     * @returns {void}
186
-     */
187
-    componentWillReceiveProps(nextProps: Object) {
188
-        const { selectedAudioInputId, selectedVideoInputId } = this.props;
189
 
178
 
190
-        if (selectedAudioInputId !== nextProps.selectedAudioInputId) {
191
-            this._createAudioInputTrack(nextProps.selectedAudioInputId);
179
+        if (prevProps.selectedAudioInputId
180
+            !== this.props.selectedAudioInputId) {
181
+            this._createAudioInputTrack(this.props.selectedAudioInputId);
192
         }
182
         }
193
 
183
 
194
-        if (selectedVideoInputId !== nextProps.selectedVideoInputId) {
195
-            this._createVideoInputTrack(nextProps.selectedVideoInputId);
184
+        if (prevProps.selectedVideoInputId
185
+            !== this.props.selectedVideoInputId) {
186
+            this._createVideoInputTrack(this.props.selectedVideoInputId);
196
         }
187
         }
197
     }
188
     }
198
 
189
 

+ 24
- 34
react/features/invite/components/InfoDialogButton.web.js 查看文件

70
  */
70
  */
71
 type State = {
71
 type State = {
72
 
72
 
73
+    /**
74
+     * Cache the conference connection state to derive when transitioning from
75
+     * not joined to join, in order to auto-show the InfoDialog.
76
+     */
77
+    hasConnectedToConference: boolean,
78
+
73
     /**
79
     /**
74
      * Whether or not {@code InfoDialog} should be visible.
80
      * Whether or not {@code InfoDialog} should be visible.
75
      */
81
      */
83
  * @extends Component
89
  * @extends Component
84
  */
90
  */
85
 class InfoDialogButton extends Component<Props, State> {
91
 class InfoDialogButton extends Component<Props, State> {
92
+    /**
93
+     * Implements React's {@link Component#getDerivedStateFromProps()}.
94
+     *
95
+     * @inheritdoc
96
+     */
97
+    static getDerivedStateFromProps(props, state) {
98
+        return {
99
+            hasConnectedToConference: props._isConferenceJoined,
100
+            showDialog: (props._toolboxVisible && state.showDialog)
101
+                || (!state.hasConnectedToConference
102
+                    && props._isConferenceJoined
103
+                    && props._participantCount < 2
104
+                    && props._toolboxVisible
105
+                    && !props._disableAutoShow)
106
+        };
107
+    }
108
+
86
     /**
109
     /**
87
      * Initializes new {@code InfoDialogButton} instance.
110
      * Initializes new {@code InfoDialogButton} instance.
88
      *
111
      *
92
         super(props);
115
         super(props);
93
 
116
 
94
         this.state = {
117
         this.state = {
118
+            hasConnectedToConference: props._isConferenceJoined,
95
             showDialog: false
119
             showDialog: false
96
         };
120
         };
97
 
121
 
111
         }
135
         }
112
     }
136
     }
113
 
137
 
114
-    /**
115
-     * Update the visibility of the {@code InfoDialog}.
116
-     *
117
-     * @inheritdoc
118
-     */
119
-    componentWillReceiveProps(nextProps) {
120
-        // Ensure the dialog is closed when the toolbox becomes hidden.
121
-        if (this.state.showDialog && !nextProps._toolboxVisible) {
122
-            this._onDialogClose();
123
-
124
-            return;
125
-        }
126
-
127
-        this._maybeAutoShowDialog(nextProps);
128
-    }
129
-
130
     /**
138
     /**
131
      * Implements React's {@link Component#render()}.
139
      * Implements React's {@link Component#render()}.
132
      *
140
      *
159
         );
167
         );
160
     }
168
     }
161
 
169
 
162
-    /**
163
-     * Invoked to trigger display of the {@code InfoDialog} if certain
164
-     * conditions are met.
165
-     *
166
-     * @param {Object} nextProps - The future properties of this component.
167
-     * @private
168
-     * @returns {void}
169
-     */
170
-    _maybeAutoShowDialog(nextProps) {
171
-        if (!this.props._isConferenceJoined
172
-            && nextProps._isConferenceJoined
173
-            && nextProps._participantCount < 2
174
-            && nextProps._toolboxVisible
175
-            && !nextProps._disableAutoShow) {
176
-            this.setState({ showDialog: true });
177
-        }
178
-    }
179
-
180
     _onDialogClose: () => void;
170
     _onDialogClose: () => void;
181
 
171
 
182
     /**
172
     /**

+ 22
- 22
react/features/invite/components/info-dialog/InfoDialog.web.js 查看文件

112
 class InfoDialog extends Component<Props, State> {
112
 class InfoDialog extends Component<Props, State> {
113
     _copyElement: ?Object;
113
     _copyElement: ?Object;
114
 
114
 
115
+    /**
116
+     * Implements React's {@link Component#getDerivedStateFromProps()}.
117
+     *
118
+     * @inheritdoc
119
+     */
120
+    static getDerivedStateFromProps(props, state) {
121
+        let phoneNumber = state.phoneNumber;
122
+
123
+        if (!state.phoneNumber && props.dialIn.numbers) {
124
+            const { defaultCountry, numbers } = props.dialIn;
125
+
126
+            phoneNumber = _getDefaultPhoneNumber(numbers, defaultCountry);
127
+        }
128
+
129
+        return {
130
+            // Exit edit mode when a password is set locally or remotely.
131
+            passwordEditEnabled: state.passwordEditEnabled && props._password
132
+                ? false : state.passwordEditEnabled,
133
+            phoneNumber
134
+        };
135
+    }
136
+
115
     /**
137
     /**
116
      * {@code InfoDialog} component's local state.
138
      * {@code InfoDialog} component's local state.
117
      *
139
      *
162
         this._setCopyElement = this._setCopyElement.bind(this);
184
         this._setCopyElement = this._setCopyElement.bind(this);
163
     }
185
     }
164
 
186
 
165
-    /**
166
-     * Implements React's {@link Component#componentWillReceiveProps()}. Invoked
167
-     * before this mounted component receives new props.
168
-     *
169
-     * @inheritdoc
170
-     * @param {Props} nextProps - New props component will receive.
171
-     */
172
-    componentWillReceiveProps(nextProps) {
173
-        if (!this.props._password && nextProps._password) {
174
-            this.setState({ passwordEditEnabled: false });
175
-        }
176
-
177
-        if (!this.state.phoneNumber && nextProps.dialIn.numbers) {
178
-            const { defaultCountry, numbers } = nextProps.dialIn;
179
-
180
-            this.setState({
181
-                phoneNumber:
182
-                    _getDefaultPhoneNumber(numbers, defaultCountry)
183
-            });
184
-        }
185
-    }
186
-
187
     /**
187
     /**
188
      * Implements React's {@link Component#render()}.
188
      * Implements React's {@link Component#render()}.
189
      *
189
      *

+ 11
- 14
react/features/invite/components/info-dialog/PasswordForm.web.js 查看文件

55
  * @extends Component
55
  * @extends Component
56
  */
56
  */
57
 class PasswordForm extends Component<Props, State> {
57
 class PasswordForm extends Component<Props, State> {
58
+    /**
59
+     * Implements React's {@link Component#getDerivedStateFromProps()}.
60
+     *
61
+     * @inheritdoc
62
+     */
63
+    static getDerivedStateFromProps(props, state) {
64
+        return {
65
+            enteredPassword: props.editEnabled ? state.enteredPassword : ''
66
+        };
67
+    }
68
+
58
     state = {
69
     state = {
59
         enteredPassword: ''
70
         enteredPassword: ''
60
     };
71
     };
74
         this._onPasswordSubmit = this._onPasswordSubmit.bind(this);
85
         this._onPasswordSubmit = this._onPasswordSubmit.bind(this);
75
     }
86
     }
76
 
87
 
77
-    /**
78
-     * Implements React's {@link Component#componentWillReceiveProps()}. Invoked
79
-     * before this mounted component receives new props.
80
-     *
81
-     * @inheritdoc
82
-     * @param {Props} nextProps - New props component will receive.
83
-     */
84
-    componentWillReceiveProps(nextProps: Props) {
85
-        if (this.props.editEnabled && !nextProps.editEnabled) {
86
-            this.setState({ enteredPassword: '' });
87
-        }
88
-    }
89
-
90
     /**
88
     /**
91
      * Implements React's {@link Component#render()}.
89
      * Implements React's {@link Component#render()}.
92
      *
90
      *
182
     }
180
     }
183
 }
181
 }
184
 
182
 
185
-
186
 export default translate(PasswordForm);
183
 export default translate(PasswordForm);

+ 13
- 16
react/features/large-video/components/Labels.web.js 查看文件

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
      *

+ 4
- 6
react/features/large-video/components/LargeVideoBackground.web.js 查看文件

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
         }

+ 2
- 2
react/features/mobile/audio-mode/components/AudioRoutePickerDialog.js 查看文件

109
     state = {
109
     state = {
110
         /**
110
         /**
111
          * Available audio devices, it will be set in
111
          * Available audio devices, it will be set in
112
-         * {@link #componentWillMount()}.
112
+         * {@link #componentDidMount()}.
113
          */
113
          */
114
         devices: []
114
         devices: []
115
     };
115
     };
132
      *
132
      *
133
      * @inheritdoc
133
      * @inheritdoc
134
      */
134
      */
135
-    componentWillMount() {
135
+    componentDidMount() {
136
         AudioMode.getAudioDevices().then(({ devices, selected }) => {
136
         AudioMode.getAudioDevices().then(({ devices, selected }) => {
137
             const audioDevices = [];
137
             const audioDevices = [];
138
 
138
 

+ 15
- 8
react/features/recording/components/AbstractRecordingLabel.js 查看文件

54
  */
54
  */
55
 export default class AbstractRecordingLabel
55
 export default class AbstractRecordingLabel
56
     extends Component<Props, State> {
56
     extends Component<Props, State> {
57
+    /**
58
+     * Implements {@code Component#getDerivedStateFromProps}.
59
+     *
60
+     * @inheritdoc
61
+     */
62
+    static getDerivedStateFromProps(props: Props, prevState: State) {
63
+        return {
64
+            staleLabel: props._status !== JitsiRecordingConstants.status.OFF
65
+                && prevState.staleLabel ? false : prevState.staleLabel
66
+        };
67
+    }
68
+
57
     /**
69
     /**
58
      * Initializes a new {@code AbstractRecordingLabel} component.
70
      * Initializes a new {@code AbstractRecordingLabel} component.
59
      *
71
      *
70
     }
82
     }
71
 
83
 
72
     /**
84
     /**
73
-     * Implements {@code Component#componentWillReceiveProps}.
85
+     * Implements {@code Component#componentDidUpdate}.
74
      *
86
      *
75
      * @inheritdoc
87
      * @inheritdoc
76
      */
88
      */
77
-    componentWillReceiveProps(newProps: Props) {
78
-        this._updateStaleStatus(this.props, newProps);
89
+    componentDidUpdate(prevProps: Props) {
90
+        this._updateStaleStatus(prevProps, this.props);
79
     }
91
     }
80
 
92
 
81
     /**
93
     /**
137
                     }
149
                     }
138
                 }, STALE_TIMEOUT);
150
                 }, STALE_TIMEOUT);
139
             }
151
             }
140
-        } else if (this.state.staleLabel) {
141
-            this.setState({
142
-                staleLabel: false
143
-            });
144
         }
152
         }
145
     }
153
     }
146
-
147
 }
154
 }
148
 
155
 
149
 /**
156
 /**

+ 1
- 30
react/features/recording/components/LiveStream/AbstractStreamKeyForm.js 查看文件

33
     value: string
33
     value: string
34
 };
34
 };
35
 
35
 
36
-/**
37
- * The state of the component.
38
- */
39
-type State = {
40
-
41
-    /**
42
-     * The value entered in the field.
43
-     */
44
-    value: string
45
-}
46
-
47
 /**
36
 /**
48
  * An abstract React Component for entering a key for starting a YouTube live
37
  * An abstract React Component for entering a key for starting a YouTube live
49
  * stream.
38
  * stream.
50
  *
39
  *
51
  * @extends Component
40
  * @extends Component
52
  */
41
  */
53
-export default class AbstractStreamKeyForm extends Component<Props, State> {
42
+export default class AbstractStreamKeyForm extends Component<Props> {
54
     helpURL: string;
43
     helpURL: string;
55
 
44
 
56
     /**
45
     /**
61
     constructor(props: Props) {
50
     constructor(props: Props) {
62
         super(props);
51
         super(props);
63
 
52
 
64
-        this.state = {
65
-            value: props.value
66
-        };
67
-
68
         this.helpURL = (typeof interfaceConfig !== 'undefined'
53
         this.helpURL = (typeof interfaceConfig !== 'undefined'
69
             && interfaceConfig.LIVE_STREAMING_HELP_LINK)
54
             && interfaceConfig.LIVE_STREAMING_HELP_LINK)
70
             || LIVE_STREAMING_HELP_LINK;
55
             || LIVE_STREAMING_HELP_LINK;
73
         this._onInputChange = this._onInputChange.bind(this);
58
         this._onInputChange = this._onInputChange.bind(this);
74
     }
59
     }
75
 
60
 
76
-    /**
77
-     * Implements {@code Component}'s componentWillReceiveProps.
78
-     *
79
-     * @inheritdoc
80
-     */
81
-    componentWillReceiveProps(newProps: Props) {
82
-        this.setState({
83
-            value: newProps.value
84
-        });
85
-    }
86
-
87
     _onInputChange: Object => void
61
     _onInputChange: Object => void
88
 
62
 
89
     /**
63
     /**
99
     _onInputChange(change) {
73
     _onInputChange(change) {
100
         const value = typeof change === 'object' ? change.target.value : change;
74
         const value = typeof change === 'object' ? change.target.value : change;
101
 
75
 
102
-        this.setState({
103
-            value
104
-        });
105
         this.props.onChange(value);
76
         this.props.onChange(value);
106
     }
77
     }
107
 }
78
 }

+ 1
- 1
react/features/recording/components/LiveStream/native/StreamKeyForm.js 查看文件

50
                     onChangeText = { this._onInputChange }
50
                     onChangeText = { this._onInputChange }
51
                     placeholder = { t('liveStreaming.enterStreamKey') }
51
                     placeholder = { t('liveStreaming.enterStreamKey') }
52
                     style = { styles.streamKeyInput }
52
                     style = { styles.streamKeyInput }
53
-                    value = { this.state.value } />
53
+                    value = { this.props.value } />
54
                 <TouchableOpacity
54
                 <TouchableOpacity
55
                     onPress = { this._onOpenHelp }
55
                     onPress = { this._onOpenHelp }
56
                     style = { styles.streamKeyHelp } >
56
                     style = { styles.streamKeyHelp } >

+ 10
- 20
react/features/recording/components/LiveStream/web/LiveStreamButton.js 查看文件

37
     iconName = 'icon-public';
37
     iconName = 'icon-public';
38
     toggledIconName = 'icon-public';
38
     toggledIconName = 'icon-public';
39
 
39
 
40
-    /**
41
-     * Constructor of the component.
42
-     *
43
-     * @inheritdoc
44
-     */
45
-    constructor(props: Props) {
46
-        super(props);
47
-
48
-        this.tooltip = props._liveStreamDisabledTooltipKey;
49
-    }
50
-
51
-    /**
52
-     * Implements {@code Component}'s componentWillReceiveProps.
53
-     *
54
-     * @inheritdoc
55
-     */
56
-    componentWillReceiveProps(newProps: Props) {
57
-        this.tooltip = newProps._liveStreamDisabledTooltipKey;
58
-    }
59
-
60
     /**
40
     /**
61
      * Helper function to be implemented by subclasses, which returns
41
      * Helper function to be implemented by subclasses, which returns
62
      * a React Element to display (a beta tag) at the end of the button.
42
      * a React Element to display (a beta tag) at the end of the button.
76
         );
56
         );
77
     }
57
     }
78
 
58
 
59
+    /**
60
+     * Returns the tooltip that should be displayed when the button is disabled.
61
+     *
62
+     * @private
63
+     * @returns {string}
64
+     */
65
+    _getTooltip() {
66
+        return this.props._liveStreamDisabledTooltipKey || '';
67
+    }
68
+
79
     /**
69
     /**
80
      * Helper function to be implemented by subclasses, which must return a
70
      * Helper function to be implemented by subclasses, which must return a
81
      * boolean value indicating if this button is disabled or not.
71
      * boolean value indicating if this button is disabled or not.

+ 1
- 1
react/features/recording/components/LiveStream/web/StreamKeyForm.js 查看文件

51
                     placeholder = { t('liveStreaming.enterStreamKey') }
51
                     placeholder = { t('liveStreaming.enterStreamKey') }
52
                     shouldFitContainer = { true }
52
                     shouldFitContainer = { true }
53
                     type = 'text'
53
                     type = 'text'
54
-                    value = { this.state.value } />
54
+                    value = { this.props.value } />
55
                 { this.helpURL
55
                 { this.helpURL
56
                     ? <div className = 'form-footer'>
56
                     ? <div className = 'form-footer'>
57
                         <a
57
                         <a

+ 5
- 15
react/features/recording/components/Recording/web/RecordButton.js 查看文件

36
     toggledIconName = 'icon-camera-take-picture';
36
     toggledIconName = 'icon-camera-take-picture';
37
 
37
 
38
     /**
38
     /**
39
-     * Constructor of the component.
39
+     * Returns the tooltip that should be displayed when the button is disabled.
40
      *
40
      *
41
-     * @inheritdoc
41
+     * @private
42
+     * @returns {string}
42
      */
43
      */
43
-    constructor(props: Props) {
44
-        super(props);
45
-
46
-        this.tooltip = props._fileRecordingsDisabledTooltipKey;
47
-    }
48
-
49
-    /**
50
-     * Implements {@code Component}'s componentWillReceiveProps.
51
-     *
52
-     * @inheritdoc
53
-     */
54
-    componentWillReceiveProps(newProps: Props) {
55
-        this.tooltip = newProps._fileRecordingsDisabledTooltipKey;
44
+    _getTooltip() {
45
+        return this.tooltip || '';
56
     }
46
     }
57
 
47
 
58
     /**
48
     /**

+ 8
- 11
react/features/speaker-stats/components/SpeakerStats.js 查看文件

12
 declare var interfaceConfig: Object;
12
 declare var interfaceConfig: Object;
13
 
13
 
14
 /**
14
 /**
15
- * The type of the React {@code Component} props of {@link SpeakerStats}
15
+ * The type of the React {@code Component} props of {@link SpeakerStats}.
16
  */
16
  */
17
 type Props = {
17
 type Props = {
18
 
18
 
33
 };
33
 };
34
 
34
 
35
 /**
35
 /**
36
- * The type of the React {@code Component} state of {@link SpeakerStats}
36
+ * The type of the React {@code Component} state of {@link SpeakerStats}.
37
  */
37
  */
38
 type State = {
38
 type State = {
39
 
39
 
49
  * @extends Component
49
  * @extends Component
50
  */
50
  */
51
 class SpeakerStats extends Component<Props, State> {
51
 class SpeakerStats extends Component<Props, State> {
52
-    state = {
53
-        stats: {}
54
-    };
55
-
56
     _updateInterval: IntervalID;
52
     _updateInterval: IntervalID;
57
 
53
 
58
     /**
54
     /**
64
     constructor(props) {
60
     constructor(props) {
65
         super(props);
61
         super(props);
66
 
62
 
63
+        this.state = {
64
+            stats: this.props.conference.getSpeakerStats()
65
+        };
66
+
67
         // Bind event handlers so they are only bound once per instance.
67
         // Bind event handlers so they are only bound once per instance.
68
         this._updateStats = this._updateStats.bind(this);
68
         this._updateStats = this._updateStats.bind(this);
69
     }
69
     }
70
 
70
 
71
     /**
71
     /**
72
-     * Immediately request for updated speaker stats and begin
73
-     * polling for speaker stats updates.
72
+     * Begin polling for speaker stats updates.
74
      *
73
      *
75
      * @inheritdoc
74
      * @inheritdoc
76
-     * @returns {void}
77
      */
75
      */
78
-    componentWillMount() {
79
-        this._updateStats();
76
+    componentDidMount() {
80
         this._updateInterval = setInterval(this._updateStats, 1000);
77
         this._updateInterval = setInterval(this._updateStats, 1000);
81
     }
78
     }
82
 
79
 

+ 5
- 5
react/features/toolbox/components/web/Toolbox.js 查看文件

280
      *
280
      *
281
      * @inheritdoc
281
      * @inheritdoc
282
      */
282
      */
283
-    componentWillReceiveProps(nextProps) {
283
+    componentDidUpdate(prevProps) {
284
         // Ensure the dialog is closed when the toolbox becomes hidden.
284
         // Ensure the dialog is closed when the toolbox becomes hidden.
285
-        if (this.props._overflowMenuVisible && !nextProps._visible) {
285
+        if (prevProps._overflowMenuVisible && !this.props._visible) {
286
             this._onSetOverflowVisible(false);
286
             this._onSetOverflowVisible(false);
287
         }
287
         }
288
 
288
 
289
-        if (this.props._overflowMenuVisible
290
-            && !this.props._dialog
291
-            && nextProps._dialog) {
289
+        if (prevProps._overflowMenuVisible
290
+            && !prevProps._dialog
291
+            && this.props._dialog) {
292
             this._onSetOverflowVisible(false);
292
             this._onSetOverflowVisible(false);
293
             this.props.dispatch(setToolbarHovered(false));
293
             this.props.dispatch(setToolbarHovered(false));
294
         }
294
         }

+ 14
- 14
react/features/welcome/components/AbstractWelcomePage.js 查看文件

37
 export class AbstractWelcomePage extends Component<Props, *> {
37
 export class AbstractWelcomePage extends Component<Props, *> {
38
     _mounted: ?boolean;
38
     _mounted: ?boolean;
39
 
39
 
40
+    /**
41
+     * Implements React's {@link Component#getDerivedStateFromProps()}.
42
+     *
43
+     * @inheritdoc
44
+     */
45
+    static getDerivedStateFromProps(props: Props, state: Object) {
46
+        return {
47
+            room: props._room || state.room
48
+        };
49
+    }
50
+
40
     /**
51
     /**
41
      * Save room name into component's local state.
52
      * Save room name into component's local state.
42
      *
53
      *
77
     }
88
     }
78
 
89
 
79
     /**
90
     /**
80
-     * Implements React's {@link Component#componentWillMount()}. Invoked
81
-     * immediately before mounting occurs.
91
+     * Implements React's {@link Component#componentDidMount()}. Invoked
92
+     * immediately after mounting occurs.
82
      *
93
      *
83
      * @inheritdoc
94
      * @inheritdoc
84
      */
95
      */
85
-    componentWillMount() {
96
+    componentDidMount() {
86
         this._mounted = true;
97
         this._mounted = true;
87
     }
98
     }
88
 
99
 
89
-    /**
90
-     * Implements React's {@link Component#componentWillReceiveProps()}. Invoked
91
-     * before this mounted component receives new props.
92
-     *
93
-     * @inheritdoc
94
-     * @param {Props} nextProps - New props component will receive.
95
-     */
96
-    componentWillReceiveProps(nextProps: Props) {
97
-        this.setState({ room: nextProps._room });
98
-    }
99
-
100
     /**
100
     /**
101
      * Implements React's {@link Component#componentWillUnmount()}. Invoked
101
      * Implements React's {@link Component#componentWillUnmount()}. Invoked
102
      * immediately before this component is unmounted and destroyed.
102
      * immediately before this component is unmounted and destroyed.

+ 1
- 1
react/features/welcome/components/BlankPage.native.js 查看文件

29
      * @inheritdoc
29
      * @inheritdoc
30
      * @returns {void}
30
      * @returns {void}
31
      */
31
      */
32
-    componentWillMount() {
32
+    componentDidMount() {
33
         this.props.dispatch(destroyLocalTracks());
33
         this.props.dispatch(destroyLocalTracks());
34
     }
34
     }
35
 
35
 

+ 4
- 4
react/features/welcome/components/WelcomePage.native.js 查看文件

57
     }
57
     }
58
 
58
 
59
     /**
59
     /**
60
-     * Implements React's {@link Component#componentWillMount()}. Invoked
61
-     * immediately before mounting occurs. Creates a local video track if none
60
+     * Implements React's {@link Component#componentDidMount()}. Invoked
61
+     * immediately after mounting occurs. Creates a local video track if none
62
      * is available and the camera permission was already granted.
62
      * is available and the camera permission was already granted.
63
      *
63
      *
64
      * @inheritdoc
64
      * @inheritdoc
65
      * @returns {void}
65
      * @returns {void}
66
      */
66
      */
67
-    componentWillMount() {
68
-        super.componentWillMount();
67
+    componentDidMount() {
68
+        super.componentDidMount();
69
 
69
 
70
         const { dispatch } = this.props;
70
         const { dispatch } = this.props;
71
 
71
 

Loading…
取消
儲存