react-native-magic-tab-bar 1.0.0 → 2.0.0

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.
package/src/theme.ts CHANGED
@@ -10,6 +10,11 @@ export const defaultTheme: MagicTabBarTheme = {
10
10
  fontSize: 12,
11
11
  height: 56,
12
12
  radius: 28,
13
+ badgeColor: '#FF3B30',
14
+ badgeTextColor: '#FFFFFF',
15
+ actionColor: '#0A84FF',
16
+ actionIconColor: '#FFFFFF',
13
17
  horizontalMargin: 14,
14
18
  bottomInset: 10,
19
+ spring: { mass: 0.6, damping: 18, stiffness: 180 },
15
20
  };
package/src/types.ts CHANGED
@@ -19,10 +19,64 @@ export interface MagicTabConfig {
19
19
  href: Href;
20
20
  /** Optional text label rendered next to the icon while the tab is active. */
21
21
  label?: string;
22
+ /**
23
+ * Show this tab's label while active. Overrides the bar-level `showLabels`
24
+ * prop for this tab only. A tab without a `label` never shows text.
25
+ */
26
+ showLabel?: boolean;
27
+ /**
28
+ * Badge shown over the icon. `true` renders a small dot; a number or string
29
+ * renders a count bubble (numbers above 99 display as `99+`). Falsy values
30
+ * (`false`, `0`, `undefined`, `''`) render nothing.
31
+ */
32
+ badge?: number | string | boolean;
33
+ /**
34
+ * Dim the tab and block navigation to it. The tab still renders but cannot
35
+ * be pressed. Off by default.
36
+ */
37
+ disabled?: boolean;
38
+ /**
39
+ * Render this tab as a raised, circular action ("FAB") button — common for a
40
+ * center "create"/"compose" tab. Ignores label/pill styling and uses the
41
+ * theme's `actionColor`/`actionIconColor`. Defaults to a normal tab.
42
+ */
43
+ variant?: 'action';
44
+ /**
45
+ * When this tab is the active route, switch the whole bar into compact
46
+ * "light" mode (short, narrow, icon-only). Lets a single scroll-heavy screen
47
+ * (e.g. a feed) use a minimal bar while the other tabs keep the full one. The
48
+ * transition between modes is animated.
49
+ */
50
+ isLight?: boolean;
22
51
  /** Renders the tab's icon. */
23
52
  icon: (props: MagicTabIconProps) => ReactNode;
24
53
  }
25
54
 
55
+ /**
56
+ * Fired when a tab is pressed. `name` is the tab's route name and `focused`
57
+ * is whether that tab was already the active one (useful for "scroll to top"
58
+ * or "reset stack" on re-press).
59
+ */
60
+ export type MagicTabPressHandler = (name: string, focused: boolean) => void;
61
+
62
+ /**
63
+ * When labels are shown:
64
+ * - `'active'` — only on the focused tab (default).
65
+ * - `'always'` — on every tab, all the time.
66
+ * - `'never'` — icon-only bar.
67
+ */
68
+ export type MagicLabelMode = 'active' | 'always' | 'never';
69
+
70
+ /** Where a tab's label sits relative to its icon. */
71
+ export type MagicLabelPosition = 'right' | 'bottom';
72
+
73
+ /** Spring parameters for the tab's focus/label animations. */
74
+ export interface MagicSpringConfig {
75
+ mass: number;
76
+ damping: number;
77
+ stiffness: number;
78
+ }
79
+
26
80
  /** Visual configuration for the tab bar. */
27
81
  export interface MagicTabBarTheme {
28
82
  /** Background color of the bar (ignored when `renderBackground` is provided). */
@@ -41,10 +95,20 @@ export interface MagicTabBarTheme {
41
95
  height: number;
42
96
  /** Corner radius of the bar and the active pill. */
43
97
  radius: number;
98
+ /** Background color of a tab's badge. */
99
+ badgeColor: string;
100
+ /** Text color of a tab's badge count. */
101
+ badgeTextColor: string;
102
+ /** Background color of an `action`-variant tab. */
103
+ actionColor: string;
104
+ /** Icon color of an `action`-variant tab. */
105
+ actionIconColor: string;
44
106
  /** Horizontal margin between the bar and the screen edges. */
45
107
  horizontalMargin: number;
46
108
  /** Extra space below the bar, added on top of the safe-area inset. */
47
109
  bottomInset: number;
110
+ /** Spring used for the focus pill and label transitions. */
111
+ spring: MagicSpringConfig;
48
112
  }
49
113
 
50
114
  /** How the bar is positioned relative to screen content. */