@momo-kits/foundation 0.168.1-beta.39 → 0.168.1-beta.40

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.
Files changed (153) hide show
  1. package/Application/BottomSheet.tsx +398 -86
  2. package/Application/BottomTab/BottomTabBar.tsx +275 -215
  3. package/Application/BottomTab/CustomBottomTabItem.tsx +107 -131
  4. package/Application/BottomTab/DuoBarCompression.tsx +28 -14
  5. package/Application/BottomTab/DuoTabBar.tsx +540 -32
  6. package/Application/BottomTab/TabBarIcon.tsx +72 -146
  7. package/Application/BottomTab/index.tsx +353 -89
  8. package/Application/BottomTab/useLiquidSelection.ts +374 -0
  9. package/Application/Components/BackgroundImageView.tsx +0 -4
  10. package/Application/Components/DuoGlassBackground.tsx +5 -7
  11. package/Application/Components/HeaderAnimated.tsx +13 -41
  12. package/Application/Components/HeaderBackground.tsx +3 -20
  13. package/Application/Components/HeaderExtendHeader.tsx +46 -66
  14. package/Application/Components/HeaderLeft.tsx +18 -5
  15. package/Application/Components/HeaderRight.tsx +529 -8
  16. package/Application/Components/HeaderTitle.tsx +579 -16
  17. package/Application/Components/NavigationButton.tsx +11 -18
  18. package/Application/Components/SearchHeader.tsx +18 -38
  19. package/Application/Localize.ts +0 -7
  20. package/Application/ModalScreen.tsx +18 -41
  21. package/Application/Navigation.ts +17 -15
  22. package/Application/NavigationContainer.tsx +21 -23
  23. package/Application/Navigator.ts +48 -20
  24. package/Application/ScaleSizeProvider.tsx +6 -13
  25. package/Application/StackScreen.tsx +172 -27
  26. package/Application/TooltipPortal.tsx +5 -12
  27. package/Application/WidgetContainer.tsx +7 -20
  28. package/Application/device.ts +52 -0
  29. package/Application/index.ts +1 -23
  30. package/Application/types.ts +242 -17
  31. package/Application/utils.tsx +493 -0
  32. package/Badge/Badge.tsx +0 -5
  33. package/Badge/BadgeDot.tsx +0 -1
  34. package/Badge/BadgeDotAnimation.tsx +7 -15
  35. package/Badge/BadgeRibbon.tsx +39 -47
  36. package/Badge/Shape.tsx +0 -2
  37. package/Badge/styles.ts +0 -2
  38. package/Badge/types.ts +2 -2
  39. package/Button/index.tsx +152 -21
  40. package/Button/styles.ts +1 -1
  41. package/CheckBox/index.tsx +6 -5
  42. package/Consts/theme.ts +10 -10
  43. package/Context/index.ts +1 -5
  44. package/Divider/DashDivider.tsx +11 -11
  45. package/Divider/index.tsx +7 -21
  46. package/FoundationList/index.tsx +0 -4
  47. package/Icon/index.tsx +6 -6
  48. package/Icon/types.ts +1 -1
  49. package/IconButton/index.tsx +12 -4
  50. package/Image/index.tsx +7 -9
  51. package/Input/Input.tsx +12 -10
  52. package/Input/InputDropDown.tsx +13 -10
  53. package/Input/InputMoney.tsx +152 -45
  54. package/Input/InputOTP.tsx +34 -36
  55. package/Input/InputPhoneNumber.tsx +5 -8
  56. package/Input/InputSearch.tsx +111 -19
  57. package/Input/InputTextArea.tsx +5 -5
  58. package/Input/SystemTextInput.tsx +2 -7
  59. package/Input/TextTyping.tsx +0 -4
  60. package/Input/common.tsx +17 -31
  61. package/Input/index.tsx +21 -24
  62. package/Input/styles.ts +5 -25
  63. package/Input/utils.ts +12 -14
  64. package/Layout/Card.tsx +4 -7
  65. package/Layout/FloatingButton.tsx +21 -26
  66. package/Layout/Item.tsx +2 -6
  67. package/Layout/ItemList.tsx +7 -9
  68. package/Layout/ItemSectionList.tsx +1 -2
  69. package/Layout/ReservedRegions.tsx +17 -34
  70. package/Layout/Screen.tsx +696 -122
  71. package/Layout/Section.tsx +7 -9
  72. package/Layout/TrackingScope.tsx +0 -1
  73. package/Layout/index.ts +4 -10
  74. package/Layout/styles.ts +0 -2
  75. package/Layout/types.ts +4 -2
  76. package/Layout/utils.ts +181 -40
  77. package/Loader/DotLoader.tsx +3 -11
  78. package/Loader/Loader.tsx +0 -4
  79. package/Loader/ProgressBar.tsx +6 -3
  80. package/Loader/Spinner.tsx +3 -11
  81. package/Loader/styles.ts +0 -4
  82. package/Loader/utils.ts +7 -11
  83. package/Pagination/Dot.tsx +0 -4
  84. package/Pagination/PaginationDot.tsx +0 -1
  85. package/Pagination/PaginationNumber.tsx +3 -5
  86. package/Pagination/PaginationScroll.tsx +0 -5
  87. package/Pagination/PaginationWhiteDot.tsx +0 -1
  88. package/Pagination/index.tsx +0 -4
  89. package/Pagination/types.ts +2 -2
  90. package/Popup/PopupNotify.tsx +102 -94
  91. package/Popup/PopupPromotion.tsx +11 -9
  92. package/Popup/types.ts +4 -11
  93. package/Popup/utils.ts +18 -50
  94. package/Radio/index.tsx +10 -6
  95. package/Radio/styles.ts +0 -6
  96. package/Skeleton/index.tsx +9 -9
  97. package/Skeleton/styles.ts +0 -1
  98. package/Switch/index.tsx +0 -1
  99. package/Tag/index.tsx +4 -8
  100. package/Tag/types.ts +3 -3
  101. package/Text/index.tsx +5 -25
  102. package/Text/styles.ts +1 -1
  103. package/Text/types.ts +6 -1
  104. package/Text/utils.ts +4 -20
  105. package/Title/index.tsx +40 -42
  106. package/Title/styles.ts +0 -6
  107. package/ViewBoundary/index.tsx +2 -4
  108. package/index.ts +6 -0
  109. package/package.json +1 -2
  110. package/Application/BottomSheet.hooks.ts +0 -195
  111. package/Application/BottomSheet.parts.tsx +0 -157
  112. package/Application/BottomSheet.styles.ts +0 -43
  113. package/Application/BottomTab/ActiveIndicator.tsx +0 -91
  114. package/Application/BottomTab/BottomTabBar.styles.ts +0 -65
  115. package/Application/BottomTab/BottomTabInset.tsx +0 -18
  116. package/Application/BottomTab/CurvedContainer.tsx +0 -155
  117. package/Application/BottomTab/DuoRailTabBar.tsx +0 -223
  118. package/Application/BottomTab/DuoTabBar.styles.ts +0 -81
  119. package/Application/BottomTab/TabScreen.tsx +0 -160
  120. package/Application/BottomTab/metrics.ts +0 -164
  121. package/Application/BottomTab/tabItems.ts +0 -46
  122. package/Application/BottomTab/usePressLift.ts +0 -32
  123. package/Application/Components/HeaderRight.styles.ts +0 -146
  124. package/Application/Components/HeaderTitle.shared.ts +0 -44
  125. package/Application/Components/HeaderTitle.styles.ts +0 -125
  126. package/Application/Components/HeaderToolkitAction.tsx +0 -180
  127. package/Application/Components/SwipeBackHaptic.tsx +0 -95
  128. package/Application/Components/TitleJourney.tsx +0 -110
  129. package/Application/Components/TitleLocation.tsx +0 -73
  130. package/Application/Components/TitleUser.tsx +0 -304
  131. package/Application/Components/useToolkitActions.tsx +0 -218
  132. package/Application/ModalIconButton.tsx +0 -66
  133. package/Application/StackScreen.tracking.ts +0 -143
  134. package/Application/headerLayout.ts +0 -158
  135. package/Application/hooks.ts +0 -137
  136. package/Application/modalLayout.ts +0 -176
  137. package/Application/navigationOptions.tsx +0 -212
  138. package/Application/types.header.ts +0 -121
  139. package/Application/types.tabs.ts +0 -48
  140. package/Application/types.theme.ts +0 -87
  141. package/Application/utils.ts +0 -107
  142. package/Button/utils.ts +0 -133
  143. package/Input/InputMoneyView.tsx +0 -194
  144. package/Input/SearchTextTyping.tsx +0 -108
  145. package/Input/moneyUtils.ts +0 -23
  146. package/Layout/layoutMetrics.ts +0 -58
  147. package/Layout/layoutTypes.ts +0 -86
  148. package/Layout/screenContent.tsx +0 -92
  149. package/Layout/screenFooter.tsx +0 -63
  150. package/Layout/screenHeader.tsx +0 -321
  151. package/Layout/screenQuickReturn.tsx +0 -64
  152. package/Layout/screenScroll.ts +0 -107
  153. package/Layout/screenTypes.ts +0 -143
