glacia-native 0.6.1 → 0.6.2

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.
@@ -14,6 +14,14 @@ const motion_1 = require("./internal/motion");
14
14
  * source, and this is its Glacia-name translation.
15
15
  */
16
16
  const ENGINE_BUTTON_SIZES = { sm: 28, md: 34, lg: 44 };
17
+ /**
18
+ * The same names in the engine's vocabulary (`small` / `regular` / `large`).
19
+ * `Button` used to keep `size` to itself — it only set the capsule height —
20
+ * so the engine always rendered the regular label and `size="sm"` could not
21
+ * shrink a label into a narrow capsule (bank's 4-button row: "Request" needs
22
+ * ~61pt of text at 17pt, so it truncated to "Reque…" inside its ~80pt capsule).
23
+ */
24
+ const ENGINE_SIZE_NAMES = { sm: "small", md: "regular", lg: "large" };
17
25
  /**
18
26
  * A pressable button on Glacia's glass — ported from the engine's
19
27
  * `LiquidGlassButton` (expo-liquid-glass-ui), the design Binyam approved on real
@@ -38,10 +46,18 @@ exports.Button = (0, react_1.forwardRef)(function Button({ variant = "glass", si
38
46
  }
39
47
  if (EngineButton && capabilities.supported) {
40
48
  const EngineButtonComponent = EngineButton;
41
- return ((0, jsx_runtime_1.jsx)(EngineButtonComponent, { ref: ref, onPress: disabled || loading ? undefined : onPress, onLongPress: disabled || loading ? undefined : onLongPress, disabled: disabled || loading, loading: loading, interactive: interactive, pressLight: pressLight, adaptive: adaptive, tint: tint ?? (variant === "filled" ? themeColors.fill : undefined), height: height_, icon: icon, accessibilityLabel: accessibilityLabel, accessibilityState: { disabled, ...accessibilityState }, style: style, contentStyle: contentStyle, textStyle: textStyle, variant: variant === "filled" ? "regular" : "regular", shape: shape, children: children }));
49
+ return ((0, jsx_runtime_1.jsx)(EngineButtonComponent, { ref: ref, onPress: disabled || loading ? undefined : onPress, onLongPress: disabled || loading ? undefined : onLongPress, disabled: disabled || loading, loading: loading, interactive: interactive, pressLight: pressLight, adaptive: adaptive, tint: tint ?? (variant === "filled" ? themeColors.fill : undefined), height: height_, size: ENGINE_SIZE_NAMES[size], icon: icon, accessibilityLabel: accessibilityLabel, accessibilityState: { disabled, ...accessibilityState }, style: style,
50
+ // `size="sm"` has to fit a ~80pt capsule (bank's 4-button row): the
51
+ // engine's small size alone (15pt label, 14pt/side padding) still needs
52
+ // ~83pt for "Request" — measured 50.7pt at 14pt regular in run-8 shot 01,
53
+ // scaled to 15pt semibold — so sm tightens the label to 14pt and the
54
+ // side padding to 12pt here: ~76pt all-in, inside the capsule with room
55
+ // to spare. The engine's own small table is untouched (chips use it
56
+ // directly). Caller styles still win: they merge after these defaults.
57
+ contentStyle: size === "sm" ? [{ paddingHorizontal: 12 }, contentStyle] : contentStyle, textStyle: size === "sm" ? [{ fontSize: 14 }, textStyle] : textStyle, variant: variant === "filled" ? "regular" : "regular", shape: shape, children: children }));
42
58
  }
43
59
  // Fallback floor: solid surface, full geometry and states.
44
- return ((0, jsx_runtime_1.jsx)(FallbackButton, { ref: ref, accessibilityLabel: accessibilityLabel, disabled: disabled, height: height_, isDark: isDark, testID: testID, variant: variant, tint: tint ?? themeColors.fill, onPress: onPress, children: children }));
60
+ return ((0, jsx_runtime_1.jsx)(FallbackButton, { ref: ref, accessibilityLabel: accessibilityLabel, disabled: disabled, height: height_, isDark: isDark, testID: testID, variant: variant, tint: tint ?? themeColors.fill, onPress: onPress, style: style, contentStyle: contentStyle, children: children }));
45
61
  });
46
62
  const GhostButton = (0, react_1.forwardRef)(function GhostButton({ accessibilityLabel, disabled = false, height = ENGINE_BUTTON_SIZES.md, isDark, testID, onPress, children }, ref) {
47
63
  const { Pressable, View, Text: RNText } = (0, primitives_1.primitives)();
@@ -53,19 +69,19 @@ const GhostButton = (0, react_1.forwardRef)(function GhostButton({ accessibility
53
69
  alignItems: "center",
54
70
  justifyContent: "center",
55
71
  opacity: disabled ? 0.38 : 1,
56
- }, children: (0, jsx_runtime_1.jsx)(View, { style: { height: height - 8, justifyContent: "center", alignItems: "center", flex: 1 }, children: typeof children === "string" ? ((0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, fontWeight: "400" }, children: children })) : (children) }) }) }));
72
+ }, children: (0, jsx_runtime_1.jsx)(View, { style: { height: height - 8, justifyContent: "center", alignItems: "center", flex: 1 }, children: typeof children === "string" ? ((0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, fontWeight: "400", color: themeColors.foreground }, children: children })) : (children) }) }) }));
57
73
  });
58
- const FallbackButton = (0, react_1.forwardRef)(function FallbackButton({ accessibilityLabel, disabled = false, height = ENGINE_BUTTON_SIZES.md, isDark, testID, variant = "glass", tint, onPress, children }, ref) {
74
+ const FallbackButton = (0, react_1.forwardRef)(function FallbackButton({ accessibilityLabel, disabled = false, height = ENGINE_BUTTON_SIZES.md, isDark, testID, variant = "glass", tint, onPress, style, contentStyle, children }, ref) {
59
75
  const themeColors = isDark ? tokens_1.colors.dark : tokens_1.colors.light;
60
76
  const { Pressable, View, Text: RNText } = (0, primitives_1.primitives)();
61
77
  const radius = height / 2;
62
78
  const solid = variant !== "ghost";
63
- return ((0, jsx_runtime_1.jsx)(Pressable, { ref: ref, testID: testID, accessibilityRole: "button", accessibilityLabel: accessibilityLabel, accessibilityState: { disabled }, disabled: disabled, onPress: disabled ? undefined : onPress, children: (0, jsx_runtime_1.jsx)(View, { style: {
79
+ return ((0, jsx_runtime_1.jsx)(Pressable, { ref: ref, testID: testID, accessibilityRole: "button", accessibilityLabel: accessibilityLabel, accessibilityState: { disabled }, disabled: disabled, onPress: disabled ? undefined : onPress, style: style, children: (0, jsx_runtime_1.jsx)(View, { style: {
64
80
  height,
65
81
  borderRadius: radius,
66
82
  backgroundColor: solid ? tint ?? themeColors.fill : "transparent",
67
83
  opacity: disabled ? 0.38 : 1,
68
84
  alignItems: "center",
69
85
  justifyContent: "center",
70
- }, children: (0, jsx_runtime_1.jsx)(View, { style: { height: height - 8, justifyContent: "center", alignItems: "center", flex: 1 }, children: typeof children === "string" ? ((0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, fontWeight: "400", color: themeColors.onTint }, children: children })) : (children) }) }) }));
86
+ }, children: (0, jsx_runtime_1.jsx)(View, { style: [{ height: height - 8, justifyContent: "center", alignItems: "center", flex: 1 }, contentStyle], children: typeof children === "string" ? ((0, jsx_runtime_1.jsx)(RNText, { style: { fontSize: 14, fontWeight: "400", color: themeColors.onTint }, children: children })) : (children) }) }) }));
71
87
  });
@@ -48,11 +48,15 @@ exports.SegmentedControl = (0, react_1.forwardRef)(function SegmentedControl({ s
48
48
  }
49
49
  // Fallback floor: the sliding lens pill on a solid track, full selection
50
50
  // behaviour, so the selected segment reads exactly as it does in glass.
51
+ // The track stretches to its parent like the engine path (no alignSelf), and
52
+ // every segment takes an equal share of the track — a fixed cell width
53
+ // computed from the height (11pt for 3 segments at height 40) collapsed the
54
+ // track and piled the labels on top of each other ("D L P", run 8).
51
55
  const fallback = ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { effect: "regular", surface: "rail", pressed: false, isDark: isDark, style: {
52
56
  position: "relative",
53
57
  flexDirection: "row",
54
58
  alignItems: "center",
55
- alignSelf: "flex-start",
59
+ height,
56
60
  padding: 3,
57
61
  borderRadius: tokens_1.radii.pill,
58
62
  backgroundColor: themeColors.fieldWash,
@@ -83,12 +87,11 @@ exports.SegmentedControl = (0, react_1.forwardRef)(function SegmentedControl({ s
83
87
  ...(0, lens_1.lensShadow)(isDark),
84
88
  }, pointerEvents: "none", children: (0, jsx_runtime_1.jsx)(lens_1.LensRim, { radius: (height - 6) / 2, isDark: isDark }) })), segments.map((segment, index) => {
85
89
  const isSelected = index === selected;
86
- const cell = (height - 6) / Math.max(segments.length, 1);
87
- return ((0, jsx_runtime_1.jsxs)(View, { style: { width: cell, height: height - 6, position: "relative" }, children: [isSelected ? ((0, jsx_runtime_1.jsx)(View, { style: {
90
+ return ((0, jsx_runtime_1.jsxs)(View, { style: { flex: 1, height: height - 6, position: "relative" }, children: [isSelected ? ((0, jsx_runtime_1.jsx)(View, { style: {
88
91
  position: "absolute",
89
92
  top: 0,
90
93
  left: 0,
91
- width: cell,
94
+ width: "100%",
92
95
  height: height - 6,
93
96
  borderRadius: (height - 6) / 2,
94
97
  backgroundColor: themeColors.glassActive,
@@ -97,11 +100,13 @@ exports.SegmentedControl = (0, react_1.forwardRef)(function SegmentedControl({ s
97
100
  return;
98
101
  (0, haptics_1.hapticSelection)();
99
102
  onChange(index);
100
- }, style: { width: "100%", height, alignItems: "center", justifyContent: "center" }, children: (0, jsx_runtime_1.jsx)(RNText, { style: [
103
+ }, style: { width: "100%", height, alignItems: "center", justifyContent: "center" }, children: (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: [
101
104
  {
102
105
  fontSize: 14,
103
106
  fontWeight: isSelected ? "600" : "500",
104
- color: isSelected ? themeColors.onTint : themeColors.muted,
107
+ // Foreground, like the engine path's label colour — onTint
108
+ // (white) is unreadable on the light-mode pill.
109
+ color: isSelected ? themeColors.foreground : themeColors.muted,
105
110
  },
106
111
  textStyle,
107
112
  ], children: segment }) })] }, segment));
@@ -11,9 +11,10 @@ const primitives_1 = require("./internal/primitives");
11
11
  const motion_1 = require("./internal/motion");
12
12
  const haptics_1 = require("./internal/haptics");
13
13
  const lens_1 = require("./internal/lens");
14
- // The web bar: a 40pt rail (32pt tabs in a 4pt inset) with a 20pt radius, a
15
- // glass lens filling the active slot, and 13pt labels at 500/400 weight.
16
- const BAR_HEIGHT = 40;
14
+ // The web bar: a 64pt rail (56pt pill in a 4pt inset) with a 20pt radius, a
15
+ // glass lens filling the active slot, and 12pt labels at 500/400 weight —
16
+ // the same height as the engine bar (64dp), so icon + label fit on both paths.
17
+ const BAR_HEIGHT = 64;
17
18
  /**
18
19
  * The bottom bar of an app: a row of tabs on one glass surface.
19
20
  *
@@ -60,6 +61,8 @@ exports.TabBar = (0, react_1.forwardRef)(function TabBar({ items, activeId: acti
60
61
  const count = Math.max(items.length, 1);
61
62
  const itemWidth = `${100 / count}%`;
62
63
  const activeIndex = Math.max(0, items.findIndex((tab) => tab.id === activeId));
64
+ // Active tab: blue in light mode, white in dark mode (the bottom-bar rule).
65
+ const activeColor = isDark ? themeColors.foreground : themeColors.fill;
63
66
  const indicatorStyle = {
64
67
  position: "absolute",
65
68
  top: 4,
@@ -78,6 +81,12 @@ exports.TabBar = (0, react_1.forwardRef)(function TabBar({ items, activeId: acti
78
81
  if (!(EngineTabBar && capabilities.supported)) {
79
82
  return ((0, jsx_runtime_1.jsxs)(Glass_1.Glass, { ref: ref, effect: "regular", surface: "rail", pressed: held, isDark: isDark, style: barStyle, testID: testID, ...props, children: [animated ? ((0, jsx_runtime_1.jsx)(Animated.View, { pointerEvents: "none", style: { ...indicatorStyle, transform: [{ translateX: offset.interpolate({ inputRange: [0, Math.max(count - 1, 1)], outputRange: [0, `${((count - 1) * 100) / count}%`] }) }] }, children: (0, jsx_runtime_1.jsx)(lens_1.LensRim, { radius: tokens_1.radii.pill, isDark: isDark }) })) : ((0, jsx_runtime_1.jsx)(View, { pointerEvents: "none", style: { ...indicatorStyle, left: `${(activeIndex * 100) / count}%` }, children: (0, jsx_runtime_1.jsx)(lens_1.LensRim, { radius: tokens_1.radii.pill, isDark: isDark }) })), items.map((tab) => {
80
83
  const isActive = tab.id === activeId;
84
+ const tabColor = isActive ? activeColor : themeColors.muted;
85
+ // The icon is a render function on both paths; a plain element is
86
+ // still rendered as-is so older call sites do not crash.
87
+ const iconNode = typeof tab.icon === "function"
88
+ ? tab.icon({ focused: isActive, color: tabColor, size: 24 })
89
+ : tab.icon ?? null;
81
90
  return ((0, jsx_runtime_1.jsxs)(Pressable, { accessibilityRole: "tab", accessibilityLabel: tab.label, accessibilityState: { selected: isActive }, onPress: () => handleSelect(tab.id), onPressIn: () => setHeld(true), onPressOut: () => setHeld(false), style: {
82
91
  flex: 1,
83
92
  height: "100%",
@@ -85,9 +94,11 @@ exports.TabBar = (0, react_1.forwardRef)(function TabBar({ items, activeId: acti
85
94
  alignItems: "center",
86
95
  justifyContent: "center",
87
96
  gap: 2,
88
- paddingHorizontal: 8,
97
+ // Tight side padding: at 390pt a 5-tab bar gives each tab ~70pt,
98
+ // and "Accounts" at 12pt needs ~54pt — 8pt padding truncated it.
99
+ paddingHorizontal: 2,
89
100
  paddingVertical: 4,
90
- }, children: [tab.icon ?? null, (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: 13, fontWeight: isActive ? "500" : "400", color: isActive ? themeColors.fill : themeColors.muted }, children: tab.label })] }, tab.id));
101
+ }, children: [iconNode, (0, jsx_runtime_1.jsx)(RNText, { numberOfLines: 1, style: { fontSize: 12, fontWeight: isActive ? "500" : "400", color: tabColor }, children: tab.label })] }, tab.id));
91
102
  })] }));
92
103
  }
93
104
  const EngineTabBarComponent = EngineTabBar;
@@ -97,5 +108,5 @@ exports.TabBar = (0, react_1.forwardRef)(function TabBar({ items, activeId: acti
97
108
  icon: item.icon,
98
109
  }));
99
110
  const selectedIndex = Math.max(0, items.findIndex((item) => item.id === activeId));
100
- return ((0, jsx_runtime_1.jsx)(EngineTabBarComponent, { tabs: tabs, selectedIndex: selectedIndex, onTabSelected: (index) => handleSelect(items[index]?.id ?? ""), accentColor: themeColors.fill, inactiveColor: themeColors.muted, tint: themeColors.glass, style: style, labelStyle: { fontSize: 13 } }));
111
+ return ((0, jsx_runtime_1.jsx)(EngineTabBarComponent, { tabs: tabs, selectedIndex: selectedIndex, onTabSelected: (index) => handleSelect(items[index]?.id ?? ""), accentColor: activeColor, inactiveColor: themeColors.muted, tint: themeColors.glass, style: style, labelStyle: { fontSize: 12 } }));
101
112
  });
@@ -54,5 +54,7 @@ export interface FallbackButtonProps {
54
54
  variant?: "glass" | "filled" | "ghost";
55
55
  tint?: string;
56
56
  onPress?: () => void;
57
+ style?: StyleProp<ViewStyle>;
58
+ contentStyle?: StyleProp<ViewStyle>;
57
59
  children?: ReactNode;
58
60
  }
@@ -1,8 +1,17 @@
1
+ import type { ReactNode } from "react";
1
2
  import type { StyleProp, ViewStyle } from "react-native";
2
3
  export interface TabBarItem {
3
4
  id: string;
4
5
  label: string;
5
- icon?: any;
6
+ /**
7
+ * A render function — the engine calls it with the tab's state, so a plain
8
+ * element cannot be used here. The fallback floor calls it the same way.
9
+ */
10
+ icon?: (opts: {
11
+ focused: boolean;
12
+ color: string;
13
+ size: number;
14
+ }) => ReactNode;
6
15
  }
