glacia-native 0.6.1 → 0.6.3

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.
@@ -0,0 +1,19 @@
1
+ {
2
+ "android": {
3
+ "gradlePath": "src/engine/android/build.gradle",
4
+ "modules": [
5
+ "expo.modules.liquidglass.ExpoLiquidGlassModule"
6
+ ],
7
+ "path": "src/engine/android"
8
+ },
9
+ "apple": {
10
+ "modules": [
11
+ "ExpoLiquidGlassModule"
12
+ ],
13
+ "podspecPath": "src/engine/ios/ExpoLiquidGlass.podspec"
14
+ },
15
+ "platforms": [
16
+ "apple",
17
+ "android"
18
+ ]
19
+ }
@@ -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
  });
@@ -10,6 +10,20 @@ const tokens_1 = require("./internal/tokens");
10
10
  const primitives_1 = require("./internal/primitives");
11
11
  const motion_1 = require("./internal/motion");
12
12
  const SIZES = { sm: 32, md: 38, lg: 44 };
13
+ /**
14
+ * The glyph size a render-function icon is handed, per button size — the
15
+ * engine's own small / regular / large icon sizes (18 / 22 / 24), so the
16
+ * fallback hands a function the same size the engine does.
17
+ */
18
+ const ICON_SIZES = { sm: 18, md: 22, lg: 24 };
19
+ /**
20
+ * The same names in the engine's vocabulary (`small` / `regular` / `large`).
21
+ * The engine reads BUTTON_SIZES[size] with no fallback, so passing the
22
+ * library's `sm` / `md` / `lg` straight through resolves to undefined and
23
+ * throws the moment the engine mounts. The fallback never saw this because
24
+ * the engine never mounted — 0.6.3 mounts it, so the map is load-bearing.
25
+ */
26
+ const ENGINE_SIZE_NAMES = { sm: "small", md: "regular", lg: "large" };
13
27
  /**
14
28
  * An icon button on Glacia's glass — ported from the engine's
15
29
  * `LiquidGlassIconButton`, which extends the engine button's design with a
@@ -24,10 +38,19 @@ exports.IconButton = (0, react_1.forwardRef)(function IconButton({ icon, onPress
24
38
  const dimension = SIZES[size];
25
39
  if (EngineIconButton && capabilities.supported) {
26
40
  const EngineIconButtonComponent = EngineIconButton;
27
- return ((0, jsx_runtime_1.jsx)(EngineIconButtonComponent, { ref: ref, onPress: disabled ? undefined : onPress, disabled: disabled, icon: icon, tint: tint, accessibilityLabel: accessibilityLabel, accessibilityState: { disabled, ...accessibilityState }, style: style, size: size, children: children }));
41
+ return ((0, jsx_runtime_1.jsx)(EngineIconButtonComponent, { ref: ref, onPress: disabled ? undefined : onPress, disabled: disabled, icon: icon, tint: tint, accessibilityLabel: accessibilityLabel, accessibilityState: { disabled, ...accessibilityState }, style: style, size: ENGINE_SIZE_NAMES[size], children: children }));
28
42
  }
29
43
  // Fallback floor: solid circle, full geometry, on the fallback material.
44
+ // The icon renders centred in the circle. A render function is handed the
45
+ // same { color, size } the engine hands it — white on a tint, the scheme's
46
+ // foreground otherwise, at the button's glyph size. A plain element renders
47
+ // as given. (The circle used to be self-closing, so the icon never painted:
48
+ // the solid blue circles with no glyphs.)
30
49
  const radius = dimension / 2;
50
+ const iconColor = tint != null ? themeColors.onTint : themeColors.foreground;
51
+ const iconNode = typeof icon === "function"
52
+ ? icon({ color: iconColor, size: ICON_SIZES[size] })
53
+ : icon;
31
54
  return ((0, jsx_runtime_1.jsx)(Glass_1.Glass, { effect: "regular", surface: "control", isDark: isDark, tintColor: tint, style: style, testID: testID, children: (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: {
32
55
  width: dimension,
33
56
  height: dimension,
@@ -36,5 +59,5 @@ exports.IconButton = (0, react_1.forwardRef)(function IconButton({ icon, onPress
36
59
  opacity: disabled ? 0.38 : 1,
37
60
  alignItems: "center",
38
61
  justifyContent: "center",
39
- } }) }) }));
62
+ }, children: iconNode }) }) }));
40
63
  });
@@ -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
  });
@@ -47,6 +47,49 @@ function glassCapabilities() {
47
47
  }
48
48
  /** Whether this build renders Apple's glass. */
