@momo-kits/foundation 0.169.12-beta.3 → 0.169.12-beta.4
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.
|
@@ -9,7 +9,7 @@ import { type BottomTabNavigationOptions } from '@react-navigation/bottom-tabs';
|
|
|
9
9
|
import { type Route } from '@react-navigation/native';
|
|
10
10
|
import { Text } from '../../Text';
|
|
11
11
|
import { MiniAppContext } from '../../Context';
|
|
12
|
-
import { Colors
|
|
12
|
+
import { Colors } from '../../Consts';
|
|
13
13
|
import { LegacyTabBarIcon } from './LegacyTabBarIcon';
|
|
14
14
|
|
|
15
15
|
type LabelType = NonNullable<BottomTabNavigationOptions['tabBarLabel']>;
|
|
@@ -99,8 +99,8 @@ const styles = StyleSheet.create({
|
|
|
99
99
|
container: {
|
|
100
100
|
flex: 1,
|
|
101
101
|
alignItems: 'center',
|
|
102
|
+
// no vertical padding: icon + label stay centered in the 64 bar without the label's bottom cut
|
|
102
103
|
justifyContent: 'center',
|
|
103
|
-
paddingVertical: Spacing.S,
|
|
104
104
|
bottom: -2,
|
|
105
105
|
},
|
|
106
106
|
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
@@ -13,9 +13,6 @@ import { Text } from '../../Text';
|
|
|
13
13
|
import ScaleSizeProvider from '../ScaleSizeProvider';
|
|
14
14
|
import { TabBarMetrics, TabBarMotion } from './metrics';
|
|
15
15
|
|
|
16
|
-
// text badges keep 5 characters, then "..." ("Khám phá" -> "Khám...")
|
|
17
|
-
const BADGE_MAX_CHARS = 5;
|
|
18
|
-
|
|
19
16
|
type Props = {
|
|
20
17
|
focused: boolean;
|
|
21
18
|
// '' shows a dot, anything else a label badge
|
|
@@ -33,7 +30,7 @@ type Props = {
|
|
|
33
30
|
|
|
34
31
|
/**
|
|
35
32
|
* Badge value of a tab: undefined hides it, '' is a dot (also 0 when `showDot`), numbers
|
|
36
|
-
* cap at 99
|
|
33
|
+
* cap at 99+.
|
|
37
34
|
*/
|
|
38
35
|
export const getTabBadge = (
|
|
39
36
|
badgeLabel?: string | number,
|
|
@@ -53,9 +50,7 @@ export const getTabBadge = (
|
|
|
53
50
|
}
|
|
54
51
|
return value > 99 ? '99+' : text;
|
|
55
52
|
}
|
|
56
|
-
return text
|
|
57
|
-
? `${text.slice(0, BADGE_MAX_CHARS).trimEnd()}...`
|
|
58
|
-
: text;
|
|
53
|
+
return text;
|
|
59
54
|
};
|
|
60
55
|
|
|
61
56
|
/**
|