@@ -1,263 +1,323 @@
1
1
  import { BottomTabBarProps } from '@react-navigation/bottom-tabs';
2
- import React, { useContext, useState } from 'react';
3
- import { Platform, Pressable, useWindowDimensions, View } from 'react-native';
2
+ import { CommonActions, Route } from '@react-navigation/native';
3
+ import React, { useCallback, useContext } from 'react';
4
+ import {
5
+ Platform,
6
+ StyleSheet,
7
+ TouchableOpacity,
8
+ useWindowDimensions,
9
+ View,
10
+ } from 'react-native';
4
11
  import Animated, {
5
12
  useAnimatedStyle,
6
13
  useSharedValue,
7
14
  withTiming,
8
15
  } from 'react-native-reanimated';
9
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
- import { Colors, Spacing } from '../../Consts';
16
+ import { EdgeInsets, useSafeAreaInsets } from 'react-native-safe-area-context';
17
+ import { Colors, Radius, Styles } from '../../Consts';
11
18
  import { Icon } from '../../Icon';
12
19
  import { Text } from '../../Text';
13
20
  import { FloatingButtonProps } from '../types';
14
21
  import CustomBottomTabItem from './CustomBottomTabItem';
15
22
  import { ApplicationContext, MiniAppContext } from '../../Context';
