@shoutem/ui 9.1.0 → 9.1.1
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 +17 -3
- package/package.json +1 -1
package/components/Screen.js
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { Platform, View } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import { connectAnimation } from '@shoutem/animation';
|
|
5
5
|
import { connectStyle } from '@shoutem/theme';
|
|
6
6
|
|
|
7
7
|
const SafeAreaAwareView = ({ style, ...rest }) => {
|
|
8
8
|
const insets = useSafeAreaInsets();
|
|
9
|
-
const safeAreaStyle = { paddingBottom: insets.bottom };
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
// We only want Android bottom padding so content stays clear of Android
|
|
11
|
+
// software OS navigation. If no padding, content goes under and user is unable
|
|
12
|
+
// to see or press it.
|
|
13
|
+
// On iOS - home indicator is transparent, so the content is visible. We should add
|
|
14
|
+
// with-home-indicator-padding or paddingBottom for specific screens if there'll be
|
|
15
|
+
// pressable component that would hide under home indicator.
|
|
16
|
+
// Many screens already do this, so adding bottom inset by default on all screens would
|
|
17
|
+
// cut off too much of screen content - we'll rather add padding where necessary.
|
|
18
|
+
// Android will have this behavior as default because it's breaking UI bug.
|
|
19
|
+
const safeAreaStyle = {
|
|
20
|
+
paddingBottom: Platform.OS === 'android' ? insets.bottom : 0,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Keep style after safeAreaStyle so Screen style can override safe area style.
|
|
24
|
+
// with-home-indicator-padding and other classes already do this with theme resolution process.
|
|
25
|
+
return <View {...rest} style={[safeAreaStyle, style]} />;
|
|
12
26
|
};
|
|
13
27
|
|
|
14
28
|
const AnimatedScreen = connectAnimation(SafeAreaAwareView);
|