@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,63 +1,199 @@
1
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
1
2
  import {
2
- BottomTabBarProps,
3
- BottomTabNavigationOptions,
4
- createBottomTabNavigator,
5
- } from '@react-navigation/bottom-tabs';
6
- import { useFocusEffect } from '@react-navigation/native';
7
- import React, { useContext, useLayoutEffect } from 'react';
3
+ NavigationContainer,
4
+ NavigationIndependentTree,
5
+ useFocusEffect,
6
+ } from '@react-navigation/native';
7
+ import { createStackNavigator } from '@react-navigation/stack';
8
+ import React, { useContext, useEffect, useLayoutEffect } from 'react';
9
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
8
10
  import {
9
- Easing,
10
11
  NativeModules,
11
12
  Platform,
12
13
  StatusBar,
14
+ StyleSheet,
13
15
  useWindowDimensions,
16
+ View,
14
17
  } from 'react-native';
18
+ import Animated, {
19
+ useAnimatedStyle,
20
+ useSharedValue,
21
+ withTiming,
22
+ } from 'react-native-reanimated';
23
+ import { Colors } from '../../Consts';
15
24
  import { Icon } from '../../Icon';
25
+ import { exportFontFamily, Text } from '../../Text';
26
+ import StackScreen from '../StackScreen';
16
27
  import { BottomTabProps } from '../types';
17
- import ScaleSizeProvider from '../ScaleSizeProvider';
18
- import BottomTabBar, { hasCenterAction } from './BottomTabBar';
19
- import { TabBarMetrics } from './metrics';
20
- import { getTabBadge } from './TabBarIcon';
21
- import { DuoTabBar, useDuoTabBarInset } from './DuoTabBar';
22
- import { BottomTabInsetContext } from './BottomTabInset';
28
+ import { getOptions, getStackOptions, useAppState } from '../utils';
29
+ import BottomTabBar from './BottomTabBar';
30
+ import { DuoTabBar } from './DuoTabBar';
23
31
  import { DuoBarCompressionProvider } from './DuoBarCompression';
24
- import TabScreen from './TabScreen';
25
- import { ApplicationContext } from '../../Context';
32
+ import { ApplicationContext, MiniAppContext } from '../../Context';
26
33
  import { useScreenLayout } from '../../Layout';
27
-
28
- type SceneInterpolator = BottomTabNavigationOptions['sceneStyleInterpolator'];
34
+ import { getHeaderRowOptions } from '../../Layout/utils';
29
35
 
30
36
  const Tab = createBottomTabNavigator();
37
+ const Stack = createStackNavigator();
31
38
 
