Bläddra i källkod

ref(conference): remove deprecated lifecycle methods

master
Leonard Kim 6 år sedan
förälder
incheckning
3ebad112a2
1 ändrade filer med 18 tillägg och 28 borttagningar
  1. 18
    28
      react/features/conference/components/Conference.native.js

+ 18
- 28
react/features/conference/components/Conference.native.js Visa fil

168
      * @returns {void}
168
      * @returns {void}
169
      */
169
      */
170
     componentDidMount() {
170
     componentDidMount() {
171
+        this.props._onConnect();
172
+
171
         // Set handling any hardware button presses for back navigation up.
173
         // Set handling any hardware button presses for back navigation up.
172
         const backHandler = BackHandler || BackAndroid;
174
         const backHandler = BackHandler || BackAndroid;
173
 
175
 
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
      * @inheritdoc
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
         const {
196
         const {
212
             _locationURL: oldLocationURL,
197
             _locationURL: oldLocationURL,
213
             _participantCount: oldParticipantCount,
198
             _participantCount: oldParticipantCount,
214
-            _room: oldRoom,
215
-            _setToolboxVisible
216
-        } = this.props;
199
+            _room: oldRoom
200
+        } = pevProps;
217
         const {
201
         const {
218
             _locationURL: newLocationURL,
202
             _locationURL: newLocationURL,
219
             _participantCount: newParticipantCount,
203
             _participantCount: newParticipantCount,
220
-            _room: newRoom
221
-        } = nextProps;
204
+            _room: newRoom,
205
+            _setToolboxVisible,
206
+            _toolboxVisible
207
+        } = this.props;
222
 
208
 
223
         // If the location URL changes we need to reconnect.
209
         // If the location URL changes we need to reconnect.
224
         oldLocationURL !== newLocationURL && this.props._onDisconnect();
210
         oldLocationURL !== newLocationURL && this.props._onDisconnect();
226
         // Start the connection process when there is a (valid) room.
212
         // Start the connection process when there is a (valid) room.
227
         oldRoom !== newRoom && newRoom && this.props._onConnect();
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
 

Laddar…
Avbryt
Spara