7
16
  export interface TabBarProps {
8
17
  items: TabBarItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glacia-native",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Liquid Glass UI components for React Native \u2014 real iOS 26 glass, with a clean fallback on Android and older iOS.",
5
5
  "author": "Binyam Feyissa (https://github.com/binyamfeyissa)",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "@react-native-community/blur": ">=4"
38
38
  },
39
39
  "dependencies": {
40
- "glacia-tokens": "workspace:*"
40
+ "glacia-tokens": "0.5.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@testing-library/react": "^16.3.3",
package/src/Button.tsx CHANGED
@@ -15,6 +15,15 @@ import { useIsDark } from "./internal/motion";
15
15
  */
16
16
  const ENGINE_BUTTON_SIZES = { sm: 28, md: 34, lg: 44 } as const;
17
17
 
18
+ /**
19
+ * The same names in the engine's vocabulary (`small` / `regular` / `large`).
20
+ * `Button` used to keep `size` to itself — it only set the capsule height —
21
+ * so the engine always rendered the regular label and `size="sm"` could not
22
+ * shrink a label into a narrow capsule (bank's 4-button row: "Request" needs
23
+ * ~61pt of text at 17pt, so it truncated to "Reque…" inside its ~80pt capsule).
24
+ */
25
+ const ENGINE_SIZE_NAMES = { sm: "small", md: "regular", lg: "large" } as const;
26
+
18
27
  export interface ButtonProps {
19
28
  variant?: "glass" | "filled" | "ghost";
20
29
  size?: "sm" | "md" | "lg";
@@ -114,12 +123,20 @@ export const Button = forwardRef<any, ButtonProps>(function Button(
114
123
  adaptive={adaptive}
115
124
  tint={tint ?? (variant === "filled" ? themeColors.fill : undefined)}
116
125
  height={height_}
126
+ size={ENGINE_SIZE_NAMES[size]}
117
127
  icon={icon}
118
128
  accessibilityLabel={accessibilityLabel}
119
129
  accessibilityState={{ disabled, ...accessibilityState }}
120
130
  style={style}
121
- contentStyle={contentStyle}
122
- textStyle={textStyle}
131
+ // `size="sm"` has to fit a ~80pt capsule (bank's 4-button row): the
132
+ // engine's small size alone (15pt label, 14pt/side padding) still needs
133
+ // ~83pt for "Request" — measured 50.7pt at 14pt regular in run-8 shot 01,
134
+ // scaled to 15pt semibold — so sm tightens the label to 14pt and the
135
+ // side padding to 12pt here: ~76pt all-in, inside the capsule with room
136
+ // to spare. The engine's own small table is untouched (chips use it
137
+ // directly). Caller styles still win: they merge after these defaults.
138
+ contentStyle={size === "sm" ? [{ paddingHorizontal: 12 }, contentStyle] : contentStyle}
139
+ textStyle={size === "sm" ? [{ fontSize: 14 }, textStyle] : textStyle}
123
140
  variant={variant === "filled" ? "regular" : "regular"}
124
141
  shape={shape}
125
142
  >
@@ -140,6 +157,8 @@ export const Button = forwardRef<any, ButtonProps>(function Button(
140
157
  variant={variant}
141
158
  tint={tint ?? themeColors.fill}
142
159
  onPress={onPress}
160
+ style={style}
161
+ contentStyle={contentStyle}
143
162
  >
144
163
  {children}
145
164
  </FallbackButton>
@@ -184,7 +203,7 @@ const GhostButton = forwardRef<any, GhostButtonProps>(function GhostButton(
184
203
  >
185
204
  <View style={{ height: height - 8, justifyContent: "center", alignItems: "center", flex: 1 }}>
186
205
  {typeof children === "string" ? (
187
- <RNText style={{ fontSize: 14, fontWeight: "400" }}>{children}</RNText>
206
+ <RNText style={{ fontSize: 14, fontWeight: "400", color: themeColors.foreground }}>{children}</RNText>
188
207
  ) : (
189
208
  children
190
209
  )}
@@ -204,11 +223,13 @@ export interface FallbackButtonProps {
204
223
  variant?: "glass" | "filled" | "ghost";
205
224
  tint?: string;
206
225
  onPress?: () => void;
226
+ style?: StyleProp<ViewStyle>;
227
+ contentStyle?: StyleProp<ViewStyle>;
207
228
  children?: ReactNode;
208
229
  }
209
230
 
210
231
  const FallbackButton = forwardRef<any, FallbackButtonProps>(function FallbackButton(
211
- { accessibilityLabel, disabled = false, height = ENGINE_BUTTON_SIZES.md, isDark, testID, variant = "glass", tint, onPress, children },
232
+ { accessibilityLabel, disabled = false, height = ENGINE_BUTTON_SIZES.md, isDark, testID, variant = "glass", tint, onPress, style, contentStyle, children },
212
233
  ref,
213
234
  ) {
214
235
  const themeColors = isDark ? colors.dark : colors.light;
@@ -224,6 +245,7 @@ const FallbackButton = forwardRef<any, FallbackButtonProps>(function FallbackBut
224
245
  accessibilityState={{ disabled }}
225
246
  disabled={disabled}
226
247
  onPress={disabled ? undefined : onPress}
248
+ style={style}
227
249
  >
228
250
  <View
229
251
  style={{
@@ -235,7 +257,7 @@ const FallbackButton = forwardRef<any, FallbackButtonProps>(function FallbackBut
235
257
  justifyContent: "center",
236
258
  }}
237
259
  >
238
- <View style={{ height: height - 8, justifyContent: "center", alignItems: "center", flex: 1 }}>
260
+ <View style={[{ height: height - 8, justifyContent: "center", alignItems: "center", flex: 1 }, contentStyle]}>
239
261
  {typeof children === "string" ? (
240
262
  <RNText style={{ fontSize: 14, fontWeight: "400", color: themeColors.onTint }}>{children}</RNText>
241
263
  ) : (
@@ -102,6 +102,10 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
102
102
 
103
103
  // Fallback floor: the sliding lens pill on a solid track, full selection
104
104
  // behaviour, so the selected segment reads exactly as it does in glass.
105
+ // The track stretches to its parent like the engine path (no alignSelf), and
106
+ // every segment takes an equal share of the track — a fixed cell width
107
+ // computed from the height (11pt for 3 segments at height 40) collapsed the
108
+ // track and piled the labels on top of each other ("D L P", run 8).
105
109
  const fallback = (
106
110
  <Glass
107
111
  effect="regular"
@@ -112,7 +116,7 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
112
116
  position: "relative",
113
117
  flexDirection: "row",
114
118
  alignItems: "center",
115
- alignSelf: "flex-start",
119
+ height,
116
120
  padding: 3,
117
121
  borderRadius: radii.pill,
118
122
  backgroundColor: themeColors.fieldWash,
@@ -162,16 +166,15 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
162
166
  )}
163
167
  {segments.map((segment, index) => {
164
168
  const isSelected = index === selected;
165
- const cell = (height - 6) / Math.max(segments.length, 1);
166
169
  return (
167
- <View key={segment} style={{ width: cell, height: height - 6, position: "relative" }}>
170
+ <View key={segment} style={{ flex: 1, height: height - 6, position: "relative" }}>
168
171
  {isSelected ? (
169
172
  <View
170
173
  style={{
171
174
  position: "absolute",
172
175
  top: 0,
173
176
  left: 0,
174
- width: cell,
177
+ width: "100%",
175
178
  height: height - 6,
176
179
  borderRadius: (height - 6) / 2,
177
180
  backgroundColor: themeColors.glassActive,
@@ -192,11 +195,14 @@ export const SegmentedControl = forwardRef<any, SegmentedControlProps>(function
192
195
  style={{ width: "100%", height, alignItems: "center", justifyContent: "center" }}
193
196
  >
194
197
  <RNText
198
+ numberOfLines={1}
195
199
  style={[
196
200
  {
197
201
  fontSize: 14,
198
202
  fontWeight: isSelected ? "600" : "500",
199
- color: isSelected ? themeColors.onTint : themeColors.muted,
203
+ // Foreground, like the engine path's label colour — onTint
204
+ // (white) is unreadable on the light-mode pill.
205
+ color: isSelected ? themeColors.foreground : themeColors.muted,
200
206
  },
201
207
  textStyle,
202
208
  ]}
package/src/TabBar.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import { forwardRef, useState } from "react";
2
+ import type { ReactNode } from "react";
2
3
  import type { StyleProp, ViewStyle } from "react-native";
3
4
 
4
5
  import { loadEngineControl } from "./internal/glass-routing";
@@ -13,7 +14,11 @@ import { LensRim, lensShadow } from "./internal/lens";
13
14
  export interface TabBarItem {
14
15
  id: string;
15
16
  label: string;
16
- icon?: any;
17
+ /**
18
+ * A render function — the engine calls it with the tab's state, so a plain
19
+ * element cannot be used here. The fallback floor calls it the same way.
20
+ */
21
+ icon?: (opts: { focused: boolean; color: string; size: number }) => ReactNode;
17
22
  }
18
23
 
19
24
  export interface TabBarProps {
@@ -36,9 +41,10 @@ export interface TabBarProps {
36
41
  testID?: string;
37
42
  }
38
43
 
39
- // The web bar: a 40pt rail (32pt tabs in a 4pt inset) with a 20pt radius, a
40
- // glass lens filling the active slot, and 13pt labels at 500/400 weight.
41
- const BAR_HEIGHT = 40;
44
+ // The web bar: a 64pt rail (56pt pill in a 4pt inset) with a 20pt radius, a
45
+ // glass lens filling the active slot, and 12pt labels at 500/400 weight —
46
+ // the same height as the engine bar (64dp), so icon + label fit on both paths.
47
+ const BAR_HEIGHT = 64;
42
48
 
43
49
  /**
44
50
  * The bottom bar of an app: a row of tabs on one glass surface.
@@ -102,6 +108,8 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
102
108
  const count = Math.max(items.length, 1);
103
109
  const itemWidth = `${100 / count}%`;
104
110
  const activeIndex = Math.max(0, items.findIndex((tab) => tab.id === activeId));
111
+ // Active tab: blue in light mode, white in dark mode (the bottom-bar rule).
112
+ const activeColor = isDark ? themeColors.foreground : themeColors.fill;
105
113
 
106
114
  const indicatorStyle = {
107
115
  position: "absolute" as const,
@@ -143,6 +151,13 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
143
151
  )}
144
152
  {items.map((tab) => {
145
153
  const isActive = tab.id === activeId;
154
+ const tabColor = isActive ? activeColor : themeColors.muted;
155
+ // The icon is a render function on both paths; a plain element is
156
+ // still rendered as-is so older call sites do not crash.
157
+ const iconNode =
158
+ typeof tab.icon === "function"
159
+ ? tab.icon({ focused: isActive, color: tabColor, size: 24 })
160
+ : tab.icon ?? null;
146
161
  return (
147
162
  <Pressable
148
163
  key={tab.id}
@@ -159,12 +174,14 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
159
174
  alignItems: "center",
160
175
  justifyContent: "center",
161
176
  gap: 2,
162
- paddingHorizontal: 8,
177
+ // Tight side padding: at 390pt a 5-tab bar gives each tab ~70pt,
178
+ // and "Accounts" at 12pt needs ~54pt — 8pt padding truncated it.
179
+ paddingHorizontal: 2,
163
180
  paddingVertical: 4,
164
181
  }}
165
182
  >
166
- {tab.icon ?? null}
167
- <RNText numberOfLines={1} style={{ fontSize: 13, fontWeight: isActive ? "500" : "400", color: isActive ? themeColors.fill : themeColors.muted }}>
183
+ {iconNode}
184
+ <RNText numberOfLines={1} style={{ fontSize: 12, fontWeight: isActive ? "500" : "400", color: tabColor }}>
168
185
  {tab.label}
169
186
  </RNText>
170
187
  </Pressable>
@@ -187,11 +204,11 @@ export const TabBar = forwardRef<any, TabBarProps>(function TabBar(
187
204
  tabs={tabs}
188
205
  selectedIndex={selectedIndex}
189
206
  onTabSelected={(index: number) => handleSelect(items[index]?.id ?? "")}
190
- accentColor={themeColors.fill}
207
+ accentColor={activeColor}
191
208
  inactiveColor={themeColors.muted}
192
209
  tint={themeColors.glass}
193
210
  style={style}
194
- labelStyle={{ fontSize: 13 } as any}
211
+ labelStyle={{ fontSize: 12 } as any}
195
212
  />
196
213
  );
197
214
  });
@@ -313,7 +313,14 @@ const LiquidGlassButtonBase: React.FC<ILiquidGlassButtonProps> = ({
313
313
  style,
314
314
  ]}
315
315
  >
316
- <Animated.View style={pressStyle}>
316
+ {/* The press wrapper fills the Pressable's width, so the glass pane
317
+ (absoluteFill inside it) is a full-width capsule, not a ~height
318
+ circle: a stretched child is not guaranteed here — the wrapper
319
+ sizes to its content unless it is told to fill — which is why
320
+ bank's 4-button row rendered ~46pt circles with overflowing
321
+ labels. The content does the same, so its label truncates
322
+ inside the pane instead of overflowing it. */}
323
+ <Animated.View style={[pressStyle, styles.pressWrap]}>
317
324
  {/* The pane is its own layer under the content so a merge can fade it without touching
318
325
  the label — which stays legible on top of whichever pane is drawing. */}
319
326
  <Animated.View pointerEvents="none" style={[styles.pane, paneStyle]}>
@@ -359,7 +366,7 @@ const LiquidGlassButtonBase: React.FC<ILiquidGlassButtonProps> = ({
359
366
  {
360
367
  height,
361
368
  paddingHorizontal: circular ? 0 : sizing.paddingHorizontal,
362
- width: circular ? height : undefined,
369
+ width: circular ? height : "100%",
363
370
  },
364
371
  contentStyle,
365
372
  ]}
@@ -381,6 +388,11 @@ const LiquidGlassButtonBase: React.FC<ILiquidGlassButtonProps> = ({
381
388
  };
382
389
 
383
390
  const styles = StyleSheet.create({
391
+ // Fills the Pressable so the pane (absoluteFill) is full-width — see L3.
392
+ pressWrap: {
393
+ alignSelf: "stretch",
394
+ width: "100%",
395
+ },
384
396
  pane: {
385
397
  ...ABSOLUTE_FILL,
386
398
  },