Bladeren bron

fix(mobile-pagination): address PR review comments

master
Hristo Terezov 4 jaren geleden
bovenliggende
commit
b31ed40309

+ 1
- 1
react/features/filmstrip/components/native/Filmstrip.js Bestand weergeven

237
                     renderItem = { this._renderThumbnail }
237
                     renderItem = { this._renderThumbnail }
238
                     showsHorizontalScrollIndicator = { false }
238
                     showsHorizontalScrollIndicator = { false }
239
                     showsVerticalScrollIndicator = { false }
239
                     showsVerticalScrollIndicator = { false }
240
-                    style = { styles.scrollView }
240
+                    style = { styles.flatListStageView }
241
                     viewabilityConfig = { this._viewabilityConfig }
241
                     viewabilityConfig = { this._viewabilityConfig }
242
                     windowSize = { 2 } />
242
                     windowSize = { 2 } />
243
                 {
243
                 {

+ 51
- 37
react/features/filmstrip/components/native/Thumbnail.js Bestand weergeven

52
     _isFakeParticipant: boolean,
52
     _isFakeParticipant: boolean,
53
 
53
 
54
     /**
54
     /**
55
-     * Indicates whether the participant is fake.
55
+     * Indicates whether the participant is screen sharing.
56
      */
56
      */
57
     _isScreenShare: boolean,
57
     _isScreenShare: boolean,
58
 
58
 
200
     }
200
     }
201
 
201
 
202
     /**
202
     /**
203
-     * Implements React's {@link Component#render()}.
203
+     * Renders the indicators for the thumbnail.
204
      *
204
      *
205
-     * @inheritdoc
206
      * @returns {ReactElement}
205
      * @returns {ReactElement}
207
      */
206
      */
208
-    render() {
207
+    _renderIndicators() {
209
         const {
208
         const {
210
             _audioMuted: audioMuted,
209
             _audioMuted: audioMuted,
211
             _isScreenShare: isScreenShare,
210
             _isScreenShare: isScreenShare,
213
             _renderDominantSpeakerIndicator: renderDominantSpeakerIndicator,
212
             _renderDominantSpeakerIndicator: renderDominantSpeakerIndicator,
214
             _renderModeratorIndicator: renderModeratorIndicator,
213
             _renderModeratorIndicator: renderModeratorIndicator,
215
             _participantId: participantId,
214
             _participantId: participantId,
215
+            _videoMuted: videoMuted
216
+        } = this.props;
217
+        const indicators = [];
218
+
219
+        if (renderModeratorIndicator) {
220
+            indicators.push(<View style = { styles.moderatorIndicatorContainer }>
221
+                <ModeratorIndicator />
222
+            </View>);
223
+        }
224
+
225
+        if (!_isFakeParticipant) {
226
+            indicators.push(<View
227
+                style = { [
228
+                    styles.thumbnailTopIndicatorContainer,
229
+                    styles.thumbnailTopLeftIndicatorContainer
230
+                ] }>
231
+                <RaisedHandIndicator participantId = { participantId } />
232
+                { renderDominantSpeakerIndicator && <DominantSpeakerIndicator /> }
233
+            </View>);
234
+            indicators.push(<View
235
+                style = { [
236
+                    styles.thumbnailTopIndicatorContainer,
237
+                    styles.thumbnailTopRightIndicatorContainer
238
+                ] }>
239
+                <ConnectionIndicator participantId = { participantId } />
240
+            </View>);
241
+            indicators.push(<Container style = { styles.thumbnailIndicatorContainer }>
242
+                { audioMuted && <AudioMutedIndicator /> }
243
+                { videoMuted && <VideoMutedIndicator /> }
244
+                { isScreenShare && <ScreenShareIndicator /> }
245
+            </Container>);
246
+        }
247
+
248
+        return indicators;
249
+    }
250
+
251
+    /**
252
+     * Implements React's {@link Component#render()}.
253
+     *
254
+     * @inheritdoc
255
+     * @returns {ReactElement}
256
+     */
257
+    render() {
258
+        const {
259
+            _isScreenShare: isScreenShare,
260
+            _isFakeParticipant,
261
+            _participantId: participantId,
216
             _participantInLargeVideo: participantInLargeVideo,
262
             _participantInLargeVideo: participantInLargeVideo,
217
             _pinned,
263
             _pinned,
218
             _styles,
264
             _styles,
219
-            _videoMuted: videoMuted,
220
             disableTint,
265
             disableTint,
221
             height,
266
             height,
222
             renderDisplayName,
267
             renderDisplayName,
255
                             <DisplayNameLabel participantId = { participantId } />
300
                             <DisplayNameLabel participantId = { participantId } />
256
                         </Container>
301
                         </Container>
257
                 }
302
                 }
258
-                { renderModeratorIndicator
259
-                    && <View style = { styles.moderatorIndicatorContainer }>
260
-                        <ModeratorIndicator />
261
-                    </View>
262
-                }
263
-                {
264
-                    !_isFakeParticipant
265
-                        && <View
266
-                            style = { [
267
-                                styles.thumbnailTopIndicatorContainer,
268
-                                styles.thumbnailTopLeftIndicatorContainer
269
-                            ] }>
270
-                            <RaisedHandIndicator participantId = { participantId } />
271
-                            { renderDominantSpeakerIndicator && <DominantSpeakerIndicator /> }
272
-                        </View>
273
-                }
274
                 {
303
                 {
275
-                    !_isFakeParticipant
276
-                        && <View
277
-                            style = { [
278
-                                styles.thumbnailTopIndicatorContainer,
279
-                                styles.thumbnailTopRightIndicatorContainer
280
-                            ] }>
281
-                            <ConnectionIndicator participantId = { participantId } />
282
-                        </View>
283
-                }
284
-                {
285
-                    !_isFakeParticipant
286
-                        && <Container style = { styles.thumbnailIndicatorContainer }>
287
-                            { audioMuted && <AudioMutedIndicator /> }
288
-                            { videoMuted && <VideoMutedIndicator /> }
289
-                            { isScreenShare && <ScreenShareIndicator /> }
290
-                        </Container>
304
+                    this._renderIndicators()
291
                 }
305
                 }
292
             </Container>
306
             </Container>
293
         );
307
         );

