@plexui/react-native 0.3.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.
@@ -83,6 +83,11 @@ const lensMask = (width, height, radius) => {
83
83
  `<path filter="url(#e)" fill-rule="evenodd" d="M-20 -20H${f(width + 20)}V${f(height + 20)}H-20Z${hole}"/></svg>`;
84
84
  return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
85
85
  };
86
+ /** The clear glass where its tokens are not set: the kit's gray 153 at 17% over a light blur. */
87
+ const CLEAR_FILL = "rgba(153, 153, 153, 0.17)";
88
+ const CLEAR_FILTER = "blur(4px) brightness(1.08)";
89
+ /** Clear glass with no blur (Reduce Transparency, no blur module): a dark gray, as the clear glass over a dark photo. */
90
+ const CLEAR_OPAQUE = "#3a3a3c";
86
91
  /** The filter and the shadow of the glass surfaces of the phone layer, by their fill (mobile-materials.css, touch.css). */
87
92
  const SURFACES = {
88
93
  "--menu-mobile-background": { filter: "--menu-mobile-backdrop-filter", shadow: "--menu-shadow" },
@@ -101,7 +106,7 @@ const intensityOf = (radius) => Math.max(0, Math.min(100, Math.round(radius * 5)
101
106
  * over live content cannot be read (dark glass is white at 12%), and HIG materials turn opaque then. Material 3 has
102
107
  * no glass: on Android the components draw their tonal containers instead and do not use this.
103
108
  */
104
- export function Glass({ radius = 0, elevation = "regular", tint, interactive, fillToken, filterToken, shadowToken, blur, style, children, ...rest }) {
109
+ export function Glass({ radius = 0, elevation = "regular", tint, interactive, clear = false, fillToken, filterToken, shadowToken, blur, style, children, ...rest }) {
105
110
  const theme = useTheme();
106
111
  // The web lens's mask follows the glass's shape, so it needs the glass's size
107
112
  const [size, setSize] = useState(null);
@@ -109,17 +114,17 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
109
114
  const overrides = useThemeOverrides();
110
115
  const shape = { borderRadius: radius, borderCurve: "continuous" };
111
116
  const surface = fillToken ? SURFACES[fillToken] : undefined;
112
- const shadow = theme.token(shadowToken ?? surface?.shadow ?? (elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"));
117
+ const shadow = theme.token(shadowToken ?? surface?.shadow ?? (clear ? "--mobile-glass-clear-shadow" : elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"));
113
118
  const boxShadow = typeof shadow === "string" ? shadow : undefined;
114
119
  const native = liquidGlassModule();
115
120
  // iOS 26's own glass turns frostier by itself with Reduce Transparency
116
121
  if (native) {
117
122
  const { GlassView } = native;
118
- return (_jsx(GlassView, { ...rest, glassEffectStyle: "regular", colorScheme: theme.scheme, tintColor: tint, isInteractive: interactive, style: [shape, style], children: children }));
123
+ return (_jsx(GlassView, { ...rest, glassEffectStyle: clear ? "clear" : "regular", colorScheme: theme.scheme, tintColor: tint, isInteractive: interactive, style: [shape, style], children: children }));
119
124
  }
120
125
  const web = Platform.OS === "web";
121
- const fillName = fillToken ?? "--mobile-glass-background";
122
- const filterName = filterToken ?? surface?.filter ?? "--mobile-glass-backdrop-filter";
126
+ const fillName = fillToken ?? (clear ? "--mobile-glass-clear-background" : "--mobile-glass-background");
127
+ const filterName = filterToken ?? surface?.filter ?? (clear ? "--mobile-glass-clear-backdrop-filter" : "--mobile-glass-backdrop-filter");
123
128
  const dense = web && !theme.isAndroid ? WEB_DENSE[fillName] : undefined;
124
129
  const denseFill = dense != null && tint == null && overrides?.[fillName] == null;
125
130
  // Glass with a fill of its own and the plain glass's filter (the large segmented control) blurs as the plain glass
@@ -127,9 +132,9 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
127
132
  const plainFilter = web && !theme.isAndroid && dense == null && filterToken == null && filterName === "--mobile-glass-backdrop-filter" && overrides?.[filterName] == null;
128
133
  const denseFilter = (dense != null && filterToken == null && overrides?.[filterName] == null) || plainFilter;
129
134
  const webFilter = dense ?? WEB_DENSE["--mobile-glass-background"];
130
- const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName));
135
+ const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName, clear ? CLEAR_FILL : undefined));
131
136
  const filterValue = denseFilter ? (theme.token(webFilter.filter) ?? webFilter.blur) : theme.token(filterName);
132
- const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : "blur(12px)";
137
+ const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : clear ? CLEAR_FILTER : "blur(12px)";
133
138
  const module = web || Platform.OS !== "ios" ? null : blurModule();
134
139
  const opaque = reduceTransparency || (!web && module == null);
135
140
  if (web && !opaque) {
@@ -167,5 +172,7 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
167
172
  ] })) : null, children] }));
