@shoutem/ui 9.0.6 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Screen.js +10 -1
- package/helpers/device-selector.js +15 -6
- package/package.json +1 -1
- package/theme.js +0 -6
package/components/Screen.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { View } from 'react-native';
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
2
4
|
import { connectAnimation } from '@shoutem/animation';
|
|
3
5
|
import { connectStyle } from '@shoutem/theme';
|
|
4
6
|
|
|
5
|
-
const
|
|
7
|
+
const SafeAreaAwareView = ({ style, ...rest }) => {
|
|
8
|
+
const insets = useSafeAreaInsets();
|
|
9
|
+
const safeAreaStyle = { paddingBottom: insets.bottom };
|
|
10
|
+
|
|
11
|
+
return <View {...rest} style={[style, safeAreaStyle]} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const AnimatedScreen = connectAnimation(SafeAreaAwareView);
|
|
6
15
|
const Screen = connectStyle('shoutem.ui.Screen')(AnimatedScreen);
|
|
7
16
|
|
|
8
17
|
export { Screen };
|
|
@@ -26,10 +26,12 @@ export const NAVIGATION_BAR_HEIGHT = Platform.select({
|
|
|
26
26
|
default: NAVIGATION_HEADER_HEIGHT,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
// Bottom inset from the native safe-area module (home indicator on iOS,
|
|
30
|
+
// system nav bar on Android with edge-to-edge). Falls back to 34pt on iOS
|
|
31
|
+
// (race condition guard) or 0 on Android (no inset when edge-to-edge is off).
|
|
29
32
|
export const HOME_INDICATOR_PADDING =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
: 0;
|
|
33
|
+
initialWindowMetrics?.insets?.bottom ??
|
|
34
|
+
(Platform.OS === 'ios' ? DEFAULT_IOS_BOTTOM_INSET : 0);
|
|
33
35
|
|
|
34
36
|
export const NOTCH_AREA_HEIGHT = Platform.select({
|
|
35
37
|
ios: initialWindowMetrics?.insets?.top ?? DEFAULT_IOS_TOP_INSET,
|
|
@@ -65,7 +67,12 @@ const getBottomInset = () => {
|
|
|
65
67
|
// eslint-disable-next-line global-require
|
|
66
68
|
const metrics = require('react-native-safe-area-context')
|
|
67
69
|
.initialWindowMetrics;
|
|
68
|
-
|
|
70
|
+
|
|
71
|
+
// Use actual bottom inset if available. Fallback: 34pt on iOS (safe
|
|
72
|
+
// default for all notched iPhones), 0 on Android (no inset pre-RN 0.77).
|
|
73
|
+
_bottomInset =
|
|
74
|
+
metrics?.insets?.bottom ??
|
|
75
|
+
(Platform.OS === 'ios' ? DEFAULT_IOS_BOTTOM_INSET : 0);
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
return _bottomInset;
|
|
@@ -80,8 +87,10 @@ export const getNavigationBarHeight = () =>
|
|
|
80
87
|
default: NAVIGATION_HEADER_HEIGHT,
|
|
81
88
|
});
|
|
82
89
|
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
// Returns bottom safe area inset on both platforms. On iOS this is the home
|
|
91
|
+
// indicator area (34pt). On Android this is the system navigation bar height
|
|
92
|
+
// when edge-to-edge is enabled (RN 0.76+), or 0 on older RN versions.
|
|
93
|
+
export const getHomeIndicatorPadding = () => getBottomInset();
|
|
85
94
|
|
|
86
95
|
export const getNotchAreaHeight = () =>
|
|
87
96
|
Platform.select({
|
package/package.json
CHANGED
package/theme.js
CHANGED
|
@@ -977,12 +977,6 @@ export default () => {
|
|
|
977
977
|
paddingBottom: HOME_INDICATOR_PADDING,
|
|
978
978
|
},
|
|
979
979
|
|
|
980
|
-
'shoutem.ui.ListView': {
|
|
981
|
-
listContent: {
|
|
982
|
-
paddingBottom: HOME_INDICATOR_PADDING,
|
|
983
|
-
},
|
|
984
|
-
},
|
|
985
|
-
|
|
986
980
|
backgroundColor: resolveVariable('backgroundColor'),
|
|
987
981
|
flex: 1,
|
|
988
982
|
},
|