+ 12
- 5
react/features/filmstrip/components/native/TileView.js Bestand weergeven

71
     onClick: Function
71
     onClick: Function
72
 };
72
 };
73
 
73
 
74
+/**
75
+ * An empty array. The purpose of the constant is to use the same reference every time we need an empty array.
76
+ * This will prevent unnecessary re-renders.
77
+ */
78
+const EMPTY_ARRAY = [];
79
+
74
 /**
80
 /**
75
  * Implements a React {@link PureComponent} which displays thumbnails in a two
81
  * Implements a React {@link PureComponent} which displays thumbnails in a two
76
  * dimensional grid.
82
  * dimensional grid.
109
             itemVisiblePercentThreshold: 30
115
             itemVisiblePercentThreshold: 30
110
         };
116
         };
111
         this._flatListStyles = {
117
         this._flatListStyles = {
112
-            ...styles.flatList
118
+            ...styles.flatListTileView
113
         };
119
         };
114
         this._contentContainerStyles = {
120
         this._contentContainerStyles = {
115
             ...styles.contentContainer
121
             ...styles.contentContainer
162
 
168
 
163
         if (this._flatListStyles.minHeight !== _height || this._flatListStyles.minWidth !== _width) {
169
         if (this._flatListStyles.minHeight !== _height || this._flatListStyles.minWidth !== _width) {
164
             this._flatListStyles = {
170
             this._flatListStyles = {
165
-                ...styles.flatList,
171
+                ...styles.flatListTileView,
166
                 minHeight: _height,
172
                 minHeight: _height,
167
                 minWidth: _width
173
                 minWidth: _width
168
             };
174
             };
207
      */
213
      */
208
     _getSortedParticipants() {
214
     _getSortedParticipants() {
209
         const { _localParticipant, _remoteParticipants } = this.props;
215
         const { _localParticipant, _remoteParticipants } = this.props;
210
-        const participants = [];
211
 
216
 
212
-        _localParticipant && participants.push(_localParticipant.id);
217
+        if (!_localParticipant) {
218
+            return EMPTY_ARRAY;
219
+        }
213
 
220
 
214
-        return [ ...participants, ..._remoteParticipants ];
221
+        return [ _localParticipant?.id, ..._remoteParticipants ];
215
     }
222
     }
216
 
223
 
217
     _renderThumbnail: Object => Object;
224
     _renderThumbnail: Object => Object;

+ 9
- 9
react/features/filmstrip/components/native/styles.js Bestand weergeven

71
     },
71
     },
72
 
72
 
73
     /**
73
     /**
74
-     * The styles for the FlatList.
74
+     * The styles for the FlatList component in stage view.
75
      */
75
      */
76
-    flatList: {
76
+    flatListStageView: {
77
+        flexGrow: 0
78
+    },
79
+
80
+    /**
81
+     * The styles for the FlatList component in tile view.
82
+     */
83
+    flatListTileView: {
77
         flex: 0
84
         flex: 0
78
     },
85
     },
79
 
86
 
94
         right: 4
101
         right: 4
95
     },
102
     },
96
 
103
 
97
-    /**
98
-     * The style of the scrollview containing the remote thumbnails.
99
-     */
100
-    scrollView: {
101
-        flexGrow: 0
102
-    },
103
-
104
     /**
104
     /**
105
      * The style of a participant's Thumbnail which renders either the video or
105
      * The style of a participant's Thumbnail which renders either the video or
106
      * the avatar of the associated participant.
106
      * the avatar of the associated participant.

+ 5
- 0
react/features/filmstrip/middleware.native.js Bestand weergeven

13
  */
13
  */
14
 MiddlewareRegistry.register(store => next => action => {
14
 MiddlewareRegistry.register(store => next => action => {
15
     if (action.type === PARTICIPANT_LEFT) {
15
     if (action.type === PARTICIPANT_LEFT) {
16
+        // This have to be executed before we remove the participant from features/base/participants state in order to
17
+        // remove the related thumbnail component before we need to re-render it. If we do this after next()
18
+        // we will be in sitation where the participant exists in the remoteParticipants array in features/filmstrip
19
+        // but doesn't exist in features/base/participants state which will lead to rendering a thumbnail for
20
+        // non-existing participant.
16
         updateRemoteParticipantsOnLeave(store, action.participant?.id);
21
         updateRemoteParticipantsOnLeave(store, action.participant?.id);
17
     }
22
     }
18
 
23
 

Laden…
Annuleren
Opslaan