32
- // the tab screens slide in index order over 280ms, CSS `ease`
33
- const TAB_SWITCH_SPEC = {
34
- animation: 'timing' as const,
35
- config: { duration: 280, easing: Easing.bezier(0.25, 0.1, 0.25, 1) },
36
- };
39
+ const TabScreen: React.FC<any> = ({ route, navigation }) => {
40
+ const { navigator } = useContext(ApplicationContext);
41
+ const context = useContext<any>(MiniAppContext);
42
+ const { nested, options, screen, initialParams } = route?.params;
43
+ const headerStyleOptions = getHeaderRowOptions(useScreenLayout());
44
+
45
+ const opacityValue = 0.3;
46
+ const scaleValue = 0.97;
47
+ const opacity = useSharedValue(opacityValue);
48
+ const scale = useSharedValue(scaleValue);
49
+ const screenName = screen?.name || screen?.type?.name || 'Invalid';
50
+ const { isBackgroundToForeground } = useAppState();
51
+
52
+ const tabAnimatedStyle = useAnimatedStyle(() => ({
53
+ opacity: opacity.value,
54
+ transform: [{ scale: scale.value }],
55
+ }));
56
+
57
+ const onScreenNavigated = (pre: string, current: string) => {
58
+ if (!isBackgroundToForeground) {
59
+ const data: any = {
60
+ preScreenName: pre,
61
+ screenName: current,
62
+ componentName: 'Screen',
63
+ state: 'navigated',
64
+ action: 'push',
65
+ };
66
+
67
+ context?.autoTracking?.({
68
+ ...context,
69
+ ...data,
70
+ });
71
+
72
+ /**
73
+ * debug toast
74
+ */
75
+ navigator?.maxApi?.showToastDebug?.({
76
+ appId: context.appId,
77
+ message: `${screenName} screen_navigated`,
78
+ type: 'ERROR',
79
+ });
80
+ }
81
+ };
82
+
83
+ useFocusEffect(
84
+ React.useCallback(
85
+ () => {
86
+ opacity.value = withTiming(1, { duration: 200 });
87
+ scale.value = withTiming(1, { duration: 200 });
88
+
89
+ setTimeout(() => {
90
+ navigator?.maxApi?.getDataObserver?.(
91
+ 'current_screen',
92
+ (data: any) => {
93
+ onScreenNavigated(data?.screenName, screenName);
94
+ navigator?.maxApi?.setObserver?.('current_screen', {
95
+ screenName,
96
+ });
97
+ },
98
+ );
99
+ }, 100);
100
+
101
+ return () => {
102
+ if (navigation.getState().index !== route?.params.index) {
103
+ opacity.value = withTiming(opacityValue, { duration: 200 });
104
+ scale.value = withTiming(scaleValue, { duration: 200 });
105
+ }
106
+ };
107
+ },
108
+ // eslint-disable-next-line react-hooks/exhaustive-deps
109
+ [],
110
+ ),
111
+ );
112
+
113
+ useEffect(
114
+ () => {
115
+ const onFocusApp = navigator?.maxApi?.listen?.('onFocusApp', () => {
116
+ if (navigation.isFocused()) {
117
+ navigator?.maxApi?.getDataObserver?.(
118
+ 'current_screen',
119
+ (data: any) => {
120
+ onScreenNavigated(data?.screenName, screenName);
121
+ navigator?.maxApi?.setObserver?.('current_screen', {
122
+ screenName,
123
+ });
124
+ },
125
+ );
126
+ }
127
+ });
128
+
129
+ return () => {
130
+ onFocusApp?.remove?.();
131
+ };
132
+ },
133
+ // eslint-disable-next-line react-hooks/exhaustive-deps
134
+ [],
135
+ );
136
+
137
+ let stackOptions = {};
138
+ if (options) {
139
+ stackOptions = getOptions(options);
140
+ }
141
+
142
+ if (nested) {
143
+ return (
144
+ <Animated.View style={[styles.container, tabAnimatedStyle]}>
145
+ <Stack.Navigator
146
+ screenOptions={headerStyleOptions}
147
+ >
148
+ <Stack.Screen
149
+ name="Stack"
150
+ component={StackScreen}
151
+ initialParams={{
152
+ screen,
153
+ options: stackOptions,
154
+ initialParams,
155
+ bottomTab: 'nested',
156
+ }}
157
+ options={{ ...getStackOptions() }}
158
+ />
159
+ </Stack.Navigator>
160
+ </Animated.View>
161
+ );
162
+ }
37
163
 
38
- /**
39
- * Tab slide interpolator. Scene progress is -1 for tabs before the active one and 1 for
40
- * tabs after it, so they wait a full width off screen on their side.
41
- */
42
- const getTabSlide = (width: number): SceneInterpolator => {
43
- return ({ current }) => ({
44
- sceneStyle: {
45
- transform: [
164
+ return (
165
+ <Animated.View
166
+ style={[
167
+ styles.container,
46
168
  {
47
- translateX: current.progress.interpolate({
48
- inputRange: [-1, 0, 1],
49
- outputRange: [-width, 0, width],
50
- }),
169
+ opacity,
170
+ transform: [{ scale }],
51
171
  },
52
- ],
53
- },
54
- });
172
+ ]}
173
+ >
174
+ <NavigationIndependentTree>
175
+ <NavigationContainer>
176
+ <Stack.Navigator
177
+ screenOptions={headerStyleOptions}
178
+ >
179
+ <Stack.Screen
180
+ name="Stack"
181
+ component={StackScreen}
182
+ initialParams={{
183
+ screen,
184
+ options: stackOptions,
185
+ initialParams,
186
+ bottomTab: 'default',
187
+ }}
188
+ options={{ ...getStackOptions(), ...options }}
189
+ />
190
+ </Stack.Navigator>
191
+ </NavigationContainer>
192
+ </NavigationIndependentTree>
193
+ </Animated.View>
194
+ );
55
195
  };
56
196
 
57
- /**
58
- * App tab navigator: the floating bar on phones, the rail or floating bar on
59
- * iPhone Duo, tabs sliding in index order. Shares the bar inset with its tabs.
60
- */
61
197
  const BottomTab: React.FC<BottomTabProps> = ({
62
198
  nested,
63
199
  tabs,
@@ -69,15 +205,17 @@ const BottomTab: React.FC<BottomTabProps> = ({
69
205
  }) => {
70
206
  const { theme, navigator } = useContext(ApplicationContext);
71
207
  const { isIPhoneDuo } = useScreenLayout();
72
- const { width: windowWidth } = useWindowDimensions();
73
- const barInset = useDuoTabBarInset();
74
- // The center action's button rises above the bar; tab content leaves room for it too.
75
- let tabBarInset = barInset;
76
- if (barInset && hasCenterAction(floatingButton, tabs.length)) {
77
- tabBarInset = barInset + TabBarMetrics.ctaLift;
78
- }
208
+ const dimensions = useWindowDimensions();
209
+ const insets = useSafeAreaInsets();
79
210
  const initialIndex = tabs.findIndex(i => i.name === initialRouteName);
211
+ const indicatorAnimated = useSharedValue(0);
80
212
  const activeIndex = React.useRef(initialIndex > 0 ? initialIndex : 0);
213
+ const itemWidth = dimensions.width / tabs.length;
214
+
215
+ const indicatorStyle = useAnimatedStyle(() => ({
216
+ width: itemWidth,
217
+ transform: [{ translateX: indicatorAnimated.value }],
218
+ }));
81
219
 
82
220
  useLayoutEffect(() => {
83
221
  navigation?.setOptions({
@@ -87,29 +225,36 @@ const BottomTab: React.FC<BottomTabProps> = ({
87
225
  });
88
226
  }, [navigation]);
89
227
 
90
- // Focus, not mount/onFocus: popping back from a pushed screen only refocuses BottomTab.
228
+ useEffect(() => {
229
+ indicatorAnimated.value = withTiming(itemWidth * activeIndex.current, {
230
+ duration: 200,
231
+ });
232
+ }, [itemWidth, indicatorAnimated]);
233
+
234
+ // Focus, not mount: pushing a screen from a tab leaves BottomTab mounted but blurred, and
235
+ // onFocus only fires on tab changes.
91
236
  useFocusEffect(
92
237
  React.useCallback(() => {
93
238
  NativeModules?.MiniAppModule?.setShouldUseFloatingArrowBack?.(
94
239
  activeIndex.current !== 0,
95
240
  );
96
- return () => {
241
+ return () =>
97
242
  NativeModules?.MiniAppModule?.setShouldUseFloatingArrowBack?.(false);
98
- };
99
243
  }, []),
100
244
  );
101
245
 
102
246
  const onFocus = (e: any) => {
103
247
  activeIndex.current = tabs.findIndex(i => e.target.includes(i.name));
248
+ indicatorAnimated.value = withTiming(itemWidth * activeIndex.current, {
249
+ duration: 200,
250
+ });
104
251
 
105
252
  const isFirstTab = activeIndex.current === 0;
106
253
  const gestureEnabled = Platform.OS === 'ios' && isFirstTab;
107
254
  navigation?.setOptions({
108
255
  gestureEnabled: gestureEnabled,
109
256
  });
110
- NativeModules?.MiniAppModule?.setShouldUseFloatingArrowBack?.(
111
- !gestureEnabled,
112
- );
257
+ NativeModules?.MiniAppModule?.setShouldUseFloatingArrowBack?.(!gestureEnabled);
113
258
  };
114
259
 
115
260
  const handler: {
@@ -132,20 +277,8 @@ const BottomTab: React.FC<BottomTabProps> = ({
132
277
  },
133
278
  };
134
279
 
135
- // One cap for the whole bar (labels, CTA, custom content) so it fits the fixed bar and notch.
136
- const renderTabBar = (props: BottomTabBarProps) => {
137
- const TabBar = isIPhoneDuo ? DuoTabBar : BottomTabBar;
138
- return (
139
- <ScaleSizeProvider scaleSizeMaxRate={TabBarMetrics.labelMaxScale}>
140
- <TabBar
141
- {...props}
142
- floatingButton={floatingButton}
143
- inactiveTintColor={theme.colors.text.secondary}
144
- activeTintColor={theme.colors.primary}
145
- />
146
- </ScaleSizeProvider>
147
- );
148
- };
280
+ const isIOS = Platform.OS === 'ios';
281
+ const bottomInset = isIOS ? Math.min(insets.bottom, 21) : insets.bottom;
149
282
 
150
283
  return (
151
284
  <DuoBarCompressionProvider
@@ -153,21 +286,93 @@ const BottomTab: React.FC<BottomTabProps> = ({
153
286
  tabCount={tabs.length}
154
287
  hasQr={!!floatingButton}
155
288
  >
156
- <BottomTabInsetContext.Provider value={{ inset: tabBarInset }}>
157
- <Tab.Navigator
158
- screenOptions={{
159
- headerShown: false,
160
- headerTransparent: true,
161
- headerBackground: undefined,
162
- tabBarLabelPosition: 'below-icon',
163
- animation: 'shift',
164
- transitionSpec: TAB_SWITCH_SPEC,
165
- sceneStyleInterpolator: getTabSlide(windowWidth),
166
- }}
167
- tabBar={renderTabBar}
168
- initialRouteName={initialRouteName}
169
- >
170
- {tabs.map((item, index) => (
289
+ <Tab.Navigator
290
+ screenOptions={{
291
+ headerShown: false,
292
+ headerTransparent: true,
293
+ headerBackground: undefined,
294
+ tabBarLabelPosition: 'below-icon',
295
+ tabBarBackground: () => (
296
+ <View
297
+ style={[
298
+ styles.container,
299
+ {
300
+ backgroundColor: theme.colors.background.surface,
301
+ },
302
+ ]}
303
+ >
304
+ <Animated.View
305
+ style={[styles.indicatorContainer, indicatorStyle]}
306
+ >
307
+ <View
308
+ style={[
309
+ styles.indicator,
310
+ { backgroundColor: theme.colors.primary },
311
+ ]}
312
+ />
313
+ </Animated.View>
314
+ </View>
315
+ ),
316
+ }}
317
+ tabBar={props =>
318
+ isIPhoneDuo ? (
319
+ <DuoTabBar
320
+ {...props}
321
+ floatingButton={floatingButton}
322
+ inactiveTintColor={theme.colors.text.hint}
323
+ activeTintColor={theme.colors.primary}
324
+ />
325
+ ) : (
326
+ <BottomTabBar
327
+ {...props}
328
+ floatingButton={floatingButton}
329
+ inactiveTintColor={theme.colors.text.hint}
330
+ activeTintColor={theme.colors.primary}
331
+ style={[{ height: 64 + bottomInset }]}
332
+ />
333
+ )
334
+ }
335
+ initialRouteName={initialRouteName}
336
+ >
337
+ {tabs.map((item, index) => {
338
+ const isNum = !isNaN(parseInt(`${item?.badgeLabel}`, 10));
339
+ const isDot =
340
+ typeof item?.badgeLabel === 'string' && !item?.badgeLabel;
341
+ const isNumZero = isNum && Number(item.badgeLabel) === 0;
342
+
343
+ let badgeLabel = item?.badgeLabel;
344
+ if (isNumZero) {
345
+ badgeLabel = undefined;
346
+ }
347
+
348
+ let badgeStyle: {
349
+ marginRight: number;
350
+ top: number;
351
+ backgroundColor: string;
352
+ width?: number;
353
+ } = {
354
+ marginRight: -8,
355
+ top: -4,
356
+ backgroundColor: Colors.orange_03,
357
+ };
358
+
359
+ if (isNum) {
360
+ badgeStyle = {
361
+ marginRight: -4,
362
+ top: -4,
363
+ backgroundColor: Colors.red_03,
364
+ };
365
+ }
366
+ if (isDot) {
367
+ badgeStyle = {
368
+ marginRight: -2,
369
+ top: -2,
370
+ backgroundColor: Colors.orange_03,
371
+ width: 12,
372
+ };
373
+ }
374
+
375
+ return (
171
376
  <Tab.Screen
172
377
  key={`BottomTab-${item.name}`}
173
378
  name={item.name}
@@ -175,19 +380,78 @@ const BottomTab: React.FC<BottomTabProps> = ({
175
380
  initialParams={{ ...item, nested, index }}
176
381
  listeners={handler}
177
382
  options={{
383
+ tabBarLabel: ({ focused, color }) => {
384
+ return (
385
+ <Text
386
+ numberOfLines={1}
387
+ typography={
388
+ focused ? 'label_xs_medium' : 'description_xs_regular'
389
+ }
390
+ color={color}
391
+ >
392
+ {item.label}
393
+ </Text>
394
+ );
395
+ },
178
396
  title: item.label,
179
- tabBarBadge: getTabBadge(item.badgeLabel, item.showDot),
180
- tabBarIcon: ({ color, size }) => (
181
- <Icon source={item.icon} color={color} size={size} />
397
+ tabBarStyle: [
398
+ {
399
+ height: 64,
400
+ },
401
+ styles.tabStyle,
402
+ ],
403
+ tabBarBadge: badgeLabel,
404
+ tabBarBadgeStyle: [
405
+ {
406
+ borderColor: 'white',
407
+ borderWidth: 2,
408
+ fontSize: 10,
409
+ lineHeight: 14,
410
+ fontWeight: 'bold',
411
+ alignSelf: 'center',
412
+ fontFamily: exportFontFamily('bold'),
413
+ },
414
+ badgeStyle,
415
+ ],
416
+ tabBarIcon: ({ color }) => (
417
+ <Icon source={item.icon} color={color} size={28} />
182
418
  ),
183
419
  ...item,
184
420
  }}
185
421
  />
186
- ))}
187
- </Tab.Navigator>
188
- </BottomTabInsetContext.Provider>
422
+ );
423
+ })}
424
+ </Tab.Navigator>
189
425
  </DuoBarCompressionProvider>
190
426
  );
191
427
  };
192
428
 
429
+ const styles = StyleSheet.create({
430
+ container: { flex: 1 },
431
+ indicatorContainer: { position: 'absolute', top: 0 },
432
+ indicator: {
433
+ height: 2,
434
+ width: 48,
435
+ alignSelf: 'center',
436
+ borderBottomLeftRadius: 2,
437
+ borderBottomRightRadius: 2,
438
+ },
439
+ tabBarStyle: {
440
+ ...Platform.select({
441
+ ios: {
442
+ shadowColor: Colors.black_10,
443
+ shadowOffset: { width: 0, height: 4 },
444
+ shadowOpacity: 1,
445
+ shadowRadius: 4,
446
+ },
447
+ android: {
448
+ elevation: 4,
449
+ },
450
+ }),
451
+ },
452
+ tabStyle: {
453
+ paddingVertical: 4,
454
+ },
455
+ });
456
+
193
457
  export default BottomTab;