@momo-kits/foundation 0.169.12-beta.3 → 0.169.12-beta.5
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.
|
@@ -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
|
/**
|
|
@@ -197,7 +197,8 @@ const FloatingBottomTab: React.FC<BottomTabProps> = ({
|
|
|
197
197
|
*/
|
|
198
198
|
const BottomTab: React.FC<BottomTabProps> = props => {
|
|
199
199
|
const { isIPhoneDuo } = useScreenLayout();
|
|
200
|
-
|
|
200
|
+
// legacy unless told otherwise: the redesigned bar is not rolled out yet
|
|
201
|
+
if ((props.useLegacy ?? true) && !isIPhoneDuo) {
|
|
201
202
|
return <LegacyBottomTab {...props} />;
|
|
202
203
|
}
|
|
203
204
|
return <FloatingBottomTab {...props} />;
|
|
@@ -35,7 +35,8 @@ export type BottomTabProps = {
|
|
|
35
35
|
compressionBehavior?: 'toolbar' | 'tabBar';
|
|
36
36
|
/**
|
|
37
37
|
* Renders the pre-redesign docked phone bar instead of the floating one. Ignores
|
|
38
|
-
* `showDot`, `floatingButton.labelContent` and `compressionBehavior`; not on iPhone Duo.
|
|
38
|
+
* `showDot`, `floatingButton.labelContent` and `compressionBehavior`; not on iPhone Duo.
|
|
39
|
+
* Defaults to true until the redesign rolls out; pass false for the floating bar.
|
|
39
40
|
*/
|
|
40
41
|
useLegacy?: boolean;
|
|
41
42
|
};
|