glacia-native 0.4.0 → 0.5.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.
@@ -12,5 +12,13 @@ export { Dialog, DialogTrigger, AlertDialog, ActionSheet, type DialogProps, type
12
12
  export { NativePlan, NativeSources, NativeResponse, NativeTask, NativeSoundwave, NativeThinkingOrb, NativePanelside, NativeAIInput, NativeImageGeneration, type NativePlanProps, type NativePlanStep, type NativeSourcesProps, type NativeSource, type NativeResponseProps, type NativeTaskProps, type NativeSoundwaveProps, type NativeThinkingOrbProps, type NativePanelsideProps, type NativePanelNavItem, type NativeAIInputProps, type NativeImageGenerationProps, type NativeGeneratedImage, } from "./ai";
13
13
  export { NativeTable, NativeScrollArea, type NativeTableProps, type NativeTableColumn, type NativeTableRow, type NativeScrollAreaProps, } from "./Table";
14
14
  export * from "./charts";
15
+ export { Text, type TextProps, type TextVariant } from "./Text";
16
+ export { Avatar, Badge, Separator, Skeleton, Spinner, Progress, initialsOf, type AvatarProps, type AvatarSize, type BadgeProps, type SeparatorProps, type SkeletonProps, type SpinnerProps, type SpinnerSize, type ProgressProps, type ProgressVariant, } from "./Display";
17
+ export { Toast, Banner, List, ListItem, ListSection, Accordion, type ToastProps, type ToastAction, type BannerProps, type ListProps, type ListItemProps, type ListSectionProps, type AccordionProps, type AccordionSection, } from "./Feedback";
18
+ export { SearchBar, Chip, FAB, IconButton, AppBar, type SearchBarProps, type ChipProps, type FABProps, type IconButtonProps, type AppBarProps, type AppBarAction, } from "./Bars";
19
+ export { Menu, Sheet, Drawer, anchorPopover, type MenuProps, type MenuItem, type SheetProps, type DrawerProps, } from "./Overlays";
20
+ export { Carousel, PageControl, type CarouselProps, type PageControlProps, } from "./Carousel";
21
+ export { Stepper, Toggle, ToggleGroup, InputOTP, ButtonGroup, type StepperProps, type ToggleProps, type ToggleGroupProps, type ToggleGroupItem, type InputOTPProps, type ButtonGroupProps, type ButtonGroupItem, } from "./Forms2";
22
+ export { Calendar, DatePicker, TimePicker, monthGrid, startOfDay, sameDay, parseTime, formatTime, WEEKDAYS, MONTHS, type CalendarProps, type CalendarCell, type DatePickerProps, type TimePickerProps, } from "./Pickers";
15
23
  export { isGlassSupported } from "./internal/GlassView";
16
- export { colors, radii, springs } from "./internal/tokens";
24
+ export { colors, radii, springs, typeScale, toneColor, type Tone } from "./internal/tokens";
@@ -13,11 +13,20 @@ export interface NativeGlassProps {
13
13
  * colour scheme decides, so developers never thread this prop themselves.
14
14
  */
15
15
  isDark?: boolean;
16
+ /**
17
+ * Any further React Native view prop (accessibility, onLayout, pointer
18
+ * events, …) is passed straight through to whichever surface renders, so a
19
+ * component can put its own accessibility contract on the glass itself.
20
+ */
21
+ [prop: string]: any;
16
22
  }
23
+ /** Clears the memoised decision. Only tests call this, to drive both branches. */
24
+ export declare function resetGlassRouter(): void;
25
+ /** Whether this build renders Apple's glass. */
17
26
  export declare const isGlassSupported: boolean;
18
27
  /**
19
28
  * Platform Glass View — the single place a glass surface is chosen:
20
29
  * - iOS 26+: Real UIGlassEffect via @callstack/liquid-glass
21
30
  * - iOS < 26 / Android / Expo Go: translucent tint View with identical layout
22
31
  */
23
- export declare const GlassView: import("react").ForwardRefExoticComponent<NativeGlassProps & import("react").RefAttributes<any>>;
32
+ export declare const GlassView: import("react").ForwardRefExoticComponent<Omit<NativeGlassProps, "ref"> & import("react").RefAttributes<any>>;
@@ -22,6 +22,47 @@ export declare const springs: {
22
22
  readonly mass: 1;
23
23
  };
24
24
  };