168
173
  }
169
174
  const radiusPx = Number(/blur\(\s*([\d.]+)px\s*\)/.exec(filter)?.[1] ?? 12);
170
- return (_jsxs(View, { ...rest, style: [shape, { boxShadow }, style], children: [_jsxs(View, { style: [StyleSheet.absoluteFill, shape, { overflow: "hidden" }], pointerEvents: "none", children: [opaque ? (_jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: theme.color("--mobile-surface-elevated-plain-primary", theme.colors.surfaceElevated) }] })) : module ? (_jsx(module.BlurView, { intensity: intensityOf(radiusPx), tint: theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight", style: StyleSheet.absoluteFill })) : null, _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: fill }] })] }), children] }));
175
+ return (_jsxs(View, { ...rest, style: [shape, { boxShadow }, style], children: [_jsxs(View, { style: [StyleSheet.absoluteFill, shape, { overflow: "hidden" }], pointerEvents: "none", children: [opaque ? (
176
+ // Clear glass carries a light label over a photo or a color: opaque, it stands on a dark gray so the label reads
177
+ _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: clear ? theme.color("--mobile-glass-clear-opaque-background", CLEAR_OPAQUE) : theme.color("--mobile-surface-elevated-plain-primary", theme.colors.surfaceElevated) }] })) : module ? (_jsx(module.BlurView, { intensity: intensityOf(radiusPx), tint: clear ? "systemUltraThinMaterial" : theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight", style: StyleSheet.absoluteFill })) : null, _jsx(View, { style: [StyleSheet.absoluteFill, { backgroundColor: fill }] })] }), children] }));
171
178
  }
@@ -1,10 +1,29 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type StyleProp, type ViewStyle } from "react-native";
3
+ /** The tones of a hero's symbol. */
4
+ export type BottomSheetHeroTone = "accent" | "secondary" | "success" | "warning" | "danger";
5
+ export type BottomSheetHero = {
6
+ /** A symbol (an icon of the set, sized and colored by the sheet) or a drawing of the app's own, at its own size. */
7
+ icon?: ReactNode;
8
+ /** The sheet's title, large and centered under the symbol. */
9
+ title: ReactNode;
10
+ /** A line or two under the title. */
11
+ description?: ReactNode;
12
+ /** The symbol's color. @default "accent" */
13
+ tone?: BottomSheetHeroTone;
14
+ };
3
15
  export type BottomSheetProps = {
4
16
  open: boolean;
5
17
  onOpenChange: (open: boolean) => void;
6
18
  /** A title over the content, centered on iOS. */
7
19
  title?: ReactNode;
20
+ /**
21
+ * A hero header at the top of the content instead of a title in the bar, as a setup or a what's-new sheet: on iOS a
22
+ * 56pt symbol over a centered Title 1 bold (28/34) and an optional 17/22 description, the bar keeping only Close; on
23
+ * Android Material's hero icon (24dp, secondary) over a centered headline (24/32) and a 14/20 supporting text, Close
24
+ * in its bar's circle. It names the sheet.
25
+ */
26
+ hero?: BottomSheetHero;
8
27
  children?: ReactNode;
9
28
  /** A tap on the dim, a drag down, Close, Android's back and Escape close it. @default true */
10
29
  dismissible?: boolean;
@@ -43,10 +62,12 @@ type SheetExit = {
43
62
  exit?: number;
44
63
  /** Called once the sheet has left. */
45
64
  onExited?: () => void;
65
+ /** Android draws Close without a title (a plain list of choices, ActionSheet, does not). @default true */
66
+ androidClose?: boolean;
46
67
  };
47
68
  declare function BottomSheetRoot(props: BottomSheetProps): import("react").JSX.Element;
48
69
  /** The sheet with an exit of its own (ActionSheet's item tap); not part of the public API. */
49
- export declare function BottomSheetBase({ open, onOpenChange, title, children, dismissible, "aria-label": ariaLabel, testID, contentStyle, closeLabel, detent, exit, onExited, }: BottomSheetProps & SheetExit): import("react").JSX.Element;
70
+ export declare function BottomSheetBase({ open, onOpenChange, title: titleProp, hero, children, dismissible, "aria-label": ariaLabel, testID, contentStyle, closeLabel, detent, exit, onExited, androidClose, }: BottomSheetProps & SheetExit): import("react").JSX.Element;
50
71
  /**
51
72
  * A sheet from the bottom edge: on iOS 26 the sheet of the phone layer (`--dialog-sheet-radius` 38 on its top corners,
52
73
  * a bar 16 under its top edge with Close at the leading edge and the title centered, as the web's phone Sheet; no
@@ -23,8 +23,12 @@ export type ButtonProps = Omit<PressableProps, "children" | "style"> & {
23
23
  pill?: boolean;
24
24
  /** The shape on Android: a pill (default), as newer Android screens draw a button, or 8dp corners. */
25
25
  shape?: "round" | "square";
26
- /** The glass of iOS 26 for a neutral soft or ghost button. Android has no glass. */
27
- mobileMaterial?: "glass" | "flat";
26
+ /**
27
+ * The glass of iOS 26 for a neutral soft or ghost button, or its clear glass over a photo, a video or a color (a
28
+ * light frost and a #f5f5f5 label, in both themes). Android has no glass: a clear button there is a translucent
29
+ * gray with the same label.
30
+ */
31
+ mobileMaterial?: "glass" | "flat" | "clear";
28
32
  /** A button as wide and tall: an icon alone. */
29
33
  uniform?: boolean;
30
34
  /** Takes the whole width. */
@@ -3,6 +3,12 @@ import { type AccessibilityActionEvent, type StyleProp, type ViewStyle } from "r
3
3
  import { type MenuContentProps } from "../Menu/Menu";
4
4
  /** A touch and hold opens the menu after half a second, as the web's ContextMenu (CONTEXT_MENU_LONG_PRESS). */
5
5
  export declare const CONTEXT_MENU_LONG_PRESS = 500;
6
+ /**
7
+ * `card`: the element on the preview's card (a grouped surface, clipped to the kit's 30 or half the element's height).
8
+ * `element`: an element that draws its own shape, such as a chat bubble, lifts as it is, with no card and no clip,
9
+ * its shadow following its `radius` (UIKit's UITargetedPreview with a clear background and a visible path).
10
+ */
11
+ export type ContextMenuPreviewShape = "card" | "element";
6
12
  export type ContextMenuProps = {
7
13
  children: ReactNode;
8
14
  /** Holds the menu open or closed. */
@@ -34,10 +40,19 @@ type Holdable = {
34
40
  * runs; a touch and hold opens the menu, and so does a right click on the web. The lifted preview on iOS is the
35
41
  * element drawn again from its props, so state the element keeps inside itself is not in it.
36
42
  */
37
- declare function ContextMenuTrigger({ children, style }: {
43
+ export type ContextMenuTriggerProps = {
38
44
  children: ReactElement<Holdable>;
39
45
  style?: StyleProp<ViewStyle>;
40
- }): import("react").JSX.Element;
46
+ /**
47
+ * The element's own corner radius. On iOS the lifted preview keeps these corners (and with `shape="element"` its
48
+ * shadow follows them); on Android the dimming is cut around the element at them. Unset: a card at the kit's 30
49
+ * (half the element's height at most) on iOS, square on Android.
50
+ */
51
+ radius?: number;
52
+ /** `card` (default) lifts the element on the preview's card; `element` lifts an element that draws its own shape as it is. */
53
+ shape?: ContextMenuPreviewShape;
54
+ };
55
+ declare function ContextMenuTrigger({ children, style, radius, shape }: ContextMenuTriggerProps): import("react").JSX.Element;
41
56
  declare namespace ContextMenuTrigger {
42
57
  var displayName: string;
43
58
  }
@@ -97,6 +97,7 @@ type SurfaceProps = MenuContentProps & {
97
97
  context?: {
98
98
  preview: ReactNode;
99
99
  radius: number;
100
+ bare?: boolean;
100
101
  };
101
102
  };
102
103
  /** The floating panel of a menu, placed under its anchor (over it when the screen ends first). */
@@ -26,11 +26,11 @@ export { OTPInput, type OTPInputProps } from "./components/OTPInput/OTPInput";
26
26
  export { PhoneInput, type CountryCode, type PhoneDetails, type PhoneInputProps } from "./components/PhoneInput/PhoneInput";
27
27
  export { Select, type SelectOption, type SelectProps } from "./components/Select/Select";
28
28
  export { Menu, type MenuContentProps, type MenuItemProps, type MenuProps } from "./components/Menu/Menu";
29
- export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from "./components/ContextMenu/ContextMenu";
29
+ export { ContextMenu, type ContextMenuContentProps, type ContextMenuPreviewShape, type ContextMenuProps, type ContextMenuTriggerProps } from "./components/ContextMenu/ContextMenu";
30
30
  export { ScrollEdge, type ScrollEdgeProps } from "./components/ScrollEdge/ScrollEdge";
31
31
  export { DatePicker, type DatePickerDisplay, type DatePickerMode, type DatePickerProps } from "./components/DatePicker/DatePicker";
32
32
  export { ActionSheet, type ActionSheetAction, type ActionSheetProps } from "./components/ActionSheet/ActionSheet";
33
- export { BottomSheet, type BottomSheetFooterProps, type BottomSheetProps } from "./components/BottomSheet/BottomSheet";
33
+ export { BottomSheet, type BottomSheetFooterProps, type BottomSheetHero, type BottomSheetHeroTone, type BottomSheetProps } from "./components/BottomSheet/BottomSheet";
34
34
  export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog/Dialog";
35
35
  export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, type ToastT, type ToastType } from "./components/Toast/Toast";
36
36
  export { Avatar, AvatarGroup, type AvatarColor, type AvatarGroupProps, type AvatarProps, type AvatarVariant } from "./components/Avatar/Avatar";
@@ -8,6 +8,12 @@ export type GlassProps = ViewProps & {
8
8
  tint?: string;
9
9
  /** Native glass reacts to touches (iOS 26 interactive glass). */
10
10
  interactive?: boolean;
11
+ /**
12
+ * iOS 26's clear glass, for controls over a photo, a video or a color: native `.clear` glass on iOS 26, elsewhere
13
+ * the kit's clear fill (`--mobile-glass-clear-background`, gray 153 at 17%) with a light blur, a 0.5 rim and a
14
+ * faint shadow (`--mobile-glass-clear-*`), the same in light and dark: what is under it decides how it reads.
15
+ */
16
+ clear?: boolean;
11
17
  /** A fill token for the glass instead of `--mobile-glass-background` (menus, alerts and toasts set their own). */
12
18
  fillToken?: string;
13
19
  /**
@@ -31,4 +37,4 @@ export type GlassProps = ViewProps & {
31
37
  * over live content cannot be read (dark glass is white at 12%), and HIG materials turn opaque then. Material 3 has
32
38
  * no glass: on Android the components draw their tonal containers instead and do not use this.
33
39
  */
34
- export declare function Glass({ radius, elevation, tint, interactive, fillToken, filterToken, shadowToken, blur, style, children, ...rest }: GlassProps): import("react").JSX.Element;
40
+ export declare function Glass({ radius, elevation, tint, interactive, clear, fillToken, filterToken, shadowToken, blur, style, children, ...rest }: GlassProps): import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Plex UI components for React Native and Expo: iOS 26 and Material 3, on the shared @plexui/styles tokens",
5
5
  "license": "MIT",
6
6
  "homepage": "https://plexui.com",
@@ -84,7 +84,7 @@
84
84
  "test": "npm run typecheck && npm run lint && npm run test:web --prefix example"
85
85
  },
86
86
  "dependencies": {
87
- "@plexui/styles": "^0.17.11",
87
+ "@plexui/styles": "^0.17.12",
88
88
  "libphonenumber-js": "^1.13.17"
89
89
  },
90
90
  "peerDependencies": {
@@ -129,6 +129,7 @@ export function ActionSheet({ open, onOpenChange, title, message, actions, cance
129
129
  // With reduced motion the exit is at once either way
130
130
  exit={quick && !theme.reducedMotion ? ANDROID_PICK_EXIT : undefined}
131
131
  onExited={runPicked}
132
+ androidClose={false}
132
133
  >
133
134
  {/* Android's plain sheet title: Regular 16 in its secondary gray (#757575, #7D7D7D at night), 16 around it; a
134
135
  message under it in 14 */}
@@ -1,4 +1,4 @@
1
- import { isValidElement, useId, useLayoutEffect, useMemo, useState, type ReactNode } from "react"
1
+ import { Children, cloneElement, isValidElement, useId, useLayoutEffect, useMemo, useState, type ReactElement, type ReactNode } from "react"
2
2
  import { InSheetContext } from "./context"
3
3
  import { Animated, Easing, PanResponder, Platform, ScrollView, StyleSheet, View, useWindowDimensions, type LayoutChangeEvent, type NativeScrollEvent, type NativeSyntheticEvent, type StyleProp, type ViewStyle } from "react-native"
4
4
  import { Pressable } from "../../internal/Pressable"
@@ -6,17 +6,40 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"
6
6
  import { childrenOfType, flattenChildren } from "../../internal/children"
7
7
  import { useKeyboardHeight } from "../../internal/keyboard"
8
8
  import { iosDim, Overlay, ANDROID_DIM } from "../../internal/Overlay"
9
+ import { BarBackdrop, SoftBottomEdge } from "../../internal/BarBackdrop"
9
10
  import { withAlpha } from "../../theme/material"
10
11
  import { useTheme } from "../../theme/ThemeProvider"
11
- import { BarItemContext, type BarItemStyle } from "../Button/Button"
12
+ import { BarItemContext, Button, type BarItemStyle, type ButtonProps } from "../Button/Button"
12
13
  import { NavigationButton } from "../NavigationButton/NavigationButton"
14
+ import { IconDefaultsProvider } from "../Icon/createIcon"
13
15
  import { Text } from "../Text/Text"
14
16
 
17
+ /** The tones of a hero's symbol. */
18
+ export type BottomSheetHeroTone = "accent" | "secondary" | "success" | "warning" | "danger"
19
+
20
+ export type BottomSheetHero = {
21
+ /** A symbol (an icon of the set, sized and colored by the sheet) or a drawing of the app's own, at its own size. */
22
+ icon?: ReactNode
23
+ /** The sheet's title, large and centered under the symbol. */
24
+ title: ReactNode
25
+ /** A line or two under the title. */
26
+ description?: ReactNode
27
+ /** The symbol's color. @default "accent" */
28
+ tone?: BottomSheetHeroTone
29
+ }
30
+
15
31
  export type BottomSheetProps = {
16
32
  open: boolean
17
33
  onOpenChange: (open: boolean) => void
18
34
  /** A title over the content, centered on iOS. */
19
35
  title?: ReactNode
36
+ /**
37
+ * A hero header at the top of the content instead of a title in the bar, as a setup or a what's-new sheet: on iOS a
38
+ * 56pt symbol over a centered Title 1 bold (28/34) and an optional 17/22 description, the bar keeping only Close; on
39
+ * Android Material's hero icon (24dp, secondary) over a centered headline (24/32) and a 14/20 supporting text, Close
40
+ * in its bar's circle. It names the sheet.
41
+ */
42
+ hero?: BottomSheetHero
20
43
  children?: ReactNode
21
44
  /** A tap on the dim, a drag down, Close, Android's back and Escape close it. @default true */
22
45
  dismissible?: boolean
@@ -203,6 +226,8 @@ type SheetExit = {
203
226
  exit?: number
204
227
  /** Called once the sheet has left. */
205
228
  onExited?: () => void
229
+ /** Android draws Close without a title (a plain list of choices, ActionSheet, does not). @default true */
230
+ androidClose?: boolean
206
231
  }
207
232
 
208
233
  function BottomSheetRoot(props: BottomSheetProps) {
@@ -213,7 +238,8 @@ function BottomSheetRoot(props: BottomSheetProps) {
213
238
  export function BottomSheetBase({
214
239
  open,
215
240
  onOpenChange,
216
- title,
241
+ title: titleProp,
242
+ hero,
217
243
  children,
218
244
  dismissible = true,
219
245
  "aria-label": ariaLabel,
@@ -223,8 +249,11 @@ export function BottomSheetBase({
223
249
  detent = "content",
224
250
  exit,
225
251
  onExited,
252
+ androidClose = true,
226
253
  }: BottomSheetProps & SheetExit) {
227
254
  const theme = useTheme()
255
+ // A hero names the sheet from its content: the bar keeps Close alone
256
+ const title = hero ? undefined : titleProp
228
257
  const insets = useSafeAreaInsets()
229
258
  const { width, height: screen } = useWindowDimensions()
230
259
  const [height, setHeight] = useState(0)
@@ -263,7 +292,7 @@ export function BottomSheetBase({
263
292
  const web = Platform.OS === "web"
264
293
  // The web names the dialog by its title; a phone keeps the modal view
265
294
  const a11y = web
266
- ? { role: "dialog" as const, "aria-modal": true, "aria-labelledby": title != null ? titleId : undefined, "aria-label": title != null ? undefined : ariaLabel }
295
+ ? { role: "dialog" as const, "aria-modal": true, "aria-labelledby": title != null || hero ? titleId : undefined, "aria-label": title != null || hero ? undefined : ariaLabel }
267
296
  : { accessibilityViewIsModal: true, "aria-label": ariaLabel }
268
297
  // Android's sheet stands under the status bar at most; the phone layer's 16 under the top inset
269
298
  const maxHeight = screen - insets.top - (android ? 0 : 16)
@@ -273,20 +302,23 @@ export function BottomSheetBase({
273
302
  // Android's sheet is as wide as the screen in portrait; in landscape 80% of it and 480dp at least
274
303
  const maxWidth = android && width > screen ? Math.max(width * 0.8, Math.min(480, width)) : undefined
275
304
  const closeSize = theme.length("--dialog-sheet-close-size", 44)
276
- const margin = theme.length("--mobile-layout-margin", 16)
277
305
  // Android: content scrolled under the bar fades out under it; the footer's height sets the room under the content
278
306
  const [scrolled, setScrolled] = useState(false)
279
307
  // The Android bar's height: 69 with a title on one line, a line more when it wraps to a second
280
308
  const [androidBarHeight, setAndroidBarHeight] = useState(ANDROID_BAR_HEIGHT)
281
309
  const [footerHeight, setFooterHeight] = useState(0)
310
+ // iOS: the bar and the footer stand over the content, which scrolls under them (iOS 26's sheets)
311
+ const [iosBarHeight, setIosBarHeight] = useState(0)
282
312
  // Android's sheet has no handle: the whole sheet takes the drag. With a title its bar is the reference's sheet bar,
283
313
  // over the content: Close in a 46dp glass circle 12 under the top edge and 12 from the side (in line with the
284
314
  // content's cards), concentric with the sheet's corner, the title 17/22 Medium centered between the circles' places
285
315
  // (69 in all). Content scrolled under it shows through the sheet's color at
286
316
  // 63% over a light blur, let go over its last 32dp (12 past the bar), with no line
287
317
  const barItem = useMemoBarItem(background)
318
+ // Android's bar stands with a title, or with Close alone where the sheet can be closed (as iOS's)
319
+ const androidBar = android && (title != null || (dismissible && androidClose))
288
320
  const header = android ? (
289
- title != null ? (
321
+ androidBar ? (
290
322
  <View onStartShouldSetResponderCapture={gesture.chrome} onLayout={(event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height))} style={[styles.androidBar, { paddingHorizontal: androidInline }]}>
291
323
  <SheetBarFade fill={background} shown={scrolled} />
292
324
  <View style={styles.androidCircle}>
@@ -297,9 +329,9 @@ export function BottomSheetBase({
297
329
  ) : null}
298
330
  </View>
299
331
  <View style={styles.androidHeading}>
300
- <Text nativeID={titleId} accessibilityRole="header" weight="medium" align="center" numberOfLines={2} color={m.onSurface} style={{ fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }}>
332
+ {title == null ? null : <Text nativeID={titleId} accessibilityRole="header" weight="medium" align="center" numberOfLines={2} color={m.onSurface} style={{ fontSize: titleType.fontSize, lineHeight: titleType.lineHeight }}>
301
333
  {title}
302
- </Text>
334
+ </Text>}
303
335
  </View>
304
336
  <View style={styles.androidCircle} />
305
337
  </View>
@@ -309,10 +341,17 @@ export function BottomSheetBase({
309
341
  ) : dismissible || title != null ? (
310
342
  // The web's phone Sheet bar: one 44 row 16 under the top edge, Close at the leading edge and the title alone centered
311
343
  // The bar is the web's Toolbar: 16 above the row and --toolbar-padding-bottom under it
344
+ // It stands over the content: scrolled under it, the content goes soft (the veil of the canvas over a blur), as
345
+ // under a soft Toolbar
312
346
  <View
313
347
  {...responder.panHandlers}
314
- style={[styles.iosBar, { paddingTop: theme.length("--dialog-sheet-action-inset-block", 16), paddingBottom: theme.length("--toolbar-padding-bottom", 10), paddingHorizontal: margin }]}
348
+ onLayout={(event) => setIosBarHeight(event.nativeEvent.layout.height)}
349
+ // iOS 26's sheets set Close and Back 20 from the top and the sides (Health, Files, Apple Account)
350
+ style={[styles.iosBar, { paddingTop: IOS_BAR_INSET, paddingBottom: theme.length("--toolbar-padding-bottom", 10), paddingHorizontal: IOS_BAR_INSET }]}
315
351
  >
352
+ {scrolled ? (
353
+ <BarBackdrop fill={withAlpha(background, parseFloat(String(theme.token("--page-bar-veil-opacity") ?? "55")) / 100)} blur={theme.length("--page-bar-soft-blur", 10)} edge="bottom" />
354
+ ) : null}
316
355
  <View style={{ width: closeSize, height: closeSize }}>
317
356
  {dismissible ? <NavigationButton action="close" accessibilityLabel={closeLabel} onPress={close} /> : null}
318
357
  </View>
@@ -331,7 +370,15 @@ export function BottomSheetBase({
331
370
  // The content starts where the bar's soft edge ends (--page-bar-soft-tail under the bar, Dialog.module.css), and
332
371
  // ends 16 over a footer, or over the home indicator
333
372
  const bottom = keyboard || footer ? 16 : Math.max(16, insets.bottom)
334
- const iosContent = { paddingTop: theme.length("--page-bar-soft-tail", 32), paddingHorizontal: margin, paddingBottom: bottom }
373
+ const hasIosBar = !android && (dismissible || title != null)
374
+ const iosContent = {
375
+ paddingTop: (hasIosBar ? iosBarHeight : 0) + theme.length("--page-bar-soft-tail", 32),
376
+ // iOS 26's sheets set their fields and cards 20 from the sides, in line with Close (Health's Medication Name
377
+ // and its lists); the action at the foot stands further in, concentric with the screen's corners
378
+ paddingHorizontal: IOS_BAR_INSET,
379
+ // Over a footer: 16 above its actions, which stand over the content's end
380
+ paddingBottom: footer ? Math.max(0, footerHeight - keyboard) + 16 : bottom,
381
+ }
335
382
  // The sheet's way in and out, under the drag. Android's starts and ends 10 under the screen's edge, and leaves from
336
383
  // where a drag let it go: the drag shrinks with the progress, so the sheet goes from there to its place under the edge
337
384
  const slide = (progress: Animated.Value) =>
@@ -380,7 +427,7 @@ export function BottomSheetBase({
380
427
  },
381
428
  ]}
382
429
  >
383
- {android && title != null ? null : header}
430
+ {androidBar ? null : header}
384
431
  {/* Content taller than the screen scrolls; on iOS the drag stays on the bar, on Android it starts at the
385
432
  content's top */}
386
433
  <ScrollView
@@ -396,7 +443,13 @@ export function BottomSheetBase({
396
443
  },
397
444
  scrollEventThrottle: 16,
398
445
  }
399
- : null)}
446
+ : {
447
+ onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => {
448
+ const under = event.nativeEvent.contentOffset.y > 0
449
+ if (under !== scrolled) setScrolled(under)
450
+ },
451
+ scrollEventThrottle: 16,
452
+ })}
400
453
  contentContainerStyle={[
401
454
  android
402
455
  ? [
@@ -404,7 +457,7 @@ export function BottomSheetBase({
404
457
  // A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
405
458
  { paddingHorizontal: androidInline },
406
459
  // 2 under the bar: 71 under a one-line title
407
- title != null ? { paddingTop: androidBarHeight + 2 } : null,
460
+ androidBar ? { paddingTop: androidBarHeight + 2 } : null,
408
461
  // Over a footer: 8 above its height, which reaches over the sheet's bottom padding
409
462
  footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
410
463
  ]
@@ -414,14 +467,15 @@ export function BottomSheetBase({
414
467
  keyboardShouldPersistTaps="handled"
415
468
  bounces={false}
416
469
  >
470
+ {hero ? <SheetHero hero={hero} id={titleId} /> : null}
417
471
  {content}
418
472
  </ScrollView>
419
473
  {/* Android's bar stands over the content, which scrolls under it */}
420
- {android && title != null ? header : null}
474
+ {androidBar ? header : null}
421
475
  {footer ? (
422
476
  <View
423
477
  onStartShouldSetResponderCapture={android ? gesture.chrome : undefined}
424
- onLayout={android ? (event) => setFooterHeight(event.nativeEvent.layout.height) : undefined}
478
+ onLayout={(event) => setFooterHeight(event.nativeEvent.layout.height)}
425
479
  style={[
426
480
  android
427
481
  ? [
@@ -430,16 +484,18 @@ export function BottomSheetBase({
430
484
  // Over the sheet's color at 80%, faded in over its top 24dp, down over the gesture bar
431
485
  { paddingBottom: 12 + insets.bottom + keyboard, backgroundImage: `linear-gradient(to bottom, ${withAlpha(background, 0)}, ${withAlpha(background, 0.8)} 24px)` } as ViewStyle,
432
486
  ]
433
- : [styles.iosFooter, { paddingHorizontal: margin, paddingBottom: keyboard ? 16 : Math.max(16, insets.bottom) }],
487
+ : // iOS 26: the sheet's bottom corners are the screen's, so its actions stand as BottomActions does,
488
+ // concentric with them: 36 from the sides and from the bottom (Apple Account's Add Email: 38
489
+ // and 39), 52 tall, at least 2 over the home indicator; 16 over the keyboard
490
+ // It stands over the content's end, over the keyboard while it is up
491
+ [styles.iosFooter, { paddingHorizontal: IOS_ACTION_SIDE, paddingBottom: keyboard ? 16 + keyboard : Math.max(IOS_ACTION_SIDE, insets.bottom + 2) }],
434
492
  footer.props.style,
435
493
  ]}
436
494
  >
437
- {/* The content fades out under the footer: the panel color from 15 above it to its actions (the
438
- soft footer of Dialog.module.css) */}
439
- {android ? null : (
440
- <View pointerEvents="none" style={[styles.iosFooterEdge, { backgroundImage: `linear-gradient(${withAlpha(background, 0)}, ${background} 27px)` }]} />
441
- )}
442
- {footer.props.children}
495
+ {/* The content goes on under the footer into iOS 27.2's soft bottom edge: the panel's color from the
496
+ actions down, faded in over 27 above them, over a light blur (BottomActions' floating edge) */}
497
+ {android ? null : <SoftBottomEdge fill={background} top={12} tail={27} blur={theme.length("--toolbar-edge-blur-small", 3)} />}
498
+ {android ? footer.props.children : iosActions(footer.props.children)}
443
499
  </View>
444
500
  ) : null}
445
501
  </Animated.View>
@@ -459,6 +515,78 @@ export function BottomSheetBase({
459
515
  )
460
516
  }
461
517
 
518
+ /**
519
+ * A sheet's hero header. iOS: a 56pt symbol, 12 over a centered Title 1 bold (28/34, 4 more over a 17/22 secondary
520
+ * description), 24 over the content, as Apple's setup sheets. Android: Material's dialog hero, a 24dp icon in the
521
+ * secondary color 16 over a centered headline small (24/32), 16 over a 14/20 onSurfaceVariant text, 24 over the content.
522
+ */
523
+ function SheetHero({ hero, id }: { hero: BottomSheetHero; id: string }) {
524
+ const theme = useTheme()
525
+ const android = theme.isAndroid
526
+ const m = theme.material
527
+ const tone = hero.tone ?? "accent"
528
+ const ink =
529
+ tone === "accent"
530
+ ? android
531
+ ? m.secondary
532
+ : theme.colors.accent
533
+ : tone === "secondary"
534
+ ? android
535
+ ? m.onSurfaceVariant
536
+ : theme.colors.labelSecondary
537
+ : theme.color(`--color-text-${tone}-ghost`, theme.colors.accent)
538
+ const size = android ? 24 : theme.length("--bottom-sheet-hero-icon-size", 56)
539
+ return (
540
+ <View style={[styles.hero, { paddingBottom: 24 }]}>
541
+ {hero.icon != null ? (
542
+ <View style={{ marginBottom: android ? 16 : 12 }} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
543
+ <IconDefaultsProvider size={size} color={ink}>
544
+ {hero.icon}
545
+ </IconDefaultsProvider>
546
+ </View>
547
+ ) : null}
548
+ <Text
549
+ nativeID={id}
550
+ accessibilityRole="header"
551
+ align="center"
552
+ weight={android ? "regular" : "bold"}
553
+ color={android ? m.onSurface : undefined}
554
+ style={android ? { fontSize: 24, lineHeight: 32 } : { fontSize: theme.length("--bottom-sheet-hero-title-font-size", 28), lineHeight: theme.length("--bottom-sheet-hero-title-line-height", 34) }}
555
+ >
556
+ {hero.title}
557
+ </Text>
558
+ {hero.description != null ? (
559
+ <Text
560
+ align="center"
561
+ color={android ? m.onSurfaceVariant : theme.colors.labelSecondary}
562
+ style={android ? { fontSize: 14, lineHeight: 20, marginTop: 16 } : { fontSize: 17, lineHeight: 22, marginTop: 4 }}
563
+ >
564
+ {hero.description}
565
+ </Text>
566
+ ) : null}
567
+ </View>
568
+ )
569
+ }
570
+
571
+ /** iOS 26's bottom action of a sheet: 36 from the sides, as BottomActions on a screen. */
572
+ const IOS_ACTION_SIDE = 36
573
+ /** Close and Back in an iOS 26 sheet's bar: 20 from its top and sides. */
574
+ const IOS_BAR_INSET = 20
575
+ const IOS_ACTION_HEIGHT = 52
576
+
577
+ /** The footer's Buttons on iOS: blocks 52 tall, capsules, as BottomActions sets them; other elements stand as given. */
578
+ function iosActions(children: ReactNode) {
579
+ return Children.map(children, (child) => {
580
+ if (!isValidElement(child) || child.type !== Button) return child
581
+ const props = child.props as ButtonProps
582
+ return cloneElement(child as ReactElement<ButtonProps>, {
583
+ block: props.block ?? true,
584
+ size: props.size ?? "3xl",
585
+ style: [{ minHeight: IOS_ACTION_HEIGHT, borderRadius: IOS_ACTION_HEIGHT / 2 }, props.style],
586
+ })
587
+ })
588
+ }
589
+
462
590
  const isFooter = (child: ReactNode) => isValidElement(child) && child.type === BottomSheetFooter
463
591
 
464
592
  /** The item of an Android sheet's bar: a 46dp glass circle solved against the sheet's color. */
@@ -507,7 +635,7 @@ const styles = StyleSheet.create({
507
635
  sheet: { alignSelf: "stretch", overflow: "hidden", borderCurve: "continuous", marginHorizontal: "auto", width: "100%" },
508
636
  scroll: { flexGrow: 0, flexShrink: 1 },
509
637
  grow: { flexGrow: 1 },
510
- iosBar: { flexDirection: "row", alignItems: "center", gap: 8 },
638
+ iosBar: { position: "absolute", top: 0, left: 0, right: 0, zIndex: 1, flexDirection: "row", alignItems: "center", gap: 8 },
511
639
  iosHeading: { flex: 1, alignItems: "center", justifyContent: "center" },
512
640
  scrimTarget: { position: "absolute", top: 0, left: 0, right: 0 },
513
641
  // The bar: 46dp circles 12 under the top edge and 12 from the sides, 11 under them; with no title the top 8 of the
@@ -517,11 +645,11 @@ const styles = StyleSheet.create({
517
645
  androidCircle: { width: 46, height: 46 },
518
646
  androidHeading: { flex: 1, minWidth: 0, alignItems: "center", justifyContent: "center" },
519
647
  androidGrip: { height: 8 },
648
+ hero: { alignItems: "center" },
520
649
  // The content 12 from the sides (as a page's groups), 16 over the navigation bar; under a bar 13 under its circles
521
650
  // (71 from the sheet's top, 2 under the bar)
522
651
  androidContent: { paddingHorizontal: 12, paddingTop: 4, paddingBottom: 16 },
523
- iosFooter: { gap: 10, paddingTop: 12 },
524
- iosFooterEdge: { position: "absolute", top: -15, left: 0, right: 0, bottom: 0 },
652
+ iosFooter: { position: "absolute", left: 0, right: 0, bottom: 0, zIndex: 1, gap: 8, paddingTop: 12 },
525
653
  // Android's sheet actions: 48dp buttons 4 apart, 12 from the sides and above, 12 over the gesture bar, over the
526
654
  // content that scrolls under them
527
655
  androidFooter: { position: "absolute", left: 0, right: 0, bottom: 0, gap: 4, paddingHorizontal: 12, paddingTop: 12 },