49
49
  exports.isGlassSupported = (0, glass_routing_1.defaultRouter)().supported;
50
+ /** Merges a style prop into one object; a function style is not resolvable here. */
51
+ function flattenStyle(style) {
52
+ if (!style)
53
+ return {};
54
+ if (Array.isArray(style)) {
55
+ return style.reduce((acc, entry) => ({ ...acc, ...flattenStyle(entry) }), {});
56
+ }
57
+ if (typeof style === "function")
58
+ return {};
59
+ return style;
60
+ }
61
+ /**
62
+ * The corner radius the engine's shader should refract with, read from the
63
+ * style the container already paints with — the one shape source for the
64
+ * engine branch. The native view defaults `cornerRadius` to 0 (a rectangle),
65
+ * so without this a pill container would refract as a rectangle while its
66
+ * outline is a pill. A raw pill radius (9999) is safe to pass: the native
67
+ * side clamps it to half the shorter side, the same clamp the container
68
+ * uses. Per-corner radii pass through as an object; an explicit `cornerRadius`
69
+ * prop from the caller is read by the caller of this helper, not here.
70
+ */
71
+ function resolveCornerRadius(style) {
72
+ const flat = flattenStyle(style);
73
+ const tl = flat.borderTopLeftRadius;
74
+ const tr = flat.borderTopRightRadius;
75
+ const br = flat.borderBottomRightRadius;
76
+ const bl = flat.borderBottomLeftRadius;
77
+ const base = typeof flat.borderRadius === "number" ? flat.borderRadius : 0;
78
+ if (typeof tl === "number" ||
79
+ typeof tr === "number" ||
80
+ typeof br === "number" ||
81
+ typeof bl === "number") {
82
+ return {
83
+ topLeft: typeof tl === "number" ? tl : base,
84
+ topRight: typeof tr === "number" ? tr : base,
85
+ bottomRight: typeof br === "number" ? br : base,
86
+ bottomLeft: typeof bl === "number" ? bl : base,
87
+ };
88
+ }
89
+ if (typeof flat.borderRadius === "number")
90
+ return flat.borderRadius;
91
+ return undefined;
92
+ }
50
93
  /**
51
94
  * Platform Glass View — the single place a glass surface is chosen:
52
95
  * - iOS 26+: Real `UIGlassEffect` via the vendored engine's native view
@@ -73,10 +116,15 @@ exports.GlassView = (0, react_1.forwardRef)(function GlassView({ effect = "regul
73
116
  const LiquidGlassView = decision.LiquidGlassView;
74
117
  const variant = effect === "clear" ? "clear" : "regular";
75
118
  const glow = pressed === undefined ? props.glow : { progress: pressed ? 1 : 0, lens: true };
119
+ // The engine's shader, content clip and border all refract with the
120
+ // `cornerRadius` prop (default 0 = rectangle). Pass the radius the style
121
+ // already paints, so the glass and the container share one shape. An
122
+ // explicit `cornerRadius` prop from the caller wins.
123
+ const cornerRadius = props.cornerRadius ?? resolveCornerRadius(style);
76
124
  // The engine owns the material; Glacia's own surface parameters stop at
77
125
  // the branch. Everything else (accessibility contract, provider pairing,
78
126
  // the adaptive sensor, an externally driven press) rides through.
79
- return ((0, jsx_runtime_1.jsx)(LiquidGlassView, { ...props, ref: ref, variant: variant, tint: tintColor, interactive: interactive, glow: glow, style: style, testID: testID, children: children }));
127
+ return ((0, jsx_runtime_1.jsx)(LiquidGlassView, { ...props, ref: ref, variant: variant, tint: tintColor, interactive: interactive, glow: glow, cornerRadius: cornerRadius, style: style, testID: testID, children: children }));
80
128
  }
81
129
  // Unsupported, or a deliberate "no surface": the fallback floor renders —
82
130
  // with the same shape, states and materials as the glass would have.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.effectiveGlassRadius = effectiveGlassRadius;
3
4
  exports.GlassRim = GlassRim;
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
5
6
  // The painted rim: light caught on the curved edge of a glass surface.
@@ -17,19 +18,49 @@ const react_1 = require("react");
17
18
  const primitives_1 = require("./primitives");
18
19
  const tokens_1 = require("./tokens");
19
20
  const fill = { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 };
21
+ /**
22
+ * The corner radius a surface actually shows, from the radius it was given
23
+ * and the box it was laid out in. React Native clamps `borderRadius` to half
24
+ * the shorter side; this is the same clamp, so the rim and the container
25
+ * agree on one shape. A pill radius (9999) on a 350x34 field is 17, not 9999.
26
+ */
27
+ function effectiveGlassRadius(radius, width, height) {
28
+ return Math.min(radius, width / 2, height / 2);
29
+ }
20
30
  /**
21
31
  * The rim light and top highlight of one surface.
22
32
  *
23
33
  * Both are stacked stops of a vertical gradient in the same colour: the eye
24
34
  * reads the brightest edge as a lit curve and the falloff as the curve turning
25
35
  * away from the light.
36
+ *
37
+ * One shape, one radius. The container's corner is a true pill/semicircle:
38
+ * React Native clamps `borderRadius` to half the shorter side. SVG does NOT
39
+ * clamp that way — it clamps `rx` to half the WIDTH and `ry` to half the
40
+ * HEIGHT independently — so a raw pill radius (9999) drew a wide flat ellipse
41
+ * (rx ~ half the width) inside a pill container. That is the oval the owner
42
+ * saw inside the search field. The rim measures the surface it paints and
43
+ * uses the same effective radius the container shows — `min(radius, half the
44
+ * shorter side)` — so the rim and the container share one shape. Measuring
45
+ * here fixes every caller (the fallback glass, the tab-bar lens, the
46
+ * segmented-control lens) because the rim is the only layer that drew its
47
+ * shape in SVG. Before layout the raw radius is used (one frame); off-device
48
+ * (tests, web preview) there is no layout, so the raw radius is used exactly
49
+ * as before.
26
50
  */