25
+ /**
26
+ * The package's type scale, in React Native points.
27
+ *
28
+ * Text maps its variants onto these names so every component in the library —
29
+ * and every app built on it — sizes type the same way.
30
+ */
31
+ export declare const typeScale: {
32
+ title: {
33
+ fontSize: number;
34
+ lineHeight: number;
35
+ fontWeight: "700";
36
+ };
37
+ heading: {
38
+ fontSize: number;
39
+ lineHeight: number;
40
+ fontWeight: "600";
41
+ };
42
+ body: {
43
+ fontSize: number;
44
+ lineHeight: number;
45
+ fontWeight: "400";
46
+ };
47
+ label: {
48
+ fontSize: number;
49
+ lineHeight: number;
50
+ fontWeight: "600";
51
+ };
52
+ caption: {
53
+ fontSize: number;
54
+ lineHeight: number;
55
+ fontWeight: "400";
56
+ };
57
+ };
58
+ /**
59
+ * Theme colours in the form React Native accepts.
60
+ *
61
+ * The shared tokens express colours as CSS colour strings (`rgb(r g b / a)`),
62
+ * which is right for the web package and rejected by React Native. The values
63
+ * below are the same colours written as `rgba(...)`/hex, sourced from the same
64
+ * token file, so the two platforms stay in step.
65
+ */
25
66
  export declare const colors: {
26
67
  light: {
27
68
  foreground: string;
@@ -29,8 +70,15 @@ export declare const colors: {
29
70
  glass: string;
30
71
  glassActive: string;
31
72
  edge: string;
73
+ separator: string;
32
74
  fill: string;
33
75
  destructive: string;
76
+ on: string;
77
+ warning: string;
78
+ info: string;
79
+ scrim: string;
80
+ onTint: string;
81
+ skeleton: string;
34
82
  axis: string;
35
83
  };
36
84
  dark: {
@@ -39,8 +87,21 @@ export declare const colors: {
39
87
  glass: string;
40
88
  glassActive: string;
41
89
  edge: string;
90
+ separator: string;
42
91
  fill: string;
43
92
  destructive: string;
93
+ on: string;
94
+ warning: string;
95
+ info: string;
96
+ scrim: string;
97
+ onTint: string;
98
+ skeleton: string;
44
99
  axis: string;
45
100
  };
46
101
  };
102
+ /** Keeps the shared token file honest if a colour is added there first. */
103
+ export type ThemeColors = typeof colors.light;
104
+ /** The semantic tone of a feedback component (Banner, Toast). */
105
+ export type Tone = "info" | "success" | "warning" | "error";
106
+ /** Resolves a tone to its theme colour. */
107
+ export declare function toneColor(theme: ThemeColors, tone: Tone): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glacia-native",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Liquid Glass UI components for React Native — real iOS 26 glass, with a clean fallback on Android and older iOS.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "react-native-svg": ">=13"
28
28
  },
29
29
  "dependencies": {
30
- "glacia-tokens": "0.4.0"
30
+ "glacia-tokens": "0.5.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@testing-library/react": "^16.3.3",
package/src/Bars.tsx ADDED
@@ -0,0 +1,570 @@
1
+ import { forwardRef, useState, type ReactNode } from "react";
2
+ import type { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+
4
+ import { Glass } from "./Glass";
5
+ import { Button } from "./Button";
6
+ import { Text } from "./Text";
7
+ import { colors, radii } from "./internal/tokens";
8
+ import { primitives } from "./internal/primitives";
9
+ import { useIsDark, useSpring } from "./internal/motion";
10
+
11
+ // ---------------------------------------------------------------------------
12
+ // SearchBar
13
+
14
+ export interface SearchBarProps {
15
+ /** Controlled text. Omit and the bar keeps its own. */
16
+ value?: string;
17
+ defaultValue?: string;
18
+ onChangeText?: (text: string) => void;
19
+ onSubmit?: (text: string) => void;
20
+ placeholder?: string;
21
+ /** Shows a cancel button beside the field while it holds text or focus. */
22
+ showCancel?: boolean;
23
+ onCancel?: () => void;
24
+ accessibilityLabel?: string;
25
+ style?: StyleProp<ViewStyle>;
26
+ isDark?: boolean;
27
+ testID?: string;
28
+ }
29
+
30
+ /**
31
+ * A search field for a bar or a screen header.
32
+ *
33
+ * Distinct from NativeAIInput: that is an AI composer with send semantics, this
34
+ * is ordinary app search — magnifier, themed placeholder, and a clear button
35
+ * once there is something to clear.
36
+ */
37
+ export const SearchBar = forwardRef<any, SearchBarProps>(function SearchBar(
38
+ {
39
+ value: valueProp,
40
+ defaultValue = "",
41
+ onChangeText,
42
+ onSubmit,
43
+ placeholder = "Search",
44
+ showCancel = false,
45
+ onCancel,
46
+ accessibilityLabel = "Search",
47
+ style,
48
+ isDark: isDarkProp,
49
+ testID,
50
+ ...props
51
+ },
52
+ ref,
53
+ ) {
54
+ const isDark = useIsDark(isDarkProp);
55
+ const theme = isDark ? colors.dark : colors.light;
56
+ const { View, Text: RNText, TextInput, Pressable } = primitives();
57
+
58
+ const [internal, setInternal] = useState(defaultValue);
59
+ const value = valueProp !== undefined ? valueProp : internal;
60
+
61
+ const handleChange = (next: string) => {
62
+ if (valueProp === undefined) setInternal(next);
63
+ onChangeText?.(next);
64
+ };
65
+
66
+ const clear = () => handleChange("");
67
+
68
+ return (
69
+ <View
70
+ ref={ref}
71
+ testID={testID}
72
+ style={[{ flexDirection: "row", alignItems: "center", gap: 8 }, style as ViewStyle]}
73
+ {...props}
74
+ >
75
+ <Glass
76
+ effect="regular"
77
+ isDark={isDark}
78
+ style={{
79
+ flex: 1,
80
+ flexDirection: "row",
81
+ alignItems: "center",
82
+ gap: 8,
83
+ height: 36,
84
+ borderRadius: radii.pill,
85
+ paddingHorizontal: 12,
86
+ }}
87
+ >
88
+ <RNText accessibilityElementsHidden importantForAccessibility="no" style={{ fontSize: 14, color: theme.muted }}>
89
+ {"\u2315"}
90
+ </RNText>
91
+ <View style={{ flex: 1, justifyContent: "center" }}>
92
+ {!value && placeholder ? (
93
+ // Themed placeholder: the OS default colour ignores the theme.
94
+ <RNText
95
+ pointerEvents="none"
96
+ numberOfLines={1}
97
+ style={{ position: "absolute", left: 0, fontSize: 15, color: theme.muted }}
98
+ >
99
+ {placeholder}
100
+ </RNText>
101
+ ) : null}
102
+ <TextInput
103
+ accessibilityRole="search"
104
+ accessibilityLabel={accessibilityLabel}
105
+ value={value}
106
+ onChangeText={handleChange}
107
+ onSubmitEditing={() => onSubmit?.(value)}
108
+ returnKeyType="search"
109
+ autoCorrect={false}
110
+ placeholder=""
111
+ style={{
112
+ fontSize: 15,
113
+ paddingVertical: 4,
114
+ color: theme.foreground,
115
+ // Transparent: the themed placeholder above provides the hint.
116
+ backgroundColor: "transparent",
117
+ }}
118
+ />
119
+ </View>
120
+ {value.length > 0 && (
121
+ <Pressable
122
+ accessibilityRole="button"
123
+ accessibilityLabel="Clear search"
124
+ onPress={clear}
125
+ hitSlop={8}
126
+ >
127
+ <View
128
+ style={{
129
+ width: 16,
130
+ height: 16,
131
+ // A circle from its own size: half the 16pt box.
132
+ borderRadius: 16 / 2,
133
+ backgroundColor: theme.separator,
134
+ alignItems: "center",
135
+ justifyContent: "center",
136
+ }}
137
+ >
138
+ <RNText style={{ fontSize: 10, color: theme.muted }}>{"\u00D7"}</RNText>
139
+ </View>
140
+ </Pressable>
141
+ )}
142
+ </Glass>
143
+ {showCancel && (
144
+ <Pressable
145
+ accessibilityRole="button"
146
+ accessibilityLabel="Cancel"
147
+ onPress={() => {
148
+ clear();
149
+ onCancel?.();
150
+ }}
151
+ >
152
+ <RNText style={{ fontSize: 15, color: theme.fill }}>Cancel</RNText>
153
+ </Pressable>
154
+ )}
155
+ </View>
156
+ );
157
+ });
158
+
159
+ // ---------------------------------------------------------------------------
160
+ // Chip
161
+
162
+ export interface ChipProps {
163
+ label: string;
164
+ icon?: ReactNode;
165
+ /** Shows a close affordance; called when it is pressed. */
166
+ onClose?: () => void;
167
+ /** Tapping the chip. Omit to make it a static tag. */
168
+ onPress?: () => void;
169
+ /** Controlled selection. Omit for a plain tag with no selected state. */
170
+ selected?: boolean;
171
+ defaultSelected?: boolean;
172
+ onSelectedChange?: (selected: boolean) => void;
173
+ disabled?: boolean;
174
+ style?: StyleProp<ViewStyle>;
175
+ isDark?: boolean;
176
+ testID?: string;
177
+ }
178
+
179
+ /**
180
+ * A filter or tag pill.
181
+ *
182
+ * Selected state is a glass pill tinted with `glassActive` — the same selected
183
+ * treatment SegmentedControl and TabBar use, rather than a new colour.
184
+ */
185
+ export const Chip = forwardRef<any, ChipProps>(function Chip(
186
+ {
187
+ label,
188
+ icon,
189
+ onClose,
190
+ onPress,
191
+ selected: selectedProp,
192
+ defaultSelected = false,
193
+ onSelectedChange,
194
+ disabled = false,
195
+ style,
196
+ isDark: isDarkProp,
197
+ testID,
198
+ ...props
199
+ },
200
+ ref,
201
+ ) {
202
+ const isDark = useIsDark(isDarkProp);
203
+ const theme = isDark ? colors.dark : colors.light;
204
+ const { View, Text: RNText, Pressable } = primitives();
205
+
206
+ const [internalSelected, setInternalSelected] = useState(defaultSelected);
207
+ const selected = selectedProp !== undefined ? selectedProp : internalSelected;
208
+ const selectable = selectedProp !== undefined || onSelectedChange !== undefined || defaultSelected;
209
+
210
+ const handlePress = () => {
211
+ if (disabled) return;
212
+ if (selectable) {
213
+ const next = !selected;
214
+ if (selectedProp === undefined) setInternalSelected(next);
215
+ onSelectedChange?.(next);
216
+ }
217
+ onPress?.();
218
+ };
219
+
220
+ const pill = (
221
+ <Glass
222
+ effect="regular"
223
+ isDark={isDark}
224
+ tintColor={selected ? theme.glassActive : undefined}
225
+ interactive={!disabled}
226
+ style={{
227
+ flexDirection: "row",
228
+ alignItems: "center",
229
+ gap: 6,
230
+ height: 30,
231
+ paddingHorizontal: 12,
232
+ borderRadius: radii.pill,
233
+ opacity: disabled ? 0.38 : 1,
234
+ ...(style as ViewStyle),
235
+ }}
236
+ >
237
+ {icon ? <View>{icon}</View> : null}
238
+ <RNText
239
+ numberOfLines={1}
240
+ style={{ fontSize: 13, fontWeight: selected ? "600" : "500", color: selected ? theme.foreground : theme.muted }}
241
+ >
242
+ {label}
243
+ </RNText>
244
+ {onClose && (
245
+ <Pressable
246
+ accessibilityRole="button"
247
+ accessibilityLabel={`Remove ${label}`}
248
+ onPress={onClose}
249
+ hitSlop={8}
250
+ >
251
+ <RNText style={{ fontSize: 11, color: theme.muted }}>{"\u00D7"}</RNText>
252
+ </Pressable>
253
+ )}
254
+ </Glass>
255
+ );
256
+
257
+ if (!onPress && !selectable) {
258
+ return (
259
+ <View ref={ref} testID={testID} accessibilityRole="text" accessibilityLabel={label} {...props}>
260
+ {pill}
261
+ </View>
262
+ );
263
+ }
264
+
265
+ return (
266
+ <Pressable
267
+ ref={ref}
268
+ testID={testID}
269
+ accessibilityRole="button"
270
+ accessibilityLabel={label}
271
+ accessibilityState={{ selected: selectable ? selected : undefined, disabled }}
272
+ disabled={disabled}
273
+ onPress={handlePress}
274
+ {...props}
275
+ >
276
+ {pill}
277
+ </Pressable>
278
+ );
279
+ });
280
+
281
+ // ---------------------------------------------------------------------------
282
+ // FAB
283
+
284
+ export interface FABProps {
285
+ onPress: () => void;
286
+ /** Required: an icon-only circle has no text to announce. */
287
+ accessibilityLabel: string;
288
+ /** The icon. When a label string is also supplied, the FAB is extended. */
289
+ icon?: ReactNode;
290
+ /** Turns the circle into an extended pill with visible text. */
291
+ label?: string;
292
+ size?: "md" | "lg";
293
+ disabled?: boolean;
294
+ style?: StyleProp<ViewStyle>;
295
+ isDark?: boolean;
296
+ testID?: string;
297
+ }
298
+
299
+ const fabSizes = { md: 56, lg: 64 };
300
+
301
+ /**
302
+ * The floating action button.
303
+ *
304
+ * The flagship glass circle of the library: a round `Glass` with `interactive`
305
+ * so the material itself responds to touch. The caller positions it; the
306
+ * component does not assume an edge.
307
+ */
308
+ export const FAB = forwardRef<any, FABProps>(function FAB(
309
+ {
310
+ onPress,
311
+ accessibilityLabel,
312
+ icon,
313
+ label,
314
+ size = "md",
315
+ disabled = false,
316
+ style,
317
+ isDark: isDarkProp,
318
+ testID,
319
+ ...props
320
+ },
321
+ ref,
322
+ ) {
323
+ const isDark = useIsDark(isDarkProp);
324
+ const theme = isDark ? colors.dark : colors.light;
325
+ const { View, Text: RNText, Pressable } = primitives();
326
+
327
+ const dimension = fabSizes[size];
328
+ const extended = Boolean(label);
329
+
330
+ return (
331
+ <Pressable
332
+ ref={ref}
333
+ testID={testID}
334
+ accessibilityRole="button"
335
+ accessibilityLabel={accessibilityLabel}
336
+ accessibilityState={{ disabled }}
337
+ disabled={disabled}
338
+ onPress={disabled ? undefined : onPress}
339
+ style={({ pressed }: { pressed: boolean }) => ({
340
+ alignSelf: "flex-start",
341
+ opacity: disabled ? 0.38 : pressed ? 0.85 : 1,
342
+ })}
343
+ {...props}
344
+ >
345
+ <Glass
346
+ effect="clear"
347
+ interactive={!disabled}
348
+ isDark={isDark}
349
+ style={{
350
+ height: dimension,
351
+ width: extended ? undefined : dimension,
352
+ minWidth: dimension,
353
+ borderRadius: extended ? dimension / 2 : dimension / 2,
354
+ paddingHorizontal: extended ? 20 : 0,
355
+ flexDirection: "row",
356
+ alignItems: "center",
357
+ justifyContent: "center",
358
+ gap: 8,
359
+ ...(style as ViewStyle),
360
+ }}
361
+ >
362
+ {icon ? <View>{icon}</View> : null}
363
+ {label ? (
364
+ <RNText style={{ fontSize: 15, fontWeight: "600", color: theme.foreground }} numberOfLines={1}>
365
+ {label}
366
+ </RNText>
367
+ ) : null}
368
+ </Glass>
369
+ </Pressable>
370
+ );
371
+ });
372
+
373
+ // ---------------------------------------------------------------------------
374
+ // IconButton
375
+
376
+ export interface IconButtonProps {
377
+ /** Required: the icon carries no text of its own. */
378
+ accessibilityLabel: string;
379
+ onPress: () => void;
380
+ icon: ReactNode;
381
+ size?: "sm" | "md" | "lg";
382
+ variant?: "glass" | "ghost";
383
+ disabled?: boolean;
384
+ style?: StyleProp<ViewStyle>;
385
+ isDark?: boolean;
386
+ testID?: string;
387
+ }
388
+
389
+ const iconButtonSizes = { sm: 28, md: 36, lg: 44 };
390
+
391
+ /**
392
+ * An icon-only button on glass.
393
+ *
394
+ * Button takes an icon alongside a label; this is the icon-only form, which
395
+ * every kit ships for toolbars and bar actions.
396
+ */
397
+ export const IconButton = forwardRef<any, IconButtonProps>(function IconButton(
398
+ {
399
+ accessibilityLabel,
400
+ onPress,
401
+ icon,
402
+ size = "md",
403
+ variant = "glass",
404
+ disabled = false,
405
+ style,
406
+ isDark: isDarkProp,
407
+ testID,
408
+ ...props
409
+ },
410
+ ref,
411
+ ) {
412
+ const isDark = useIsDark(isDarkProp);
413
+ const theme = isDark ? colors.dark : colors.light;
414
+ const { View, Pressable } = primitives();
415
+ const dimension = iconButtonSizes[size];
416
+
417
+ return (
418
+ <Pressable
419
+ ref={ref}
420
+ testID={testID}
421
+ accessibilityRole="button"
422
+ accessibilityLabel={accessibilityLabel}
423
+ accessibilityState={{ disabled }}
424
+ disabled={disabled}
425
+ onPress={disabled ? undefined : onPress}
426
+ style={({ pressed }: { pressed: boolean }) => ({ opacity: disabled ? 0.38 : pressed ? 0.8 : 1 })}
427
+ {...props}
428
+ >
429
+ <Glass
430
+ effect={variant === "ghost" ? "none" : "regular"}
431
+ interactive={!disabled && variant !== "ghost"}
432
+ isDark={isDark}
433
+ style={{
434
+ width: dimension,
435
+ height: dimension,
436
+ borderRadius: dimension / 2,
437
+ alignItems: "center",
438
+ justifyContent: "center",
439
+ backgroundColor: variant === "ghost" ? "transparent" : undefined,
440
+ ...(style as ViewStyle),
441
+ }}
442
+ >
443
+ <View style={{ width: dimension * 0.5, height: dimension * 0.5, alignItems: "center", justifyContent: "center" }}>
444
+ {icon}
445
+ </View>
446
+ </Glass>
447
+ </Pressable>
448
+ );
449
+ });
450
+
451
+ // ---------------------------------------------------------------------------
452
+ // AppBar
453
+
454
+ export interface AppBarAction {
455
+ /** Announced to screen readers; the icon is decorative. */
456
+ accessibilityLabel: string;
457
+ icon: ReactNode;
458
+ onPress: () => void;
459
+ disabled?: boolean;
460
+ }
461
+
462
+ export interface AppBarProps {
463
+ title: string;
464
+ /** Optional second line under the title. */
465
+ subtitle?: string;
466
+ /** A back or menu action at the leading edge. */
467
+ leading?: AppBarAction;
468
+ /** Actions at the trailing edge. */
469
+ actions?: AppBarAction[];
470
+ /**
471
+ * The caller's safe-area inset above the bar. Glacia takes it as a prop
472
+ * rather than adding a native insets dependency: on a device the app already
473
+ * knows its insets, and passing a number keeps this component dependency-free.
474
+ */
475
+ topInset?: number;
476
+ style?: StyleProp<ViewStyle>;
477
+ isDark?: boolean;
478
+ testID?: string;
479
+ }
480
+
481
+ /**
482
+ * The top bar.
483
+ *
484
+ * A glass bar across the top of the screen with a leading action, a title and
485
+ * trailing actions — the counterpart to the existing bottom TabBar.
486
+ */
487
+ export const AppBar = forwardRef<any, AppBarProps>(function AppBar(
488
+ {
489
+ title,
490
+ subtitle,
491
+ leading,
492
+ actions,
493
+ topInset = 0,
494
+ style,
495
+ isDark: isDarkProp,
496
+ testID,
497
+ ...props
498
+ },
499
+ ref,
500
+ ) {
501
+ const isDark = useIsDark(isDarkProp);
502
+ const theme = isDark ? colors.dark : colors.light;
503
+ const { View, Text: RNText, Pressable } = primitives();
504
+ const actionCount = actions?.length ?? 0;
505
+
506
+ const renderAction = (action: AppBarAction, key: string) => (
507
+ <Pressable
508
+ key={key}
509
+ accessibilityRole="button"
510
+ accessibilityLabel={action.accessibilityLabel}
511
+ accessibilityState={{ disabled: action.disabled }}
512
+ disabled={action.disabled}
513
+ onPress={action.disabled ? undefined : action.onPress}
514
+ hitSlop={6}
515
+ style={{ padding: 6, opacity: action.disabled ? 0.38 : 1 }}
516
+ >
517
+ {action.icon}
518
+ </Pressable>
519
+ );
520
+
521
+ return (
522
+ <Glass
523
+ ref={ref}
524
+ effect="regular"
525
+ isDark={isDark}
526
+ testID={testID}
527
+ style={{
528
+ borderRadius: 0,
529
+ borderTopWidth: 0,
530
+ borderLeftWidth: 0,
531
+ borderRightWidth: 0,
532
+ ...(style as ViewStyle),
533
+ }}
534
+ {...props}
535
+ >
536
+ <View
537
+ style={{
538
+ paddingTop: topInset,
539
+ paddingHorizontal: 8,
540
+ paddingBottom: 8,
541
+ flexDirection: "row",
542
+ alignItems: "center",
543
+ gap: 4,
544
+ minHeight: 44 + topInset,
545
+ }}
546
+ >
547
+ {leading ? renderAction(leading, "leading") : <View style={{ width: 8 }} />}
548
+ <View style={{ flex: 1, paddingHorizontal: 4 }}>
549
+ <RNText
550
+ accessibilityRole="header"
551
+ numberOfLines={1}
552
+ style={{ fontSize: 17, fontWeight: "600", color: theme.foreground }}
553
+ >
554
+ {title}
555
+ </RNText>
556
+ {subtitle ? (
557
+ <RNText numberOfLines={1} style={{ fontSize: 12, color: theme.muted }}>
558
+ {subtitle}
559
+ </RNText>
560
+ ) : null}
561
+ </View>
562
+ {actions && actionCount > 0 ? (
563
+ <View style={{ flexDirection: "row", alignItems: "center" }}>
564
+ {actions.map((action, index) => renderAction(action, `action-${index}`))}
565
+ </View>
566
+ ) : null}
567
+ </View>
568
+ </Glass>
569
+ );
570
+ });