16
- import { CurvedContainer } from './CurvedContainer';
17
- import { ActiveIndicator } from './ActiveIndicator';
18
- import { getHorizontalBarWidth, TabBarMetrics, TabBarMotion } from './metrics';
19
- import { getTabItems, TabItem } from './tabItems';
20
- import { styles } from './BottomTabBar.styles';
21
23
 
22
24
  type Props = BottomTabBarProps & {
23
- activeTintColor: string;
24
- inactiveTintColor: string;
25
+ activeTintColor?: string;
26
+ inactiveTintColor?: string;
25
27
  floatingButton?: FloatingButtonProps;
28
+ activeBackgroundColor?: string;
29
+ allowFontScaling?: boolean;
30
+ inactiveBackgroundColor?: string;
31
+ labelStyle?: any;
32
+ iconStyle?: any;
33
+ showLabel?: boolean;
34
+ style?: any;
35
+ tabStyle?: any;
36
+ badgeStyle?: any;
26
37
  };
27
38
 
28
- /**
29
- * Whether the bar shows the center action. It needs a tab on each side, so the
30
- * Special type takes 2 or 4 tabs.
31
- */
32
- const hasCenterAction = (floatingButton: unknown, tabCount: number) => {
33
- return !!floatingButton && tabCount % 2 === 0;
39
+ const getPaddingBottom = (insets: EdgeInsets) => {
40
+ return Math.max(insets.bottom - Platform.select({ ios: 4, default: 0 }), 0);
34
41
  };
35
42
 
36
- /**
37
- * Gap under the bar container for the home indicator / gesture bar area, at
38
- * least `Spacing.S`; iOS caps it at the indicator height.
39
- */
40
- const getSystemIndicatorHeight = (bottomInset: number) => {
41
- let height = bottomInset;
42
- if (Platform.OS === 'ios') {
43
- height = Math.min(bottomInset, TabBarMetrics.systemIndicatorHeight);
44
- }
45
- return Math.max(height, Spacing.S);
46
- };
43
+ export default function BottomTabBar({
44
+ state,
45
+ navigation,
46
+ descriptors,
47
+ activeBackgroundColor,
48
+ activeTintColor,
49
+ allowFontScaling,
50
+ inactiveBackgroundColor,
51
+ inactiveTintColor,
52
+ labelStyle,
53
+ iconStyle,
54
+ showLabel,
55
+ style,
56
+ floatingButton,
57
+ }: Props) {
58
+ const { theme } = useContext(ApplicationContext);
59
+ const { routes } = state;
60
+ const widthDevice = useWindowDimensions()?.width;
61
+ const insets = useSafeAreaInsets();
62
+ const useFloating = floatingButton && state.routes.length % 2 === 0;
63
+ const itemWidth =
64
+ (widthDevice - insets.left - insets.right) /
65
+ (state.routes.length + (useFloating ? 1 : 0));
66
+ // const buildLink = useLinkBuilder();
67
+ const indicatorAnimated = useSharedValue(0);
47
68
 
48
- /**
49
- * Press feedback of the center action: the button shrinks while held, the label
50
- * stays still.
51
- */
52
- const useCenterActionPress = () => {
53
- const scale = useSharedValue(1);
54
- const buttonStyle = useAnimatedStyle(() => ({
55
- transform: [{ scale: scale.value }],
69
+ const indicatorStyle = useAnimatedStyle(() => ({
70
+ width: itemWidth,
71
+ transform: [{ translateX: indicatorAnimated.value }],
56
72
  }));
57
- const onPressIn = () => {
58
- scale.value = withTiming(
59
- TabBarMotion.ctaPressedScale,
60
- TabBarMotion.ctaPress,
61
- );
62
- };
63
- const onPressOut = () => {
64
- scale.value = withTiming(1, TabBarMotion.ctaPress);
65
- };
66
- return { buttonStyle, onPressIn, onPressOut };
67
- };
73
+ const paddingBottom = getPaddingBottom(insets);
74
+ const focusedTab = state?.routes[state.index]?.name || routes[0]?.params;
68
75
 
69
- /**
70
- * Center action (.Nav/CTA): a button rising out of the notch, its label below
71
- * (growing downward when scaled).
72
- */
73
- const CenterAction: React.FC<{ floatingButton: FloatingButtonProps }> = ({
74
- floatingButton,
75
- }) => {
76
- const { theme } = useContext(ApplicationContext);
77
76
  const context = useContext<any>(MiniAppContext);
78
77
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
79
- const { icon, label, onPress, labelContent } = floatingButton;
80
- const { buttonStyle, onPressIn, onPressOut } = useCenterActionPress();
81
- let iconNode = icon;
82
- if (typeof icon === 'string') {
83
- iconNode = (
84
- <Icon
85
- source={icon}
86
- size={TabBarMetrics.ctaIconSize}
87
- color={Colors.black_01}
88
- />
89
- );
90
- }
91
78
 
92
- return (
93
- <View style={[styles.ctaSlot, showBaseLineDebug && styles.debugBaseLine]}>
94
- <Pressable
95
- accessibilityRole={'button'}
96
- accessibilityLabel={label}
97
- onPress={onPress}
98
- onPressIn={onPressIn}
99
- onPressOut={onPressOut}
100
- style={styles.cta}
101
- >
102
- <Animated.View
103
- style={[
104
- styles.ctaButton,
105
- { backgroundColor: theme.colors.primary },
106
- buttonStyle,
107
- ]}
108
- >
109
- {iconNode}
110
- </Animated.View>
111
- <View style={styles.ctaLabel}>
112
- <Text
113
- numberOfLines={1}
114
- typography={'label_s_medium'}
115
- color={theme.colors.text.secondary}
116
- >
117
- {label}
118
- </Text>
119
- {labelContent && (
120
- <View pointerEvents={'none'} style={styles.ctaLabelOverlay}>
121
- {labelContent}
122
- </View>
123
- )}
124
- </View>
125
- </Pressable>
126
- </View>
79
+ /**
80
+ * render tab item
81
+ */
82
+ const renderTabItem = useCallback(
83
+ (data: Route<string, any>[]) => {
84
+ return data?.map(route => {
85
+ const focused = route?.params?.name === focusedTab;
86
+ const { options } = descriptors[route.key];
87
+
88
+ const onPress = () => {
89
+ const event = navigation.emit({
90
+ type: 'tabPress',
91
+ target: route.key,
92
+ canPreventDefault: true,
93
+ });
94
+
95
+ if (!focused && !event.defaultPrevented) {
96
+ navigation.dispatch({
97
+ ...CommonActions.navigate(route.name),
98
+ target: state.key,
99
+ });
100
+ }
101
+ };
102
+
103
+ const onLongPress = () => {
104
+ navigation.emit({
105
+ type: 'tabLongPress',
106
+ target: route.key,
107
+ });
108
+ };
109
+
110
+ return (
111
+ <CustomBottomTabItem
112
+ key={route.key}
113
+ route={route}
114
+ label={options.tabBarLabel || options.title || route.name}
115
+ focused={focused}
116
+ onPress={onPress}
117
+ onLongPress={onLongPress}
118
+ activeTintColor={activeTintColor ?? theme.colors.primary}
119
+ inactiveTintColor={inactiveTintColor ?? theme.colors.text.default}
120
+ activeBackgroundColor={activeBackgroundColor}
121
+ inactiveBackgroundColor={inactiveBackgroundColor}
122
+ icon={options.tabBarIcon}
123
+ badge={options.tabBarBadge}
124
+ showLabel={showLabel}
125
+ labelStyle={labelStyle}
126
+ iconStyle={iconStyle}
127
+ style={options.tabBarStyle}
128
+ badgeStyle={options.tabBarBadgeStyle}
129
+ allowFontScaling={allowFontScaling}
130
+ />
131
+ );
132
+ });
133
+ },
134
+ [
135
+ focusedTab,
136
+ descriptors,
137
+ activeTintColor,
138
+ theme.colors.primary,
139
+ theme.colors.text.default,
140
+ inactiveTintColor,
141
+ activeBackgroundColor,
142
+ inactiveBackgroundColor,
143
+ showLabel,
144
+ labelStyle,
145
+ iconStyle,
146
+ allowFontScaling,
147
+ navigation,
148
+ state.key,
149
+ ],
127
150
  );
128
- };
129
151
 
130
- /**
131
- * Horizontal navigation bar: a floating container with evenly split items; the
132
- * Special type puts the center action in a notch in the middle.
133
- */
134
- const HorizontalTabBar: React.FC<{
135
- items: TabItem[];
136
- width: number;
137
- activeTintColor: string;
138
- inactiveTintColor: string;
139
- floatingButton?: FloatingButtonProps;
140
- }> = ({ items, width, activeTintColor, inactiveTintColor, floatingButton }) => {
141
- const withCta = hasCenterAction(floatingButton, items.length);
142
- const [layouts, setLayouts] = useState<
143
- Record<string, { x: number; y: number; width: number }>
144
- >({});
145
- const selected = layouts[items.find(item => item.focused)?.route.key ?? ''];
152
+ /**
153
+ * render floating button
154
+ */
155
+ const renderFloatingButton = useCallback(() => {
156
+ const renderFloatingIcon = () => {
157
+ if (typeof floatingButton?.icon === 'string') {
158
+ return <Icon source={floatingButton?.icon} size={32} color={'white'} />;
159
+ }
160
+ return floatingButton?.icon;
161
+ };
146
162
 
147
- const renderItems = (data: TabItem[]) => {
148
- return data.map(item => (
149
- <CustomBottomTabItem
150
- key={item.route.key}
151
- onLayout={e => {
152
- const { x, y, width: itemWidth } = e.nativeEvent.layout;
153
- setLayouts(prev => ({
154
- ...prev,
155
- [item.route.key]: { x, y, width: itemWidth },
156
- }));
157
- }}
158
- label={item.label}
159
- focused={item.focused}
160
- icon={item.icon}
161
- badge={item.badge}
162
- onPress={item.onPress}
163
- onLongPress={item.onLongPress}
164
- activeTintColor={activeTintColor}
165
- inactiveTintColor={inactiveTintColor}
166
- />
167
- ));
168
- };
163
+ return (
164
+ <View style={[Styles.flex, showBaseLineDebug && styles.debugBaseLine]}>
165
+ <TouchableOpacity
166
+ onPress={floatingButton?.onPress}
167
+ style={styles.floatingContainer}
168
+ >
169
+ <View
170
+ style={{
171
+ ...styles.floatingContent,
172
+ backgroundColor: activeTintColor ?? theme.colors.primary,
173
+ }}
174
+ >
175
+ {renderFloatingIcon()}
176
+ </View>
177
+ <View
178
+ style={{
179
+ top: -4,
180
+ backgroundColor: activeTintColor ?? theme.colors.primary,
181
+ borderRadius: Radius.XL,
182
+ paddingHorizontal: 6,
183
+ }}
184
+ >
185
+ <Text
186
+ numberOfLines={1}
187
+ typography={'description_xs_regular'}
188
+ color={'white'}
189
+ >
190
+ {floatingButton?.label}
191
+ </Text>
192
+ </View>
193
+ </TouchableOpacity>
194
+ </View>
195
+ );
196
+ }, [
197
+ activeTintColor,
198
+ floatingButton?.icon,
199
+ floatingButton?.label,
200
+ floatingButton?.onPress,
201
+ showBaseLineDebug,
202
+ theme.colors.primary,
203
+ ]);
169
204
 
170
- const renderContent = () => {
171
- if (withCta && floatingButton) {
172
- const middle = items.length / 2;
205
+ /**
206
+ * animated indicator
207
+ */
208
+ React.useEffect(() => {
209
+ let index = state.index;
210
+ if (useFloating && index > (state.routes.length - 1) / 2) {
211
+ index += 1;
212
+ }
213
+ indicatorAnimated.value = withTiming(itemWidth * index, { duration: 200 });
214
+ }, [
215
+ state.index,
216
+ itemWidth,
217
+ indicatorAnimated,
218
+ useFloating,
219
+ state.routes.length,
220
+ ]);
221
+
222
+ /**
223
+ * render tab bar
224
+ */
225
+ const renderTabBar = () => {
226
+ if (useFloating) {
227
+ const middleIndex = routes.length / 2;
228
+ const leftArr = routes.slice(0, middleIndex);
229
+ const rightArr = routes.slice(middleIndex);
173
230
  return (
174
231
  <>
175
- {renderItems(items.slice(0, middle))}
176
- <CenterAction floatingButton={floatingButton} />
177
- {renderItems(items.slice(middle))}
232
+ {renderTabItem(leftArr)}
233
+ {renderFloatingButton()}
234
+ {renderTabItem(rightArr)}
178
235
  </>
179
236
  );
180
237
  }
181
- return renderItems(items);
238
+ return renderTabItem(routes);
182
239
  };
183
240
 
184
- const customContainer = withCta && floatingButton?.container;
185
-
186
241
  return (
187
242
  <View
188
- style={[styles.container, { width }]}
189
- accessibilityLabel={'bottom_tab_bar'}
190
- >
191
- {customContainer || (
192
- <CurvedContainer
193
- width={width}
194
- height={TabBarMetrics.height}
195
- radius={TabBarMetrics.height / 2}
196
- notchCenterX={withCta ? width / 2 : undefined}
197
- />
198
- )}
199
- <View style={styles.content}>
200
- <ActiveIndicator
201
- axis={'x'}
202
- offset={selected?.x}
203
- extent={selected?.width}
204
- radius={TabBarMetrics.indicatorRadius}
205
- style={[
206
- styles.indicator,
207
- { top: selected?.y ?? TabBarMetrics.paddingVertical },
208
- ]}
209
- />
210
- {renderContent()}
211
- </View>
212
- </View>
213
- );
214
- };
215
-
216
- /**
217
- * Phone tab bar: the horizontal bar floats over the tab content above the home indicator,
218
- * so content shows around it and through the notch. The transparent strip above it keeps
219
- * the rising center action touchable.
220
- */
221
- export default function BottomTabBar(props: Props) {
222
- const { state, floatingButton, activeTintColor, inactiveTintColor } = props;
223
- const window = useWindowDimensions();
224
- const insets = useSafeAreaInsets();
225
- const withCta = hasCenterAction(floatingButton, state.routes.length);
226
- const width = getHorizontalBarWidth(
227
- window.width,
228
- window.height,
229
- insets.left,
230
- insets.right,
231
- );
232
-
233
- return (
234
- <View
235
- pointerEvents={'box-none'}
236
243
  style={[
237
- styles.bar,
238
- withCta && styles.barCtaRise,
244
+ floatingButton ? styles.tabBarFloatingButton : styles.tabBar,
245
+ {
246
+ backgroundColor: theme.colors.background.surface,
247
+ borderTopColor: theme.colors.border.default,
248
+ },
239
249
  {
240
- paddingBottom: getSystemIndicatorHeight(insets.bottom),
241
- // centered between the side safe areas
250
+ paddingBottom: paddingBottom,
242
251
  paddingLeft: insets.left,
243
252
  paddingRight: insets.right,
244
253
  },
254
+ style,
245
255
  ]}
256
+ pointerEvents={'auto'}
246
257
  >
247
- <HorizontalTabBar
248
- items={getTabItems(props)}
249
- width={width}
250
- floatingButton={floatingButton}
251
- activeTintColor={activeTintColor}
252
- inactiveTintColor={inactiveTintColor}
253
- />
258
+ <View style={styles.content} accessibilityLabel={'bottom_tab_bar'}>
259
+ {useFloating && floatingButton?.container}
260
+ <Animated.View
261
+ style={[{ position: 'absolute', top: 0 }, indicatorStyle]}
262
+ >
263
+ <View
264
+ style={[
265
+ styles.indicator,
266
+ { backgroundColor: activeTintColor ?? theme.colors.primary },
267
+ ]}
268
+ />
269
+ </Animated.View>
270
+ {renderTabBar()}
271
+ </View>
254
272
  </View>
255
273
  );
256
274
  }
257
275
 
258
- export {
259
- HorizontalTabBar,
260
- getSystemIndicatorHeight,
261
- hasCenterAction,
262
- useCenterActionPress,
263
- };
276
+ const styles = StyleSheet.create({
277
+ content: {
278
+ flex: 1,
279
+ flexDirection: 'row',
280
+ },
281
+ tabBar: {
282
+ left: 0,
283
+ right: 0,
284
+ bottom: 0,
285
+ borderTopWidth: StyleSheet.hairlineWidth,
286
+ elevation: 8,
287
+ },
288
+ tabBarFloatingButton: {
289
+ left: 0,
290
+ right: 0,
291
+ bottom: 0,
292
+ zIndex: 1,
293
+ shadowColor: Colors.black_20,
294
+ shadowOffset: { width: 0, height: -2 },
295
+ shadowOpacity: 0.05,
296
+ shadowRadius: 3,
297
+ elevation: 8,
298
+ },
299
+ floatingContainer: {
300
+ position: 'absolute',
301
+ alignItems: 'center',
302
+ left: 0,
303
+ right: 0,
304
+ top: -2,
305
+ bottom: Platform.OS === 'ios' ? -6 : 4
306
+ },
307
+ floatingContent: {
308
+ alignItems: 'center',
309
+ justifyContent: 'center',
310
+ height: 48,
311
+ width: 48,
312
+ borderRadius: 24,
313
+ top: -10,
314
+ },
315
+ indicator: {
316
+ height: 2,
317
+ width: 44,
318
+ alignSelf: 'center',
319
+ borderBottomLeftRadius: 1,
320
+ borderBottomRightRadius: 1,
321
+ },
322
+ debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
323
+ });