27
51
  function GlassRim({ radius, rim, highlight }) {
28
- const { Svg, Defs, Rect, LinearGradient, Stop } = (0, primitives_1.primitives)();
52
+ const { Svg, Defs, Rect, LinearGradient, Stop, View, isNative } = (0, primitives_1.primitives)();
29
53
  const key = (0, react_1.useId)().replace(/[^a-zA-Z0-9_-]/g, "");
30
54
  const rimId = `rim-${key}`;
31
55
  const highlightId = `top-${key}`;
32
- // SVG clamps rx/ry to half the side, so a pill radius simply becomes a pill.
33
- const rx = Math.max(0, radius - 0.5);
34
- return ((0, jsx_runtime_1.jsxs)(Svg, { width: "100%", height: "100%", style: fill, pointerEvents: "none", children: [(0, jsx_runtime_1.jsxs)(Defs, { children: [(0, jsx_runtime_1.jsxs)(LinearGradient, { id: rimId, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)(Stop, { offset: "0", stopColor: tokens_1.material.rimColor, stopOpacity: rim }), (0, jsx_runtime_1.jsx)(Stop, { offset: "0.55", stopColor: tokens_1.material.rimColor, stopOpacity: rim * 0.35 }), (0, jsx_runtime_1.jsx)(Stop, { offset: "1", stopColor: tokens_1.material.rimColor, stopOpacity: rim * 0.08 })] }), (0, jsx_runtime_1.jsxs)(LinearGradient, { id: highlightId, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)(Stop, { offset: "0", stopColor: tokens_1.material.rimColor, stopOpacity: highlight }), (0, jsx_runtime_1.jsx)(Stop, { offset: "1", stopColor: tokens_1.material.rimColor, stopOpacity: 0 })] })] }), (0, jsx_runtime_1.jsx)(Rect, { x: 0.5, y: 0.5, width: "99%", height: "99%", rx: rx, ry: rx, fill: "none", stroke: `url(#${rimId})`, strokeWidth: 1 }), (0, jsx_runtime_1.jsx)(Rect, { x: 1, y: 1, width: "98%", height: "40%", rx: Math.max(0, rx - 1), ry: Math.max(0, rx - 1), fill: `url(#${highlightId})` })] }));
56
+ const [size, setSize] = (0, react_1.useState)(null);
57
+ const effective = size ? effectiveGlassRadius(radius, size.width, size.height) : radius;
58
+ const rx = Math.max(0, effective - 0.5);
59
+ const svg = ((0, jsx_runtime_1.jsxs)(Svg, { width: "100%", height: "100%", style: fill, pointerEvents: "none", children: [(0, jsx_runtime_1.jsxs)(Defs, { children: [(0, jsx_runtime_1.jsxs)(LinearGradient, { id: rimId, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)(Stop, { offset: "0", stopColor: tokens_1.material.rimColor, stopOpacity: rim }), (0, jsx_runtime_1.jsx)(Stop, { offset: "0.55", stopColor: tokens_1.material.rimColor, stopOpacity: rim * 0.35 }), (0, jsx_runtime_1.jsx)(Stop, { offset: "1", stopColor: tokens_1.material.rimColor, stopOpacity: rim * 0.08 })] }), (0, jsx_runtime_1.jsxs)(LinearGradient, { id: highlightId, x1: "0", y1: "0", x2: "0", y2: "1", children: [(0, jsx_runtime_1.jsx)(Stop, { offset: "0", stopColor: tokens_1.material.rimColor, stopOpacity: highlight }), (0, jsx_runtime_1.jsx)(Stop, { offset: "1", stopColor: tokens_1.material.rimColor, stopOpacity: 0 })] })] }), (0, jsx_runtime_1.jsx)(Rect, { x: 0.5, y: 0.5, width: "99%", height: "99%", rx: rx, ry: rx, fill: "none", stroke: `url(#${rimId})`, strokeWidth: 1 }), (0, jsx_runtime_1.jsx)(Rect, { x: 1, y: 1, width: "98%", height: "40%", rx: Math.max(0, rx - 1), ry: Math.max(0, rx - 1), fill: `url(#${highlightId})` })] }));
60
+ if (!isNative)
61
+ return svg;
62
+ return ((0, jsx_runtime_1.jsx)(View, { style: fill, pointerEvents: "none", onLayout: (event) => {
63
+ const { width, height } = event.nativeEvent.layout;
64
+ setSize((prev) => prev && prev.width === width && prev.height === height ? prev : { width, height });
65
+ }, children: svg }));
35
66
  }
