@sudobility/building_blocks_rn 0.0.44 → 0.0.45
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.
|
@@ -12,14 +12,17 @@ import { View, StyleSheet } from 'react-native';
|
|
|
12
12
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
13
13
|
import { BottomTabBarHeightContext } from '@react-navigation/bottom-tabs';
|
|
14
14
|
import { createThemedStyles } from '../../utils/styles';
|
|
15
|
+
const SPACING = 16;
|
|
15
16
|
export function BottomActionBar({ children, style }) {
|
|
16
17
|
const styles = useStyles();
|
|
17
18
|
const insets = useSafeAreaInsets();
|
|
18
19
|
const tabBarHeight = useContext(BottomTabBarHeightContext);
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
|
|
20
|
+
// Above a tab/tool bar: it already covers the home indicator, so just add
|
|
21
|
+
// spacing above it. Otherwise: sit above the bottom safe-area inset with
|
|
22
|
+
// spacing. (Inside a modal, reset BottomTabBarHeightContext so this takes
|
|
23
|
+
// the no-tab-bar branch — the tab bar isn't actually below the modal.)
|
|
24
|
+
const hasTabBar = (tabBarHeight ?? 0) > 0;
|
|
25
|
+
const paddingBottom = hasTabBar ? SPACING : insets.bottom + SPACING;
|
|
23
26
|
return _jsx(View, { style: [styles.bar, { paddingBottom }, style], children: children });
|
|
24
27
|
}
|
|
25
28
|
const useStyles = createThemedStyles(colors => ({
|