瀏覽代碼

ref(conference): remove deprecated lifecycle methods

master
Leonard Kim 6 年之前
父節點
當前提交
3ebad112a2
共有 1 個檔案被更改,包括 18 行新增28 行删除
  1. 18
    28
      react/features/conference/components/Conference.native.js

+ 18
- 28
react/features/conference/components/Conference.native.js 查看文件

@@ -168,6 +168,8 @@ class Conference extends Component<Props> {
168 168
      * @returns {void}
169 169
      */
170 170
     componentDidMount() {
171
+        this.props._onConnect();
172
+
171 173
         // Set handling any hardware button presses for back navigation up.
172 174
         const backHandler = BackHandler || BackAndroid;
173 175
 
@@ -186,39 +188,23 @@ class Conference extends Component<Props> {
186 188
     }
187 189
 
188 190
     /**
189
-     * Implements {@link Component#componentWillMount()}. Invoked immediately
190
-     * before mounting occurs. Connects the conference described by the redux
191
-     * store/state.
191
+     * Implements React's {@link Component#componentDidUpdate()}.
192 192
      *
193 193
      * @inheritdoc
194
-     * @returns {void}
195 194
      */
196
-    componentWillMount() {
197
-        this.props._onConnect();
198
-    }
199
-
200
-    /**
201
-     * Notifies this mounted React {@code Component} that it will receive new
202
-     * props. Check if we need to show / hide the toolbox based on the
203
-     * participant count.
204
-     *
205
-     * @inheritdoc
206
-     * @param {Props} nextProps - The read-only React {@code Component} props
207
-     * that this instance will receive.
208
-     * @returns {void}
209
-     */
210
-    componentWillReceiveProps(nextProps: Props) {
195
+    componentDidUpdate(pevProps: Props) {
211 196
         const {
212 197
             _locationURL: oldLocationURL,
213 198
             _participantCount: oldParticipantCount,
214
-            _room: oldRoom,
215
-            _setToolboxVisible
216
-        } = this.props;
199
+            _room: oldRoom
200
+        } = pevProps;
217 201
         const {
218 202
             _locationURL: newLocationURL,
219 203
             _participantCount: newParticipantCount,
220
-            _room: newRoom
221
-        } = nextProps;
204
+            _room: newRoom,
205
+            _setToolboxVisible,
206
+            _toolboxVisible
207
+        } = this.props;
222 208
 
223 209
         // If the location URL changes we need to reconnect.
224 210
         oldLocationURL !== newLocationURL && this.props._onDisconnect();
@@ -226,10 +212,14 @@ class Conference extends Component<Props> {
226 212
         // Start the connection process when there is a (valid) room.
227 213
         oldRoom !== newRoom && newRoom && this.props._onConnect();
228 214
 
229
-        if (oldParticipantCount === 1) {
230
-            newParticipantCount > 1 && _setToolboxVisible(false);
231
-        } else if (oldParticipantCount > 1) {
232
-            newParticipantCount === 1 && _setToolboxVisible(true);
215
+        if (oldParticipantCount === 1
216
+                && newParticipantCount > 1
217
+                && _toolboxVisible) {
218
+            _setToolboxVisible(false);
219
+        } else if (oldParticipantCount > 1
220
+                && newParticipantCount === 1
221
+                && !_toolboxVisible) {
222
+            _setToolboxVisible(true);
233 223
         }
234 224
     }
235 225
 

Loading…
取消
儲存