@@ -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[];
@@ -1,3 +1,10 @@
1
+ /**
2
+ * The corner radius a surface actually shows, from the radius it was given
3
+ * and the box it was laid out in. React Native clamps `borderRadius` to half
4
+ * the shorter side; this is the same clamp, so the rim and the container
5
+ * agree on one shape. A pill radius (9999) on a 350x34 field is 17, not 9999.
6
+ */
7
+ export declare function effectiveGlassRadius(radius: number, width: number, height: number): number;
1
8
  export interface GlassRimProps {
2
9
  /** The surface's corner radius, so the rim follows the shape. */
3
10
  radius: number;
@@ -12,5 +19,19 @@ export interface GlassRimProps {
12
19
  * Both are stacked stops of a vertical gradient in the same colour: the eye
13
20
  * reads the brightest edge as a lit curve and the falloff as the curve turning
14
21
  * away from the light.
22
+ *
23
+ * One shape, one radius. The container's corner is a true pill/semicircle:
24
+ * React Native clamps `borderRadius` to half the shorter side. SVG does NOT
25
+ * clamp that way — it clamps `rx` to half the WIDTH and `ry` to half the
26
+ * HEIGHT independently — so a raw pill radius (9999) drew a wide flat ellipse
27
+ * (rx ~ half the width) inside a pill container. That is the oval the owner
28
+ * saw inside the search field. The rim measures the surface it paints and
29
+ * uses the same effective radius the container shows — `min(radius, half the
30
+ * shorter side)` — so the rim and the container share one shape. Measuring
31
+ * here fixes every caller (the fallback glass, the tab-bar lens, the
32
+ * segmented-control lens) because the rim is the only layer that drew its
33
+ * shape in SVG. Before layout the raw radius is used (one frame); off-device
34
+ * (tests, web preview) there is no layout, so the raw radius is used exactly
35
+ * as before.
15
36
  */
16
37
  export declare function GlassRim({ radius, rim, highlight }: GlassRimProps): import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glacia-native",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
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",
@@ -19,7 +19,8 @@
19
19
  "react-native": "src/index.ts",
20
20
  "files": [
21
21
  "lib",
22
- "src"
22
+ "src",
23
+ "expo-module.config.json"
23
24
  ],
24
25
  "scripts": {
25
26
  "build": "tsc --project tsconfig.build.json",
@@ -37,7 +38,7 @@
37
38
  "@react-native-community/blur": ">=4"
38
39
  },
39
40
  "dependencies": {
40
- "glacia-tokens": "workspace:*"
41
+ "glacia-tokens": "0.5.2"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@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
  ) : (
@@ -25,6 +25,22 @@ export interface IconButtonProps {
25
25
 
26
26
  const SIZES = { sm: 32, md: 38, lg: 44 } as const;
27
27
 
28
+ /**
29
+ * The glyph size a render-function icon is handed, per button size — the
30
+ * engine's own small / regular / large icon sizes (18 / 22 / 24), so the
31
+ * fallback hands a function the same size the engine does.
32
+ */
33
+ const ICON_SIZES = { sm: 18, md: 22, lg: 24 } as const;
34
+
35
+ /**
36
+ * The same names in the engine's vocabulary (`small` / `regular` / `large`).
37
+ * The engine reads BUTTON_SIZES[size] with no fallback, so passing the
38
+ * library's `sm` / `md` / `lg` straight through resolves to undefined and
39
+ * throws the moment the engine mounts. The fallback never saw this because
40
+ * the engine never mounted — 0.6.3 mounts it, so the map is load-bearing.
41
+ */
42
+ const ENGINE_SIZE_NAMES = { sm: "small", md: "regular", lg: "large" } as const;
43
+
28
44
  /**
29
45
  * An icon button on Glacia's glass — ported from the engine's
30
46
  * `LiquidGlassIconButton`, which extends the engine button's design with a
@@ -65,7 +81,7 @@ export const IconButton = forwardRef<any, IconButtonProps>(function IconButton(
65
81
  accessibilityLabel={accessibilityLabel}
66
82
  accessibilityState={{ disabled, ...accessibilityState }}
67
83
  style={style}
68
- size={size}
84
+ size={ENGINE_SIZE_NAMES[size]}
69
85
  >
70
86
  {children}
71
87
  </EngineIconButtonComponent>
@@ -73,7 +89,17 @@ export const IconButton = forwardRef<any, IconButtonProps>(function IconButton(
73
89
  }
74
90
 
75
91
  // Fallback floor: solid circle, full geometry, on the fallback material.
92
+ // The icon renders centred in the circle. A render function is handed the
93
+ // same { color, size } the engine hands it — white on a tint, the scheme's
94
+ // foreground otherwise, at the button's glyph size. A plain element renders
95
+ // as given. (The circle used to be self-closing, so the icon never painted:
96
+ // the solid blue circles with no glyphs.)
76
97
  const radius = dimension / 2;
98
+ const iconColor = tint != null ? themeColors.onTint : themeColors.foreground;
99
+ const iconNode =
100
+ typeof icon === "function"
101
+ ? icon({ color: iconColor, size: ICON_SIZES[size] })
102
+ : icon;
77
103
  return (
78
104
  <Glass
79
105
  effect="regular"
@@ -103,7 +129,9 @@ export const IconButton = forwardRef<any, IconButtonProps>(function IconButton(
103
129
  alignItems: "center",
104
130
  justifyContent: "center",
105
131
  }}
106
- />
132
+ >
133
+ {iconNode}
134
+ </View>
107
135
  </Pressable>
108
136
  </Glass>
109
137
  );
@@ -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
  },
@@ -82,6 +82,52 @@ export function glassCapabilities(): GlassCapabilities {
82
82
  /** Whether this build renders Apple's glass. */
83
83
  export const isGlassSupported = defaultRouter().supported;
84
84
 
85
+ /** Merges a style prop into one object; a function style is not resolvable here. */
86
+ function flattenStyle(style: any): ViewStyle {
87
+ if (!style) return {};
88
+ if (Array.isArray(style)) {
89
+ return style.reduce<ViewStyle>((acc, entry) => ({ ...acc, ...flattenStyle(entry) }), {});
90
+ }
91
+ if (typeof style === "function") return {};
92
+ return style as ViewStyle;
93
+ }
94
+
95
+ /**
96
+ * The corner radius the engine's shader should refract with, read from the
97
+ * style the container already paints with — the one shape source for the
98
+ * engine branch. The native view defaults `cornerRadius` to 0 (a rectangle),
99
+ * so without this a pill container would refract as a rectangle while its
100
+ * outline is a pill. A raw pill radius (9999) is safe to pass: the native
101
+ * side clamps it to half the shorter side, the same clamp the container
102
+ * uses. Per-corner radii pass through as an object; an explicit `cornerRadius`
103
+ * prop from the caller is read by the caller of this helper, not here.
104
+ */
105
+ function resolveCornerRadius(
106
+ style: StyleProp<ViewStyle>,
107
+ ): number | { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number } | undefined {
108
+ const flat = flattenStyle(style);
109
+ const tl = (flat as any).borderTopLeftRadius;
110
+ const tr = (flat as any).borderTopRightRadius;
111
+ const br = (flat as any).borderBottomRightRadius;
112
+ const bl = (flat as any).borderBottomLeftRadius;
113
+ const base = typeof flat.borderRadius === "number" ? flat.borderRadius : 0;
114
+ if (
115
+ typeof tl === "number" ||
116
+ typeof tr === "number" ||
117
+ typeof br === "number" ||
118
+ typeof bl === "number"
119
+ ) {
120
+ return {
121
+ topLeft: typeof tl === "number" ? tl : base,
122
+ topRight: typeof tr === "number" ? tr : base,
123
+ bottomRight: typeof br === "number" ? br : base,
124
+ bottomLeft: typeof bl === "number" ? bl : base,
125
+ };
126
+ }
127
+ if (typeof flat.borderRadius === "number") return flat.borderRadius;
128
+ return undefined;
129
+ }
130
+
85
131
  /**
86
132
  * Platform Glass View — the single place a glass surface is chosen:
87
133
  * - iOS 26+: Real `UIGlassEffect` via the vendored engine's native view
@@ -124,6 +170,11 @@ export const GlassView = forwardRef<any, NativeGlassProps>(function GlassView(
124
170
  const LiquidGlassView = decision.LiquidGlassView;
125
171
  const variant = effect === "clear" ? "clear" : "regular";
126
172
  const glow = pressed === undefined ? props.glow : { progress: pressed ? 1 : 0, lens: true };
173
+ // The engine's shader, content clip and border all refract with the
174
+ // `cornerRadius` prop (default 0 = rectangle). Pass the radius the style
175
+ // already paints, so the glass and the container share one shape. An
176
+ // explicit `cornerRadius` prop from the caller wins.
177
+ const cornerRadius = (props as any).cornerRadius ?? resolveCornerRadius(style);
127
178
 
128
179
  // The engine owns the material; Glacia's own surface parameters stop at
129
180
  // the branch. Everything else (accessibility contract, provider pairing,
@@ -136,6 +187,7 @@ export const GlassView = forwardRef<any, NativeGlassProps>(function GlassView(
136
187
  tint={tintColor}
137
188
  interactive={interactive}
138
189
  glow={glow}
190
+ cornerRadius={cornerRadius}
139
191
  style={style}
140
192
  testID={testID}
141
193
  children={children}
@@ -10,13 +10,23 @@
10
10
  // and share the same resolver: no new native dependency, and it works
11
11
  // identically on iOS and Android.
12
12
 
13
- import { useId } from "react";
13
+ import { useId, useState } from "react";
14
14
 
15
15
  import { primitives } from "./primitives";
16
16
  import { material } from "./tokens";
17
17
 
18
18
  const fill = { position: "absolute", top: 0, left: 0, right: 0, bottom: 0 } as const;
19
19
 
20
+ /**
21
+ * The corner radius a surface actually shows, from the radius it was given
22
+ * and the box it was laid out in. React Native clamps `borderRadius` to half
23
+ * the shorter side; this is the same clamp, so the rim and the container
24
+ * agree on one shape. A pill radius (9999) on a 350x34 field is 17, not 9999.
25
+ */
26
+ export function effectiveGlassRadius(radius: number, width: number, height: number): number {
27
+ return Math.min(radius, width / 2, height / 2);
28
+ }
29
+
20
30
  export interface GlassRimProps {
21
31
  /** The surface's corner radius, so the rim follows the shape. */
22
32
  radius: number;
@@ -32,16 +42,31 @@ export interface GlassRimProps {
32
42
  * Both are stacked stops of a vertical gradient in the same colour: the eye
33
43
  * reads the brightest edge as a lit curve and the falloff as the curve turning
34
44
  * away from the light.
45
+ *
46
+ * One shape, one radius. The container's corner is a true pill/semicircle:
47
+ * React Native clamps `borderRadius` to half the shorter side. SVG does NOT
48
+ * clamp that way — it clamps `rx` to half the WIDTH and `ry` to half the
49
+ * HEIGHT independently — so a raw pill radius (9999) drew a wide flat ellipse
50
+ * (rx ~ half the width) inside a pill container. That is the oval the owner
51
+ * saw inside the search field. The rim measures the surface it paints and
52
+ * uses the same effective radius the container shows — `min(radius, half the
53
+ * shorter side)` — so the rim and the container share one shape. Measuring
54
+ * here fixes every caller (the fallback glass, the tab-bar lens, the
55
+ * segmented-control lens) because the rim is the only layer that drew its
56
+ * shape in SVG. Before layout the raw radius is used (one frame); off-device
57
+ * (tests, web preview) there is no layout, so the raw radius is used exactly
58
+ * as before.
35
59
  */
36
60
  export function GlassRim({ radius, rim, highlight }: GlassRimProps) {
37
- const { Svg, Defs, Rect, LinearGradient, Stop } = primitives();
61
+ const { Svg, Defs, Rect, LinearGradient, Stop, View, isNative } = primitives();
38
62
  const key = useId().replace(/[^a-zA-Z0-9_-]/g, "");
39
63
  const rimId = `rim-${key}`;
40
64
  const highlightId = `top-${key}`;
41
- // SVG clamps rx/ry to half the side, so a pill radius simply becomes a pill.
42
- const rx = Math.max(0, radius - 0.5);
65
+ const [size, setSize] = useState<{ width: number; height: number } | null>(null);
66
+ const effective = size ? effectiveGlassRadius(radius, size.width, size.height) : radius;
67
+ const rx = Math.max(0, effective - 0.5);
43
68
 
44
- return (
69
+ const svg = (
45
70
  <Svg width="100%" height="100%" style={fill} pointerEvents="none">
46
71
  <Defs>
47
72
  <LinearGradient id={rimId} x1="0" y1="0" x2="0" y2="1">
@@ -76,4 +101,20 @@ export function GlassRim({ radius, rim, highlight }: GlassRimProps) {
76
101
  />
77
102
  </Svg>
78
103
  );
104
+
105
+ if (!isNative) return svg;
106
+ return (
107
+ <View
108
+ style={fill}
109
+ pointerEvents="none"
110
+ onLayout={(event: any) => {
111
+ const { width, height } = event.nativeEvent.layout;
112
+ setSize((prev) =>
113
+ prev && prev.width === width && prev.height === height ? prev : { width, height },
114
+ );
115
+ }}
116
+ >
117
+ {svg}
118
+ </View>
119
+ );
79
120
  }