瀏覽代碼

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

master
Robert Pintilii 3 年之前
父節點
當前提交
a42483c84b
No account linked to committer's email address
共有 1 個文件被更改,包括 20 次插入10 次删除
  1. 20
    10
      react/features/filmstrip/components/native/TileView.js

+ 20
- 10
react/features/filmstrip/components/native/TileView.js 查看文件

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

Loading…
取消
儲存