@plexui/react-native 0.2.32 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/ActionSheet/ActionSheet.js +1 -1
- package/dist/es/components/BottomSheet/BottomSheet.js +34 -6
- package/dist/es/components/Button/Button.js +21 -4
- package/dist/es/components/Dialog/Dialog.js +13 -3
- package/dist/es/components/List/List.js +15 -1
- package/dist/es/components/Menu/Menu.js +24 -10
- package/dist/es/components/SignInButton/SignInButton.js +85 -0
- package/dist/es/components/Tip/Tip.js +29 -12
- package/dist/es/icons/plex/AppleLogo.js +3 -0
- package/dist/es/icons/plex/GoogleLogo.js +3 -0
- package/dist/es/icons/plex/MicrosoftLogo.js +3 -0
- package/dist/es/icons/plex/index.js +3 -0
- package/dist/es/index.js +1 -0
- package/dist/es/internal/Glass.js +15 -8
- package/dist/types/components/BottomSheet/BottomSheet.d.ts +22 -1
- package/dist/types/components/Button/Button.d.ts +6 -2
- package/dist/types/components/Dialog/Dialog.d.ts +6 -2
- package/dist/types/components/SignInButton/SignInButton.d.ts +37 -0
- package/dist/types/icons/plex/AppleLogo.d.ts +2 -0
- package/dist/types/icons/plex/GoogleLogo.d.ts +2 -0
- package/dist/types/icons/plex/MicrosoftLogo.d.ts +2 -0
- package/dist/types/icons/plex/index.d.ts +3 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/internal/Glass.d.ts +7 -1
- package/package.json +2 -2
- package/src/components/ActionSheet/ActionSheet.tsx +1 -0
- package/src/components/BottomSheet/BottomSheet.tsx +93 -8
- package/src/components/Button/Button.tsx +26 -6
- package/src/components/Dialog/Dialog.tsx +33 -14
- package/src/components/List/List.tsx +13 -1
- package/src/components/Menu/Menu.tsx +24 -10
- package/src/components/SignInButton/SignInButton.tsx +168 -0
- package/src/components/Tip/Tip.tsx +68 -12
- package/src/icons/plex/AppleLogo.ts +4 -0
- package/src/icons/plex/GoogleLogo.ts +4 -0
- package/src/icons/plex/MicrosoftLogo.ts +4 -0
- package/src/icons/plex/index.ts +3 -0
- package/src/index.ts +2 -1
- package/src/internal/Glass.tsx +22 -8
|
@@ -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 ? (
|
|
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
|
-
/**
|
|
27
|
-
|
|
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. */
|
|
@@ -15,8 +15,12 @@ export type DialogAction = {
|
|
|
15
15
|
export type DialogProps = {
|
|
16
16
|
open: boolean;
|
|
17
17
|
onOpenChange: (open: boolean) => void;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The title. Without one the dialog is its message alone: an iOS alert with only a message, a Material 3 dialog
|
|
20
|
+
* with only its supporting text.
|
|
21
|
+
*/
|
|
22
|
+
title?: ReactNode;
|
|
23
|
+
/** The message under the title, or the whole text of a dialog without one. */
|
|
20
24
|
description?: ReactNode;
|
|
21
25
|
/** The actions; two stand side by side on iOS, three or more stack. */
|
|
22
26
|
actions?: DialogAction[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ComponentRef, type Ref } from "react";
|
|
2
|
+
import { View, type PressableProps, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { type ControlSize } from "../Button/Button";
|
|
4
|
+
export type SignInProvider = "apple" | "google";
|
|
5
|
+
export type SignInAction = "sign-in" | "sign-up" | "continue";
|
|
6
|
+
export type SignInButtonProps = Omit<PressableProps, "children" | "style"> & {
|
|
7
|
+
/** Whose sign-in: Apple's (an iOS app's) or Google's (iOS and Android alike). */
|
|
8
|
+
provider: SignInProvider;
|
|
9
|
+
/** The label, one of the brands' own: Sign in with…, Sign up with… or Continue with…. @default "continue" */
|
|
10
|
+
action?: SignInAction;
|
|
11
|
+
/**
|
|
12
|
+
* The brand look against the screen. Apple: black in a light scheme, white in a dark one (never black on dark).
|
|
13
|
+
* Google: light (white with a #747775 outline) or dark (#131314 with a #8E918F outline). Defaults to the theme's.
|
|
14
|
+
*/
|
|
15
|
+
scheme?: "light" | "dark";
|
|
16
|
+
/** Over a photo or a video: Apple's white button. */
|
|
17
|
+
overMedia?: boolean;
|
|
18
|
+
/** Google's neutral button: #F2F2F2 with no outline. */
|
|
19
|
+
neutral?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Height step of the Button scale, so the button matches the screen's other buttons: iOS's large 50 and Android's
|
|
22
|
+
* 48 from `xl`. @default "xl"
|
|
23
|
+
*/
|
|
24
|
+
size?: ControlSize;
|
|
25
|
+
/** Takes the whole width. @default true */
|
|
26
|
+
block?: boolean;
|
|
27
|
+
/** Keeps the brand's colors, dimmed to 40%, and takes no presses. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
style?: StyleProp<ViewStyle>;
|
|
30
|
+
ref?: Ref<ComponentRef<typeof View>>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The sign-in button of a provider, drawn to its brand rules rather than to the theme: Apple's black or white button
|
|
34
|
+
* with the real Apple logo, Google's light, dark or neutral one with the four-color G. It takes the height and the
|
|
35
|
+
* shape of the screen's other buttons (a capsule on iOS, a pill on Android). Disabled keeps the brand's colors at 40%.
|
|
36
|
+
*/
|
|
37
|
+
export declare function SignInButton({ provider, action, scheme, overMedia, neutral, size, block, disabled, style, onPressIn, onPressOut, accessibilityLabel, accessibilityState, ...rest }: SignInButtonProps): import("react").JSX.Element;
|
|
@@ -18,6 +18,7 @@ export { default as AppPermission } from "./AppPermission";
|
|
|
18
18
|
export { default as AppStore } from "./AppStore";
|
|
19
19
|
export { default as AppStoreSquare } from "./AppStoreSquare";
|
|
20
20
|
export { default as Apple } from "./Apple";
|
|
21
|
+
export { default as AppleLogo } from "./AppleLogo";
|
|
21
22
|
export { default as Archive } from "./Archive";
|
|
22
23
|
export { default as Array } from "./Array";
|
|
23
24
|
export { default as ArrowBottomLeftSm } from "./ArrowBottomLeftSm";
|
|
@@ -266,6 +267,7 @@ export { default as GlobeAlt } from "./GlobeAlt";
|
|
|
266
267
|
export { default as GlobeFilled } from "./GlobeFilled";
|
|
267
268
|
export { default as GlobeOff } from "./GlobeOff";
|
|
268
269
|
export { default as GlobeSpin } from "./GlobeSpin";
|
|
270
|
+
export { default as GoogleLogo } from "./GoogleLogo";
|
|
269
271
|
export { default as Grid } from "./Grid";
|
|
270
272
|
export { default as GridAlt } from "./GridAlt";
|
|
271
273
|
export { default as GripHorizontal } from "./GripHorizontal";
|
|
@@ -359,6 +361,7 @@ export { default as Mic } from "./Mic";
|
|
|
359
361
|
export { default as MicFilled } from "./MicFilled";
|
|
360
362
|
export { default as MicFilledOff } from "./MicFilledOff";
|
|
361
363
|
export { default as MicOff } from "./MicOff";
|
|
364
|
+
export { default as MicrosoftLogo } from "./MicrosoftLogo";
|
|
362
365
|
export { default as MinimizeDown } from "./MinimizeDown";
|
|
363
366
|
export { default as MinimizeLeft } from "./MinimizeLeft";
|
|
364
367
|
export { default as MinimizeRight } from "./MinimizeRight";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { Toolbar, type ToolbarBackground, type ToolbarContentProps, type Toolbar
|
|
|
13
13
|
export { TabBar, useTabBarMetrics, useTabBarMinimize, type TabBarBackground, type TabBarBadgeColor, type TabBarItemProps, type TabBarProminent, type TabBarProps, type TabBarSearch, } from "./components/TabBar/TabBar";
|
|
14
14
|
export { SegmentedControl, type SegmentedControlBadgeProp, type SegmentedControlOptionProps, type SegmentedControlProps, } from "./components/SegmentedControl/SegmentedControl";
|
|
15
15
|
export { Switch, type SwitchProps } from "./components/Switch/Switch";
|
|
16
|
+
export { SignInButton, type SignInAction, type SignInButtonProps, type SignInProvider } from "./components/SignInButton/SignInButton";
|
|
16
17
|
export { Checkbox, type CheckboxProps } from "./components/Checkbox/Checkbox";
|
|
17
18
|
export { RadioGroup, type RadioGroupItemProps, type RadioGroupProps } from "./components/RadioGroup/RadioGroup";
|
|
18
19
|
export { Input, InputAdornmentButton, TextField, type InputAdornmentButtonProps, type InputProps, type InputVariant, type TextFieldProps } from "./components/Input/Input";
|
|
@@ -29,7 +30,7 @@ export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from
|
|
|
29
30
|
export { ScrollEdge, type ScrollEdgeProps } from "./components/ScrollEdge/ScrollEdge";
|
|
30
31
|
export { DatePicker, type DatePickerDisplay, type DatePickerMode, type DatePickerProps } from "./components/DatePicker/DatePicker";
|
|
31
32
|
export { ActionSheet, type ActionSheetAction, type ActionSheetProps } from "./components/ActionSheet/ActionSheet";
|
|
32
|
-
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";
|
|
33
34
|
export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog/Dialog";
|
|
34
35
|
export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, type ToastT, type ToastType } from "./components/Toast/Toast";
|
|
35
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
|
+
"version": "0.4.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.
|
|
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 */}
|
|
@@ -10,13 +10,35 @@ import { withAlpha } from "../../theme/material"
|
|
|
10
10
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
11
11
|
import { BarItemContext, type BarItemStyle } from "../Button/Button"
|
|
12
12
|
import { NavigationButton } from "../NavigationButton/NavigationButton"
|
|
13
|
+
import { IconDefaultsProvider } from "../Icon/createIcon"
|
|
13
14
|
import { Text } from "../Text/Text"
|
|
14
15
|
|
|
16
|
+
/** The tones of a hero's symbol. */
|
|
17
|
+
export type BottomSheetHeroTone = "accent" | "secondary" | "success" | "warning" | "danger"
|
|
18
|
+
|
|
19
|
+
export type BottomSheetHero = {
|
|
20
|
+
/** 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. */
|
|
21
|
+
icon?: ReactNode
|
|
22
|
+
/** The sheet's title, large and centered under the symbol. */
|
|
23
|
+
title: ReactNode
|
|
24
|
+
/** A line or two under the title. */
|
|
25
|
+
description?: ReactNode
|
|
26
|
+
/** The symbol's color. @default "accent" */
|
|
27
|
+
tone?: BottomSheetHeroTone
|
|
28
|
+
}
|
|
29
|
+
|
|
15
30
|
export type BottomSheetProps = {
|
|
16
31
|
open: boolean
|
|
17
32
|
onOpenChange: (open: boolean) => void
|
|
18
33
|
/** A title over the content, centered on iOS. */
|
|
19
34
|
title?: ReactNode
|
|
35
|
+
/**
|
|
36
|
+
* 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
|
|
37
|
+
* 56pt symbol over a centered Title 1 bold (28/34) and an optional 17/22 description, the bar keeping only Close; on
|
|
38
|
+
* Android Material's hero icon (24dp, secondary) over a centered headline (24/32) and a 14/20 supporting text, Close
|
|
39
|
+
* in its bar's circle. It names the sheet.
|
|
40
|
+
*/
|
|
41
|
+
hero?: BottomSheetHero
|
|
20
42
|
children?: ReactNode
|
|
21
43
|
/** A tap on the dim, a drag down, Close, Android's back and Escape close it. @default true */
|
|
22
44
|
dismissible?: boolean
|
|
@@ -203,6 +225,8 @@ type SheetExit = {
|
|
|
203
225
|
exit?: number
|
|
204
226
|
/** Called once the sheet has left. */
|
|
205
227
|
onExited?: () => void
|
|
228
|
+
/** Android draws Close without a title (a plain list of choices, ActionSheet, does not). @default true */
|
|
229
|
+
androidClose?: boolean
|
|
206
230
|
}
|
|
207
231
|
|
|
208
232
|
function BottomSheetRoot(props: BottomSheetProps) {
|
|
@@ -213,7 +237,8 @@ function BottomSheetRoot(props: BottomSheetProps) {
|
|
|
213
237
|
export function BottomSheetBase({
|
|
214
238
|
open,
|
|
215
239
|
onOpenChange,
|
|
216
|
-
title,
|
|
240
|
+
title: titleProp,
|
|
241
|
+
hero,
|
|
217
242
|
children,
|
|
218
243
|
dismissible = true,
|
|
219
244
|
"aria-label": ariaLabel,
|
|
@@ -223,8 +248,11 @@ export function BottomSheetBase({
|
|
|
223
248
|
detent = "content",
|
|
224
249
|
exit,
|
|
225
250
|
onExited,
|
|
251
|
+
androidClose = true,
|
|
226
252
|
}: BottomSheetProps & SheetExit) {
|
|
227
253
|
const theme = useTheme()
|
|
254
|
+
// A hero names the sheet from its content: the bar keeps Close alone
|
|
255
|
+
const title = hero ? undefined : titleProp
|
|
228
256
|
const insets = useSafeAreaInsets()
|
|
229
257
|
const { width, height: screen } = useWindowDimensions()
|
|
230
258
|
const [height, setHeight] = useState(0)
|
|
@@ -263,7 +291,7 @@ export function BottomSheetBase({
|
|
|
263
291
|
const web = Platform.OS === "web"
|
|
264
292
|
// The web names the dialog by its title; a phone keeps the modal view
|
|
265
293
|
const a11y = web
|
|
266
|
-
? { role: "dialog" as const, "aria-modal": true, "aria-labelledby": title != null ? titleId : undefined, "aria-label": title != null ? undefined : ariaLabel }
|
|
294
|
+
? { role: "dialog" as const, "aria-modal": true, "aria-labelledby": title != null || hero ? titleId : undefined, "aria-label": title != null || hero ? undefined : ariaLabel }
|
|
267
295
|
: { accessibilityViewIsModal: true, "aria-label": ariaLabel }
|
|
268
296
|
// Android's sheet stands under the status bar at most; the phone layer's 16 under the top inset
|
|
269
297
|
const maxHeight = screen - insets.top - (android ? 0 : 16)
|
|
@@ -285,8 +313,10 @@ export function BottomSheetBase({
|
|
|
285
313
|
// (69 in all). Content scrolled under it shows through the sheet's color at
|
|
286
314
|
// 63% over a light blur, let go over its last 32dp (12 past the bar), with no line
|
|
287
315
|
const barItem = useMemoBarItem(background)
|
|
316
|
+
// Android's bar stands with a title, or with Close alone where the sheet can be closed (as iOS's)
|
|
317
|
+
const androidBar = android && (title != null || (dismissible && androidClose))
|
|
288
318
|
const header = android ? (
|
|
289
|
-
|
|
319
|
+
androidBar ? (
|
|
290
320
|
<View onStartShouldSetResponderCapture={gesture.chrome} onLayout={(event) => setAndroidBarHeight(Math.max(ANDROID_BAR_HEIGHT, event.nativeEvent.layout.height))} style={[styles.androidBar, { paddingHorizontal: androidInline }]}>
|
|
291
321
|
<SheetBarFade fill={background} shown={scrolled} />
|
|
292
322
|
<View style={styles.androidCircle}>
|
|
@@ -297,9 +327,9 @@ export function BottomSheetBase({
|
|
|
297
327
|
) : null}
|
|
298
328
|
</View>
|
|
299
329
|
<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 }}>
|
|
330
|
+
{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
331
|
{title}
|
|
302
|
-
</Text>
|
|
332
|
+
</Text>}
|
|
303
333
|
</View>
|
|
304
334
|
<View style={styles.androidCircle} />
|
|
305
335
|
</View>
|
|
@@ -380,7 +410,7 @@ export function BottomSheetBase({
|
|
|
380
410
|
},
|
|
381
411
|
]}
|
|
382
412
|
>
|
|
383
|
-
{
|
|
413
|
+
{androidBar ? null : header}
|
|
384
414
|
{/* Content taller than the screen scrolls; on iOS the drag stays on the bar, on Android it starts at the
|
|
385
415
|
content's top */}
|
|
386
416
|
<ScrollView
|
|
@@ -404,7 +434,7 @@ export function BottomSheetBase({
|
|
|
404
434
|
// A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
|
|
405
435
|
{ paddingHorizontal: androidInline },
|
|
406
436
|
// 2 under the bar: 71 under a one-line title
|
|
407
|
-
|
|
437
|
+
androidBar ? { paddingTop: androidBarHeight + 2 } : null,
|
|
408
438
|
// Over a footer: 8 above its height, which reaches over the sheet's bottom padding
|
|
409
439
|
footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
|
|
410
440
|
]
|
|
@@ -414,10 +444,11 @@ export function BottomSheetBase({
|
|
|
414
444
|
keyboardShouldPersistTaps="handled"
|
|
415
445
|
bounces={false}
|
|
416
446
|
>
|
|
447
|
+
{hero ? <SheetHero hero={hero} id={titleId} /> : null}
|
|
417
448
|
{content}
|
|
418
449
|
</ScrollView>
|
|
419
450
|
{/* Android's bar stands over the content, which scrolls under it */}
|
|
420
|
-
{
|
|
451
|
+
{androidBar ? header : null}
|
|
421
452
|
{footer ? (
|
|
422
453
|
<View
|
|
423
454
|
onStartShouldSetResponderCapture={android ? gesture.chrome : undefined}
|
|
@@ -459,6 +490,59 @@ export function BottomSheetBase({
|
|
|
459
490
|
)
|
|
460
491
|
}
|
|
461
492
|
|
|
493
|
+
/**
|
|
494
|
+
* 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
|
|
495
|
+
* description), 24 over the content, as Apple's setup sheets. Android: Material's dialog hero, a 24dp icon in the
|
|
496
|
+
* secondary color 16 over a centered headline small (24/32), 16 over a 14/20 onSurfaceVariant text, 24 over the content.
|
|
497
|
+
*/
|
|
498
|
+
function SheetHero({ hero, id }: { hero: BottomSheetHero; id: string }) {
|
|
499
|
+
const theme = useTheme()
|
|
500
|
+
const android = theme.isAndroid
|
|
501
|
+
const m = theme.material
|
|
502
|
+
const tone = hero.tone ?? "accent"
|
|
503
|
+
const ink =
|
|
504
|
+
tone === "accent"
|
|
505
|
+
? android
|
|
506
|
+
? m.secondary
|
|
507
|
+
: theme.colors.accent
|
|
508
|
+
: tone === "secondary"
|
|
509
|
+
? android
|
|
510
|
+
? m.onSurfaceVariant
|
|
511
|
+
: theme.colors.labelSecondary
|
|
512
|
+
: theme.color(`--color-text-${tone}-ghost`, theme.colors.accent)
|
|
513
|
+
const size = android ? 24 : theme.length("--bottom-sheet-hero-icon-size", 56)
|
|
514
|
+
return (
|
|
515
|
+
<View style={[styles.hero, { paddingBottom: 24 }]}>
|
|
516
|
+
{hero.icon != null ? (
|
|
517
|
+
<View style={{ marginBottom: android ? 16 : 12 }} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
518
|
+
<IconDefaultsProvider size={size} color={ink}>
|
|
519
|
+
{hero.icon}
|
|
520
|
+
</IconDefaultsProvider>
|
|
521
|
+
</View>
|
|
522
|
+
) : null}
|
|
523
|
+
<Text
|
|
524
|
+
nativeID={id}
|
|
525
|
+
accessibilityRole="header"
|
|
526
|
+
align="center"
|
|
527
|
+
weight={android ? "regular" : "bold"}
|
|
528
|
+
color={android ? m.onSurface : undefined}
|
|
529
|
+
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) }}
|
|
530
|
+
>
|
|
531
|
+
{hero.title}
|
|
532
|
+
</Text>
|
|
533
|
+
{hero.description != null ? (
|
|
534
|
+
<Text
|
|
535
|
+
align="center"
|
|
536
|
+
color={android ? m.onSurfaceVariant : theme.colors.labelSecondary}
|
|
537
|
+
style={android ? { fontSize: 14, lineHeight: 20, marginTop: 16 } : { fontSize: 17, lineHeight: 22, marginTop: 4 }}
|
|
538
|
+
>
|
|
539
|
+
{hero.description}
|
|
540
|
+
</Text>
|
|
541
|
+
) : null}
|
|
542
|
+
</View>
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
|
|
462
546
|
const isFooter = (child: ReactNode) => isValidElement(child) && child.type === BottomSheetFooter
|
|
463
547
|
|
|
464
548
|
/** The item of an Android sheet's bar: a 46dp glass circle solved against the sheet's color. */
|
|
@@ -517,6 +601,7 @@ const styles = StyleSheet.create({
|
|
|
517
601
|
androidCircle: { width: 46, height: 46 },
|
|
518
602
|
androidHeading: { flex: 1, minWidth: 0, alignItems: "center", justifyContent: "center" },
|
|
519
603
|
androidGrip: { height: 8 },
|
|
604
|
+
hero: { alignItems: "center" },
|
|
520
605
|
// The content 12 from the sides (as a page's groups), 16 over the navigation bar; under a bar 13 under its circles
|
|
521
606
|
// (71 from the sheet's top, 2 under the bar)
|
|
522
607
|
androidContent: { paddingHorizontal: 12, paddingTop: 4, paddingBottom: 16 },
|
|
@@ -36,8 +36,12 @@ export type ButtonProps = Omit<PressableProps, "children" | "style"> & {
|
|
|
36
36
|
pill?: boolean
|
|
37
37
|
/** The shape on Android: a pill (default), as newer Android screens draw a button, or 8dp corners. */
|
|
38
38
|
shape?: "round" | "square"
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* 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
|
|
41
|
+
* light frost and a #f5f5f5 label, in both themes). Android has no glass: a clear button there is a translucent
|
|
42
|
+
* gray with the same label.
|
|
43
|
+
*/
|
|
44
|
+
mobileMaterial?: "glass" | "flat" | "clear"
|
|
41
45
|
/** A button as wide and tall: an icon alone. */
|
|
42
46
|
uniform?: boolean
|
|
43
47
|
/** Takes the whole width. */
|
|
@@ -591,22 +595,38 @@ function ButtonBody({
|
|
|
591
595
|
// its buttons on glass and its plain ones; the token alone gives the Regular of the plain button
|
|
592
596
|
weight: theme.isIOS && variant !== "ghost" ? "medium" : base.weight,
|
|
593
597
|
}
|
|
594
|
-
const
|
|
598
|
+
const barred = barColors(theme, buttonColors(theme, color, variant, disabled, selected), { bar, prominent: accentAction, neutral, disabled, selected, flat: mobileMaterial === "flat" })
|
|
599
|
+
// Clear glass over a photo, a video or a color: the kit's #f5f5f5 label in both themes, on iOS clear glass and on
|
|
600
|
+
// Android (no glass) its gray at 17%, a little more when pressed
|
|
601
|
+
const clear = mobileMaterial === "clear" && neutral && !bar
|
|
602
|
+
const clearLabel = clear ? theme.color("--mobile-glass-clear-label", "#f5f5f5") : ""
|
|
603
|
+
const colors: typeof barred = clear
|
|
604
|
+
? {
|
|
605
|
+
...barred,
|
|
606
|
+
text: disabled ? withAlpha(clearLabel, 0.4) : clearLabel,
|
|
607
|
+
pressedText: undefined,
|
|
608
|
+
background: theme.color("--mobile-glass-clear-background", "rgba(153, 153, 153, 0.17)"),
|
|
609
|
+
pressed: theme.color("--mobile-glass-clear-background-active", "rgba(153, 153, 153, 0.28)"),
|
|
610
|
+
border: undefined,
|
|
611
|
+
}
|
|
612
|
+
: barred
|
|
595
613
|
// In a bar every neutral soft or ghost button is glass, as on iOS 26, unless it asks to stay flat or is selected.
|
|
596
614
|
// A disabled glass button keeps its glass, as the phone CSS's
|
|
597
615
|
const wantsGlass = bar ? mobileMaterial !== "flat" && neutral && !selected && !bar.inGroup : mobileMaterial === "glass" && neutral
|
|
598
|
-
const glass = theme.isIOS && wantsGlass
|
|
616
|
+
const glass = theme.isIOS && (wantsGlass || clear)
|
|
599
617
|
// On Android the same button stands on a glass of its own, as the Android bar circles: a see-through card with a
|
|
600
618
|
// rim and a soft shadow (the glass of a plain bar)
|
|
601
619
|
const card = theme.isAndroid && !!bar && !bar.plain && (wantsGlass || (accentAction && disabled && !bar.inGroup))
|
|
602
620
|
const androidGlass = useAndroidGlass("bar", bar?.canvas)
|
|
603
621
|
if (glass && !bar) {
|
|
604
|
-
// The Liquid Glass text button of the iOS 27 kit: Medium (`--button-glass-font-weight`), 17/22 at md and lg
|
|
622
|
+
// The Liquid Glass text button of the iOS 27 kit: Medium (`--button-glass-font-weight`), 17/22 at md and lg, 12 a side
|
|
605
623
|
const glassWeight = theme.length("--button-glass-font-weight", 510)
|
|
606
624
|
metrics.weight = glassWeight >= 590 ? "semibold" : glassWeight >= 500 ? "medium" : "regular"
|
|
607
625
|
if (size === "md" || size === "lg") {
|
|
608
626
|
metrics.fontSize = theme.length("--button-glass-font-size", metrics.fontSize)
|
|
609
627
|
metrics.lineHeight = theme.length("--button-glass-line-height", metrics.lineHeight)
|
|
628
|
+
// 12 each side, where a bordered medium button's Subheadline label takes 14
|
|
629
|
+
if (!gutterSize) metrics.gutter = theme.length("--button-glass-gutter", metrics.gutter)
|
|
610
630
|
}
|
|
611
631
|
}
|
|
612
632
|
const nativeRipple = useMaterialPress(theme)
|
|
@@ -771,7 +791,7 @@ function ButtonBody({
|
|
|
771
791
|
if (glass) {
|
|
772
792
|
return (
|
|
773
793
|
<Pressable {...pressable} style={[{ alignSelf: block ? "stretch" : "flex-start" }, style]}>
|
|
774
|
-
<Glass interactive={!inert} elevation={bar?.raised ? "raised" : "regular"} radius={metrics.radius} fillToken={pressed && !inert ? "--mobile-glass-background-active" : undefined} style={[body, { borderRadius: metrics.radius }]}>
|
|
794
|
+
<Glass interactive={!inert} clear={clear} elevation={bar?.raised ? "raised" : "regular"} radius={metrics.radius} fillToken={pressed && !inert ? (clear ? "--mobile-glass-clear-background-active" : "--mobile-glass-background-active") : undefined} style={[body, { borderRadius: metrics.radius }]}>
|
|
775
795
|
{content}
|
|
776
796
|
</Glass>
|
|
777
797
|
</Pressable>
|
|
@@ -28,8 +28,12 @@ export type DialogAction = {
|
|
|
28
28
|
export type DialogProps = {
|
|
29
29
|
open: boolean
|
|
30
30
|
onOpenChange: (open: boolean) => void
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The title. Without one the dialog is its message alone: an iOS alert with only a message, a Material 3 dialog
|
|
33
|
+
* with only its supporting text.
|
|
34
|
+
*/
|
|
35
|
+
title?: ReactNode
|
|
36
|
+
/** The message under the title, or the whole text of a dialog without one. */
|
|
33
37
|
description?: ReactNode
|
|
34
38
|
/** The actions; two stand side by side on iOS, three or more stack. */
|
|
35
39
|
actions?: DialogAction[]
|
|
@@ -89,7 +93,13 @@ function DialogView({ open, onOpenChange, title, description, actions = [], chil
|
|
|
89
93
|
// The web names the alert dialog by its title and describes it by its message; a phone keeps the modal view
|
|
90
94
|
const a11y =
|
|
91
95
|
Platform.OS === "web"
|
|
92
|
-
? {
|
|
96
|
+
? {
|
|
97
|
+
role: "alertdialog" as const,
|
|
98
|
+
"aria-modal": true,
|
|
99
|
+
// A dialog without a title is named by its message
|
|
100
|
+
"aria-labelledby": title != null ? ids.title : description != null ? ids.description : undefined,
|
|
101
|
+
"aria-describedby": title != null && description != null ? ids.description : undefined,
|
|
102
|
+
}
|
|
93
103
|
: { accessibilityRole: "alert" as const, accessibilityViewIsModal: true }
|
|
94
104
|
if (theme.isAndroid) {
|
|
95
105
|
return (
|
|
@@ -304,7 +314,7 @@ export function PickerDialog({ open, onClose, onOk, cancelLabel, okLabel, label,
|
|
|
304
314
|
|
|
305
315
|
type PanelProps = {
|
|
306
316
|
theme: Theme
|
|
307
|
-
title
|
|
317
|
+
title?: ReactNode
|
|
308
318
|
description?: ReactNode
|
|
309
319
|
actions: DialogAction[]
|
|
310
320
|
run: (action: DialogAction) => void
|
|
@@ -313,8 +323,7 @@ type PanelProps = {
|
|
|
313
323
|
children?: ReactNode
|
|
314
324
|
}
|
|
315
325
|
|
|
316
|
-
type AndroidPanelProps =
|
|
317
|
-
title?: ReactNode
|
|
326
|
+
type AndroidPanelProps = PanelProps & {
|
|
318
327
|
/** Rows across the panel's width under the title, in place of the text (an Android dialog with a list of rows). */
|
|
319
328
|
list?: ReactNode
|
|
320
329
|
/** The buttons in a row or stacked; by default in a row while they fit. */
|
|
@@ -371,11 +380,18 @@ function IOSAlert({ theme, title, description, actions, run, ids, layout, childr
|
|
|
371
380
|
<ScrollView style={styles.scroll} contentContainerStyle={{ gap: 10 }} bounces={false}>
|
|
372
381
|
{/* The text 31 from the sides: 16 of padding and 15 of the header's own */}
|
|
373
382
|
<View style={{ paddingTop: 5, paddingHorizontal: 15, paddingBottom: 5.5, gap: 5.67 }}>
|
|
374
|
-
|
|
375
|
-
{title}
|
|
376
|
-
|
|
383
|
+
{title != null ? (
|
|
384
|
+
<Text nativeID={ids.title} weight="semibold" style={[type, { textAlign: description == null ? "center" : "auto" }]} accessibilityRole="header">
|
|
385
|
+
{title}
|
|
386
|
+
</Text>
|
|
387
|
+
) : null}
|
|
377
388
|
{description != null ? (
|
|
378
|
-
|
|
389
|
+
// Without a title the message is the alert's whole text, in the label color (UIAlertController with a nil title)
|
|
390
|
+
<Text
|
|
391
|
+
nativeID={ids.description}
|
|
392
|
+
color={title != null ? theme.color("--dialog-alert-message-color") : undefined}
|
|
393
|
+
style={{ fontSize: 15, lineHeight: 20 }}
|
|
394
|
+
>
|
|
379
395
|
{description}
|
|
380
396
|
</Text>
|
|
381
397
|
) : null}
|
|
@@ -501,11 +517,14 @@ function AndroidDialog({ theme, title, description, actions, run, ids, children,
|
|
|
501
517
|
</>
|
|
502
518
|
) : (
|
|
503
519
|
<ScrollView style={styles.scroll} contentContainerStyle={styles.androidText} bounces={false}>
|
|
504
|
-
|
|
505
|
-
{title}
|
|
506
|
-
|
|
520
|
+
{title != null ? (
|
|
521
|
+
<Text nativeID={ids.title} color={m.onSurface} accessibilityRole="header" style={[styles.androidTitle, theme.font("medium")]}>
|
|
522
|
+
{title}
|
|
523
|
+
</Text>
|
|
524
|
+
) : null}
|
|
507
525
|
{description != null ? (
|
|
508
|
-
|
|
526
|
+
// Material 3's dialog with no headline: the supporting text alone, in onSurfaceVariant
|
|
527
|
+
<Text nativeID={ids.description} color={title != null ? m.onSurface : m.onSurfaceVariant} style={styles.androidMessage}>
|
|
509
528
|
{description}
|
|
510
529
|
</Text>
|
|
511
530
|
) : null}
|