|
@@ -1,7 +1,7 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
3
|
3
|
import React, { PureComponent, type Node } from 'react';
|
4
|
|
-import { SafeAreaView, View } from 'react-native';
|
|
4
|
+import { Platform, SafeAreaView, View } from 'react-native';
|
5
|
5
|
|
6
|
6
|
import { ColorSchemeRegistry } from '../../../color-scheme';
|
7
|
7
|
import { SlidingView } from '../../../react';
|
|
@@ -36,21 +36,6 @@ type Props = {
|
36
|
36
|
* A component emulating Android's BottomSheet.
|
37
|
37
|
*/
|
38
|
38
|
class BottomSheet extends PureComponent<Props> {
|
39
|
|
- /**
|
40
|
|
- * Assembles a style for the BottomSheet container.
|
41
|
|
- *
|
42
|
|
- * @private
|
43
|
|
- * @returns {StyleType}
|
44
|
|
- */
|
45
|
|
- _getContainerStyle() {
|
46
|
|
- const { _styles } = this.props;
|
47
|
|
-
|
48
|
|
- return {
|
49
|
|
- ...styles.container,
|
50
|
|
- backgroundColor: _styles.sheet.backgroundColor
|
51
|
|
- };
|
52
|
|
- }
|
53
|
|
-
|
54
|
39
|
/**
|
55
|
40
|
* Implements React's {@link Component#render()}.
|
56
|
41
|
*
|
|
@@ -65,15 +50,44 @@ class BottomSheet extends PureComponent<Props> {
|
65
|
50
|
onHide = { this.props.onCancel }
|
66
|
51
|
position = 'bottom'
|
67
|
52
|
show = { true }>
|
68
|
|
- <SafeAreaView
|
69
|
|
- style = { this._getContainerStyle() }>
|
70
|
|
- <View style = { _styles.sheet }>
|
71
|
|
- { this.props.children }
|
|
53
|
+ <View
|
|
54
|
+ pointerEvents = 'box-none'
|
|
55
|
+ style = { styles.sheetContainer }>
|
|
56
|
+ <View
|
|
57
|
+ pointerEvents = 'box-none'
|
|
58
|
+ style = { styles.sheetAreaCover } />
|
|
59
|
+ <View
|
|
60
|
+ style = { [
|
|
61
|
+ styles.sheetItemContainer,
|
|
62
|
+ _styles.sheet
|
|
63
|
+ ] }>
|
|
64
|
+ { this._getWrappedContent() }
|
72
|
65
|
</View>
|
73
|
|
- </SafeAreaView>
|
|
66
|
+ </View>
|
74
|
67
|
</SlidingView>
|
75
|
68
|
);
|
76
|
69
|
}
|
|
70
|
+
|
|
71
|
+ /**
|
|
72
|
+ * Wraps the content when needed (iOS 11 and above), or just returns the original children.
|
|
73
|
+ *
|
|
74
|
+ * @returns {React$Element}
|
|
75
|
+ */
|
|
76
|
+ _getWrappedContent() {
|
|
77
|
+ if (Platform.OS === 'ios') {
|
|
78
|
+ const majorVersionIOS = parseInt(Platform.Version, 10);
|
|
79
|
+
|
|
80
|
+ if (majorVersionIOS > 10) {
|
|
81
|
+ return (
|
|
82
|
+ <SafeAreaView>
|
|
83
|
+ { this.props.children }
|
|
84
|
+ </SafeAreaView>
|
|
85
|
+ );
|
|
86
|
+ }
|
|
87
|
+ }
|
|
88
|
+
|
|
89
|
+ return this.props.children;
|
|
90
|
+ }
|
77
|
91
|
}
|
78
|
92
|
|
79
|
93
|
/**
|