Quellcode durchsuchen

fix(rn, tileview) Add SafeAreaView to Tile View (#10642)

master
Robert Pintilii vor 3 Jahren
Ursprung
Commit
a42483c84b
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
1 geänderte Dateien mit 20 neuen und 10 gelöschten Zeilen
  1. 20
    10
      react/features/filmstrip/components/native/TileView.js

+ 20
- 10
react/features/filmstrip/components/native/TileView.js Datei anzeigen

@@ -3,9 +3,10 @@
3 3
 import React, { PureComponent } from 'react';
4 4
 import {
5 5
     FlatList,
6
-    TouchableWithoutFeedback,
7
-    View
6
+    SafeAreaView,
7
+    TouchableWithoutFeedback
8 8
 } from 'react-native';
9
+import { withSafeAreaInsets } from 'react-native-safe-area-context';
9 10
 import type { Dispatch } from 'redux';
10 11
 
11 12
 import { getLocalParticipant, getParticipantCountWithFake } from '../../../base/participants';
@@ -71,6 +72,11 @@ type Props = {
71 72
      */
72 73
     dispatch: Dispatch<any>,
73 74
 
75
+    /**
76
+     * Object containing the safe area insets.
77
+     */
78
+    insets: Object,
79
+
74 80
     /**
75 81
      * Callback to invoke when tile view is tapped.
76 82
      */
@@ -126,7 +132,8 @@ class TileView extends PureComponent<Props> {
126 132
             ...styles.flatListTileView
127 133
         };
128 134
         this._contentContainerStyles = {
129
-            ...styles.contentContainer
135
+            ...styles.contentContainer,
136
+            paddingBottom: this.props.insets?.bottom || 0
130 137
         };
131 138
     }
132 139
 
@@ -194,13 +201,14 @@ class TileView extends PureComponent<Props> {
194 201
             this._contentContainerStyles = {
195 202
                 ...styles.contentContainer,
196 203
                 minHeight: _height,
197
-                minWidth: _width
204
+                minWidth: _width,
205
+                paddingBottom: this.props.insets?.bottom || 0
198 206
             };
199 207
         }
200 208
 
201 209
         return (
202 210
             <TouchableWithoutFeedback onPress = { onClick }>
203
-                <View style = { styles.flatListContainer }>
211
+                <SafeAreaView style = { styles.flatListContainer }>
204 212
                     <FlatList
205 213
                         bounces = { false }
206 214
                         contentContainerStyle = { this._contentContainerStyles }
@@ -217,7 +225,7 @@ class TileView extends PureComponent<Props> {
217 225
                         style = { this._flatListStyles }
218 226
                         viewabilityConfig = { this._viewabilityConfig }
219 227
                         windowSize = { 2 } />
220
-                </View>
228
+                </SafeAreaView>
221 229
             </TouchableWithoutFeedback>
222 230
         );
223 231
     }
@@ -269,10 +277,11 @@ class TileView extends PureComponent<Props> {
269 277
  * Maps (parts of) the redux state to the associated {@code TileView}'s props.
270 278
  *
271 279
  * @param {Object} state - The redux state.
280
+ * @param {Object} ownProps - Component props.
272 281
  * @private
273 282
  * @returns {Props}
274 283
  */
275
-function _mapStateToProps(state) {
284
+function _mapStateToProps(state, ownProps) {
276 285
     const responsiveUi = state['features/base/responsive-ui'];
277 286
     const { remoteParticipants, tileViewDimensions } = state['features/filmstrip'];
278 287
     const disableSelfView = shouldHideSelfView(state);
@@ -283,13 +292,14 @@ function _mapStateToProps(state) {
283 292
         _aspectRatio: responsiveUi.aspectRatio,
284 293
         _columns: columns,
285 294
         _disableSelfView: disableSelfView,
286
-        _height: responsiveUi.clientHeight,
295
+        _height: responsiveUi.clientHeight - (ownProps.insets?.top || 0),
296
+        _insets: ownProps.insets,
287 297
         _localParticipant: getLocalParticipant(state),
288 298
         _participantCount: getParticipantCountWithFake(state),
289 299
         _remoteParticipants: remoteParticipants,
290 300
         _thumbnailHeight: height,
291
-        _width: responsiveUi.clientWidth
301
+        _width: responsiveUi.clientWidth - (ownProps.insets?.right || 0) - (ownProps.insets?.left || 0)
292 302
     };
293 303
 }
294 304
 
295
-export default connect(_mapStateToProps)(TileView);
305
+export default withSafeAreaInsets(connect(_mapStateToProps)(TileView));

Laden…
Abbrechen
Speichern