@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
|
@@ -928,6 +928,9 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
|
|
|
928
928
|
// A picture wider than the tile (a photo, an avatar) keeps its own size: it starts at the row's inset, where the
|
|
929
929
|
// header and the footer stand, and the text follows 14 past it, as UIKit's image to text padding
|
|
930
930
|
const [wide, setWide] = useState(false)
|
|
931
|
+
// A picture taller than the tile (a 40 photo) keeps the cell's margins over and under it, 10 as UIKit's content
|
|
932
|
+
// configuration keeps them: a 40 photo makes a 60 row
|
|
933
|
+
const [tall, setTall] = useState(false)
|
|
931
934
|
// In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
|
|
932
935
|
// A switch, a checkbox and a radio stay at the row's edge
|
|
933
936
|
const columns = useContext(ListOptionsContext)?.columns === true && trailing != null
|
|
@@ -950,11 +953,14 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
|
|
|
950
953
|
style={[
|
|
951
954
|
styles.tile,
|
|
952
955
|
{ minWidth: tile, minHeight: tile, marginStart: wide ? 0 : theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
|
|
956
|
+
tall ? { marginVertical: theme.length("--field-row-picture-margin-block", 10) } : null,
|
|
953
957
|
leadingColor ? { backgroundColor: leadingColor, borderRadius: theme.length("--field-row-icon-radius", 7) } : null,
|
|
954
958
|
]}
|
|
955
959
|
onLayout={(event) => {
|
|
956
960
|
const next = event.nativeEvent.layout.width > tile + 0.5
|
|
957
961
|
if (next !== wide) setWide(next)
|
|
962
|
+
const taller = event.nativeEvent.layout.height > tile + 0.5
|
|
963
|
+
if (taller !== tall) setTall(taller)
|
|
958
964
|
}}
|
|
959
965
|
>
|
|
960
966
|
<IconDefaultsProvider size={leadingColor ? 20 : theme.length("--field-row-icon-symbol-size", 24)} color={leadingColor ? "#ffffff" : disabled ? theme.colors.labelTertiary : theme.colors.accent}>
|
|
@@ -1070,6 +1076,9 @@ function AndroidContent({
|
|
|
1070
1076
|
// A picture wider than the symbol's 24 (a photo, an avatar) keeps its own size from the rows' inset (21, where the
|
|
1071
1077
|
// header and the footer stand), the text 16 past it, as Material's list item with a leading avatar; 0 for a symbol
|
|
1072
1078
|
const [wide, setWide] = useState(0)
|
|
1079
|
+
// A picture taller than the symbol's 24 (a 40 avatar) keeps 8 over and under it, Material's list item with a leading
|
|
1080
|
+
// avatar: a 40 photo makes a 56 row
|
|
1081
|
+
const [tall, setTall] = useState(false)
|
|
1073
1082
|
// The text (and the divider) 21 in, or 64 after a symbol, a tile or a choice's mark (its 20dp circle 22 in)
|
|
1074
1083
|
const textStart = leading == null ? ANDROID_INSET : wide > 0 && !tile && !leadingMark ? ANDROID_INSET + wide + 16 : 64
|
|
1075
1084
|
// A value that ends the row stands 17 from the end (a value row), 20 in a row with a tile (a tiled row)
|
|
@@ -1090,7 +1099,7 @@ function AndroidContent({
|
|
|
1090
1099
|
<View style={styles.androidMark}>{leading}</View>
|
|
1091
1100
|
) : (
|
|
1092
1101
|
<View
|
|
1093
|
-
style={tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null]}
|
|
1102
|
+
style={tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : [styles.androidIcon, wide > 0 ? styles.androidWide : null, tall ? styles.androidTall : null]}
|
|
1094
1103
|
onLayout={
|
|
1095
1104
|
tile
|
|
1096
1105
|
? undefined
|
|
@@ -1098,6 +1107,8 @@ function AndroidContent({
|
|
|
1098
1107
|
const width = event.nativeEvent.layout.width
|
|
1099
1108
|
const next = width > 24.5 ? width : 0
|
|
1100
1109
|
if (Math.abs(next - wide) > 0.5) setWide(next)
|
|
1110
|
+
const taller = event.nativeEvent.layout.height > 24.5
|
|
1111
|
+
if (taller !== tall) setTall(taller)
|
|
1101
1112
|
}
|
|
1102
1113
|
}
|
|
1103
1114
|
>
|
|
@@ -1198,6 +1209,7 @@ const styles = StyleSheet.create({
|
|
|
1198
1209
|
androidFooterPlain: { paddingHorizontal: ANDROID_INSET },
|
|
1199
1210
|
androidRow: { flexDirection: "row", alignItems: "center", minHeight: 50, paddingStart: ANDROID_INSET, paddingEnd: ANDROID_INSET },
|
|
1200
1211
|
// A 24dp symbol at 20, a 28dp tile at 18 with a 24dp symbol, or a choice's 20dp mark at 22: the text at 64
|
|
1212
|
+
androidTall: { marginVertical: 8 },
|
|
1201
1213
|
androidIcon: { minWidth: 24, minHeight: 24, alignItems: "center", justifyContent: "center", marginStart: -1, marginEnd: 20 },
|
|
1202
1214
|
androidWide: { marginStart: 0, marginEnd: 16 },
|
|
1203
1215
|
androidMark: { width: 20, alignItems: "center", justifyContent: "center", marginStart: 1, marginEnd: 22 },
|
|
@@ -286,26 +286,38 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
|
|
|
286
286
|
const fitsBelow = below + height <= window.height - bottomEdge
|
|
287
287
|
const above = over ? box.y + box.height - height : box.y - gap - height
|
|
288
288
|
let top = size == null ? -window.height - 1000 : fitsBelow ? below : Math.max(topEdge, above)
|
|
289
|
-
|
|
289
|
+
// A preview wider than the screen less 16 a side is scaled down about its middle to fit, as iOS 27.2 shrinks a
|
|
290
|
+
// lifted cell or card, and one that would cross the 16 is moved in: `seen` is where it shows
|
|
291
|
+
const fit = 16
|
|
292
|
+
const fitScale = context && box.width > window.width - fit * 2 ? (window.width - fit * 2) / box.width : 1
|
|
293
|
+
const seenWidth = box.width * fitScale
|
|
294
|
+
const seenHeight = box.height * fitScale
|
|
295
|
+
const seen = {
|
|
296
|
+
x: context && box.width > 0 ? Math.max(fit, Math.min(box.x + (box.width - seenWidth) / 2, window.width - fit - seenWidth)) : box.x,
|
|
297
|
+
y: box.y + (box.height - seenHeight) / 2,
|
|
298
|
+
width: seenWidth,
|
|
299
|
+
height: seenHeight,
|
|
300
|
+
}
|
|
301
|
+
let previewTop = seen.y
|
|
290
302
|
if (context) {
|
|
291
303
|
// iOS 27.2 places a context menu by where the element stands (ref-app menus-context): in the left third at its
|
|
292
304
|
// left edge, in the right third at its right edge, else at its centre; 16 under it, or over it when the element
|
|
293
305
|
// is in the lower half and the menu fits there (the web's ContextMenu, contextMenuPreview)
|
|
294
|
-
const centre =
|
|
295
|
-
left = centre < window.width / 3 ?
|
|
306
|
+
const centre = seen.x + seen.width / 2
|
|
307
|
+
left = centre < window.width / 3 ? seen.x : centre > (window.width * 2) / 3 ? seen.x + seen.width - measured : centre - measured / 2
|
|
296
308
|
left = Math.max(margin, Math.min(left, window.width - measured - margin))
|
|
297
309
|
const lift = 16
|
|
298
|
-
const overIt =
|
|
299
|
-
const underIt =
|
|
300
|
-
const lower =
|
|
310
|
+
const overIt = seen.y - lift - height
|
|
311
|
+
const underIt = seen.y + seen.height + lift
|
|
312
|
+
const lower = seen.y + seen.height / 2 > window.height / 2
|
|
301
313
|
if (size != null) {
|
|
302
314
|
if (lower && overIt >= topEdge) top = overIt
|
|
303
315
|
else {
|
|
304
316
|
// Where the menu does not fit under the element it lifts the element up with it, as iOS moves the preview, so
|
|
305
317
|
// the menu never covers it
|
|
306
318
|
const overflow = underIt + height - (window.height - bottomEdge)
|
|
307
|
-
previewTop = overflow > 0 ? Math.max(topEdge,
|
|
308
|
-
top = Math.max(topEdge, Math.min(previewTop +
|
|
319
|
+
previewTop = overflow > 0 ? Math.max(topEdge, seen.y - overflow) : seen.y
|
|
320
|
+
top = Math.max(topEdge, Math.min(previewTop + seen.height + lift, window.height - bottomEdge - height))
|
|
309
321
|
}
|
|
310
322
|
}
|
|
311
323
|
}
|
|
@@ -404,11 +416,13 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
|
|
|
404
416
|
pointerEvents="none"
|
|
405
417
|
style={[
|
|
406
418
|
styles.preview,
|
|
407
|
-
|
|
419
|
+
// Drawn at its own size and scaled about its middle onto where it is seen
|
|
420
|
+
swap ? { right: seen.x + (seen.width - box.width) / 2 } : { left: seen.x + (seen.width - box.width) / 2 },
|
|
408
421
|
{
|
|
409
|
-
top: previewTop,
|
|
422
|
+
top: previewTop + (seen.height - box.height) / 2,
|
|
410
423
|
width: box.width,
|
|
411
424
|
height: box.height,
|
|
425
|
+
transform: fitScale < 1 ? [{ scale: fitScale }] : undefined,
|
|
412
426
|
borderRadius: context.radius,
|
|
413
427
|
backgroundColor: theme.colors.groupedSurface,
|
|
414
428
|
boxShadow: String(theme.token("--context-menu-preview-shadow") ?? "0 0 32px rgba(0, 0, 0, 0.2)"),
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { useState, type ComponentRef, type Ref } from "react"
|
|
2
|
+
import { Platform, StyleSheet, Text, View, type PressableProps, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
4
|
+
import { useRipple } from "../../internal/ripple"
|
|
5
|
+
import { withAlpha } from "../../theme/material"
|
|
6
|
+
import { useTheme } from "../../theme/ThemeProvider"
|
|
7
|
+
import AppleLogo from "../../icons/plex/AppleLogo"
|
|
8
|
+
import GoogleLogo from "../../icons/plex/GoogleLogo"
|
|
9
|
+
import { buttonMetrics, useMaterialPress, type ControlSize } from "../Button/Button"
|
|
10
|
+
|
|
11
|
+
export type SignInProvider = "apple" | "google"
|
|
12
|
+
export type SignInAction = "sign-in" | "sign-up" | "continue"
|
|
13
|
+
|
|
14
|
+
export type SignInButtonProps = Omit<PressableProps, "children" | "style"> & {
|
|
15
|
+
/** Whose sign-in: Apple's (an iOS app's) or Google's (iOS and Android alike). */
|
|
16
|
+
provider: SignInProvider
|
|
17
|
+
/** The label, one of the brands' own: Sign in with…, Sign up with… or Continue with…. @default "continue" */
|
|
18
|
+
action?: SignInAction
|
|
19
|
+
/**
|
|
20
|
+
* The brand look against the screen. Apple: black in a light scheme, white in a dark one (never black on dark).
|
|
21
|
+
* Google: light (white with a #747775 outline) or dark (#131314 with a #8E918F outline). Defaults to the theme's.
|
|
22
|
+
*/
|
|
23
|
+
scheme?: "light" | "dark"
|
|
24
|
+
/** Over a photo or a video: Apple's white button. */
|
|
25
|
+
overMedia?: boolean
|
|
26
|
+
/** Google's neutral button: #F2F2F2 with no outline. */
|
|
27
|
+
neutral?: boolean
|
|
28
|
+
/**
|
|
29
|
+
* Height step of the Button scale, so the button matches the screen's other buttons: iOS's large 50 and Android's
|
|
30
|
+
* 48 from `xl`. @default "xl"
|
|
31
|
+
*/
|
|
32
|
+
size?: ControlSize
|
|
33
|
+
/** Takes the whole width. @default true */
|
|
34
|
+
block?: boolean
|
|
35
|
+
/** Keeps the brand's colors, dimmed to 40%, and takes no presses. */
|
|
36
|
+
disabled?: boolean
|
|
37
|
+
style?: StyleProp<ViewStyle>
|
|
38
|
+
ref?: Ref<ComponentRef<typeof View>>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const LABEL: Record<SignInAction, string> = { "sign-in": "Sign in with", "sign-up": "Sign up with", continue: "Continue with" }
|
|
42
|
+
|
|
43
|
+
type Look = { background: string; text: string; border?: string }
|
|
44
|
+
|
|
45
|
+
/** Apple HIG, Sign in with Apple: black with white content, or white with black content on dark or over media. */
|
|
46
|
+
function appleLook(white: boolean): Look {
|
|
47
|
+
return white ? { background: "#FFFFFF", text: "#000000" } : { background: "#000000", text: "#FFFFFF" }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Google Sign-In branding guidelines: the light, dark and neutral buttons. */
|
|
51
|
+
function googleLook(dark: boolean, neutral: boolean): Look {
|
|
52
|
+
if (neutral) return { background: "#F2F2F2", text: "#1F1F1F" }
|
|
53
|
+
return dark ? { background: "#131314", text: "#E3E3E3", border: "#8E918F" } : { background: "#FFFFFF", text: "#1F1F1F", border: "#747775" }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// The logos' drawn ink inside their 24-unit boxes: the G spans 2.95–21.05, so at 24px it stands 2.95px in from each
|
|
57
|
+
// side; Apple's mark spans 3.36–20.64 of its width
|
|
58
|
+
const GOOGLE_ICON = 24
|
|
59
|
+
const GOOGLE_INSET = 2.95
|
|
60
|
+
const APPLE_ICON = 20
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The sign-in button of a provider, drawn to its brand rules rather than to the theme: Apple's black or white button
|
|
64
|
+
* with the real Apple logo, Google's light, dark or neutral one with the four-color G. It takes the height and the
|
|
65
|
+
* shape of the screen's other buttons (a capsule on iOS, a pill on Android). Disabled keeps the brand's colors at 40%.
|
|
66
|
+
*/
|
|
67
|
+
export function SignInButton({
|
|
68
|
+
provider,
|
|
69
|
+
action = "continue",
|
|
70
|
+
scheme,
|
|
71
|
+
overMedia = false,
|
|
72
|
+
neutral = false,
|
|
73
|
+
size = "xl",
|
|
74
|
+
block = true,
|
|
75
|
+
disabled = false,
|
|
76
|
+
style,
|
|
77
|
+
onPressIn,
|
|
78
|
+
onPressOut,
|
|
79
|
+
accessibilityLabel,
|
|
80
|
+
accessibilityState,
|
|
81
|
+
...rest
|
|
82
|
+
}: SignInButtonProps) {
|
|
83
|
+
const theme = useTheme()
|
|
84
|
+
const dark = (scheme ?? theme.scheme) === "dark"
|
|
85
|
+
const apple = provider === "apple"
|
|
86
|
+
const look = apple ? appleLook(dark || overMedia) : googleLook(dark, neutral)
|
|
87
|
+
const metrics = buttonMetrics(theme, size)
|
|
88
|
+
const label = `${LABEL[action]} ${apple ? "Apple" : "Google"}`
|
|
89
|
+
const [pressed, setPressed] = useState(false)
|
|
90
|
+
const android = theme.isAndroid
|
|
91
|
+
const nativeRipple = useMaterialPress(theme)
|
|
92
|
+
const ripple = useRipple(withAlpha(look.text, 0.1), android && !nativeRipple, theme.reducedMotion)
|
|
93
|
+
// Google's spacing: 16 before the G, 12 to the text and 16 after on iOS; 12, 10 and 12 on Android
|
|
94
|
+
const google = android ? { start: 12, gap: 10, end: 12 } : { start: 16, gap: 12, end: 16 }
|
|
95
|
+
const radius = metrics.height / 2
|
|
96
|
+
// A compact size keeps the platform's 44pt or 48dp target, as Button does
|
|
97
|
+
const reach = Math.max(0, ((android ? 48 : 44) - metrics.height) / 2)
|
|
98
|
+
const padding = apple
|
|
99
|
+
? // Apple asks for a margin of at least a tenth of the height around the logo and the title
|
|
100
|
+
{ paddingHorizontal: Math.max(metrics.height / 10, 16) }
|
|
101
|
+
: { paddingLeft: google.start - GOOGLE_INSET, paddingRight: google.end }
|
|
102
|
+
return (
|
|
103
|
+
<Pressable
|
|
104
|
+
accessibilityRole="button"
|
|
105
|
+
accessibilityLabel={accessibilityLabel ?? label}
|
|
106
|
+
accessibilityState={{ ...accessibilityState, disabled }}
|
|
107
|
+
disabled={disabled}
|
|
108
|
+
hitSlop={reach ? { top: reach, bottom: reach } : undefined}
|
|
109
|
+
android_ripple={nativeRipple ? { color: withAlpha(look.text, 0.1), foreground: true } : undefined}
|
|
110
|
+
onPressIn={(event) => {
|
|
111
|
+
setPressed(true)
|
|
112
|
+
ripple.start(event)
|
|
113
|
+
onPressIn?.(event)
|
|
114
|
+
}}
|
|
115
|
+
onPressOut={(event) => {
|
|
116
|
+
setPressed(false)
|
|
117
|
+
ripple.end()
|
|
118
|
+
onPressOut?.(event)
|
|
119
|
+
}}
|
|
120
|
+
style={[
|
|
121
|
+
styles.button,
|
|
122
|
+
{
|
|
123
|
+
// At least the size's height: a larger text size grows the button instead of clipping its title
|
|
124
|
+
minHeight: metrics.height,
|
|
125
|
+
paddingVertical: 4,
|
|
126
|
+
minWidth: 140,
|
|
127
|
+
borderRadius: radius,
|
|
128
|
+
backgroundColor: look.background,
|
|
129
|
+
alignSelf: block ? "stretch" : "center",
|
|
130
|
+
opacity: disabled ? 0.4 : 1,
|
|
131
|
+
},
|
|
132
|
+
padding,
|
|
133
|
+
style,
|
|
134
|
+
]}
|
|
135
|
+
{...rest}
|
|
136
|
+
>
|
|
137
|
+
{ripple.layer}
|
|
138
|
+
{/* iOS's press: a layer of the content's color, as a filled button darkens or lightens */}
|
|
139
|
+
{pressed && !android && <View pointerEvents="none" style={[StyleSheet.absoluteFill, { borderRadius: radius, backgroundColor: withAlpha(look.text, 0.12) }]} />}
|
|
140
|
+
{/* Google's outline is 1px inside the button */}
|
|
141
|
+
{look.border && <View pointerEvents="none" style={[StyleSheet.absoluteFill, { borderRadius: radius, borderWidth: 1, borderColor: look.border }]} />}
|
|
142
|
+
<View style={[styles.content, { gap: apple ? 6 : google.gap - GOOGLE_INSET }]} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
143
|
+
{apple ? <AppleLogo size={APPLE_ICON} color={look.text} /> : <GoogleLogo size={GOOGLE_ICON} />}
|
|
144
|
+
<Text
|
|
145
|
+
numberOfLines={1}
|
|
146
|
+
allowFontScaling
|
|
147
|
+
style={
|
|
148
|
+
apple
|
|
149
|
+
? // The system font, as Apple's button sets its title
|
|
150
|
+
{ color: look.text, fontSize: metrics.fontSize, lineHeight: metrics.lineHeight, fontWeight: "500" }
|
|
151
|
+
: // Google Sans Medium 14/20 where the app has it, else the system font
|
|
152
|
+
{ color: look.text, fontSize: 14, lineHeight: 20, fontWeight: "500", fontFamily: GOOGLE_FONT }
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
{label}
|
|
156
|
+
</Text>
|
|
157
|
+
</View>
|
|
158
|
+
</Pressable>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** The font the Google button asks for: an app that bundles Google Sans gets it; elsewhere the system font stands in. */
|
|
163
|
+
const GOOGLE_FONT = Platform.select({ web: "'Google Sans', system-ui, sans-serif", default: undefined })
|
|
164
|
+
|
|
165
|
+
const styles = StyleSheet.create({
|
|
166
|
+
button: { flexDirection: "row", alignItems: "center", justifyContent: "center", overflow: "hidden" },
|
|
167
|
+
content: { flexDirection: "row", alignItems: "center", justifyContent: "center", flexShrink: 1 },
|
|
168
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneElement, isValidElement, useState, type ReactElement, type ReactNode } from "react"
|
|
2
|
-
import { StyleSheet, View, useWindowDimensions, type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native"
|
|
2
|
+
import { ActivityIndicator, StyleSheet, View, useWindowDimensions, type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native"
|
|
3
3
|
import { Pressable } from "../../internal/Pressable"
|
|
4
4
|
import Svg, { Path } from "react-native-svg"
|
|
5
5
|
import X from "../../icons/plex/X"
|
|
@@ -7,7 +7,7 @@ import { flattenChildren, isRenderable, textOf } from "../../internal/children"
|
|
|
7
7
|
import { FloatingPanel } from "../../internal/FloatingPanel"
|
|
8
8
|
import { anchorProps, type FloatingAlign, type FloatingSide } from "../../internal/floating"
|
|
9
9
|
import { Glass } from "../../internal/Glass"
|
|
10
|
-
import { accentText, barSurface, controlHighlight, dangerText, elevationShadow } from "../../theme/material"
|
|
10
|
+
import { accentText, barSurface, controlHighlight, dangerText, elevationShadow, withAlpha } from "../../theme/material"
|
|
11
11
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
12
12
|
import type { Theme } from "../../theme/types"
|
|
13
13
|
import { Button, type ButtonColor, type ButtonProps } from "../Button/Button"
|
|
@@ -116,6 +116,9 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
|
|
|
116
116
|
const closable = onClose != null
|
|
117
117
|
const descriptionColor = android ? theme.colors.textSecondary : theme.color("--tip-description-color", theme.colors.textSecondary)
|
|
118
118
|
const paddingBottom = !hasActions ? m.bottomNone : buttons ? m.bottomButtons : m.bottomRows
|
|
119
|
+
// iOS's tip with button actions is TipKit's mini tip (its kit's Hint View): 22 over the title, 4 between the title
|
|
120
|
+
// and the message, 22 from the words to the action and 16 under it
|
|
121
|
+
const miniTip = !android && hasActions && buttons
|
|
119
122
|
const textStart = hasIcon ? m.iconFrame + m.iconGap : 0
|
|
120
123
|
return (
|
|
121
124
|
<View
|
|
@@ -126,11 +129,11 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
|
|
|
126
129
|
styles.tip,
|
|
127
130
|
{
|
|
128
131
|
borderRadius: m.radius,
|
|
129
|
-
paddingTop: m.top,
|
|
132
|
+
paddingTop: miniTip ? 22 : m.top,
|
|
130
133
|
paddingHorizontal: m.inline,
|
|
131
134
|
paddingBottom,
|
|
132
135
|
columnGap: m.iconGap,
|
|
133
|
-
rowGap: hasActions && buttons ? m.gapButtons : m.gap,
|
|
136
|
+
rowGap: miniTip ? 22 : hasActions && buttons ? m.gapButtons : m.gap,
|
|
134
137
|
backgroundColor: background ?? theme.colors.groupedSurface,
|
|
135
138
|
},
|
|
136
139
|
style,
|
|
@@ -148,7 +151,7 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
|
|
|
148
151
|
<Text variant="headline">{title}</Text>
|
|
149
152
|
{isRenderable(description) ? (
|
|
150
153
|
<TextColorProvider value={descriptionColor}>
|
|
151
|
-
<Text variant="subheadline" color={descriptionColor} style={android ? styles.androidDescription : null}>
|
|
154
|
+
<Text variant="subheadline" color={descriptionColor} style={android ? styles.androidDescription : miniTip ? styles.miniDescription : null}>
|
|
152
155
|
{description}
|
|
153
156
|
</Text>
|
|
154
157
|
</TextColorProvider>
|
|
@@ -182,19 +185,68 @@ function TipBody({ title, description, icon, actions, mobileActions = "rows", on
|
|
|
182
185
|
)
|
|
183
186
|
}
|
|
184
187
|
|
|
185
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* An action as a capsule across the tip. On iOS it is TipKit's action (the kit's Hint View): 50 tall, a 17 Semibold
|
|
190
|
+
* label in the action's color (the accent for a primary one) on that color at 8% over the gray fill at 8%. On Android
|
|
191
|
+
* the Button keeps its color and variant, a 40dp capsule.
|
|
192
|
+
*/
|
|
186
193
|
function ActionButton({ item }: { item: ReactNode }) {
|
|
187
194
|
const theme = useTheme()
|
|
188
195
|
if (!isValidElement(item) || item.type !== Button) return <>{item}</>
|
|
189
196
|
const button = item as ReactElement<ButtonProps>
|
|
190
|
-
return cloneElement(button, {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
if (theme.isAndroid) return cloneElement(button, { size: "lg", pill: true, block: true })
|
|
198
|
+
// The Button's look props stay here; its handlers, ref and accessibility props pass on to the capsule
|
|
199
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
200
|
+
const {
|
|
201
|
+
color = "primary",
|
|
202
|
+
children,
|
|
203
|
+
disabled = false,
|
|
204
|
+
loading = false,
|
|
205
|
+
inert: inertProp = loading,
|
|
206
|
+
variant,
|
|
207
|
+
size,
|
|
208
|
+
pill,
|
|
209
|
+
shape,
|
|
210
|
+
mobileMaterial,
|
|
211
|
+
uniform,
|
|
212
|
+
block,
|
|
213
|
+
labelLines,
|
|
214
|
+
selected,
|
|
215
|
+
iconSize,
|
|
216
|
+
gutterSize,
|
|
217
|
+
opticallyAlign,
|
|
218
|
+
style,
|
|
219
|
+
accessibilityState,
|
|
220
|
+
...pressable
|
|
221
|
+
} = button.props
|
|
222
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
223
|
+
// As the Button: a loading or inert action takes no presses and keeps its look; a disabled one dims
|
|
224
|
+
const inert = disabled || inertProp
|
|
225
|
+
const ink = color === "primary" ? theme.colors.accent : theme.color(`--color-text-${color}-ghost`, theme.colors.accent)
|
|
226
|
+
return (
|
|
227
|
+
<Pressable
|
|
228
|
+
accessibilityRole="button"
|
|
229
|
+
{...pressable}
|
|
230
|
+
accessibilityState={{ ...accessibilityState, disabled: inert, busy: loading }}
|
|
231
|
+
aria-busy={loading}
|
|
232
|
+
disabled={inert}
|
|
233
|
+
style={({ pressed }) => [styles.miniAction, { backgroundColor: MINI_GRAY, opacity: disabled ? 0.4 : 1 }, pressed && !inert ? styles.pressed : null]}
|
|
234
|
+
>
|
|
235
|
+
<View pointerEvents="none" style={[StyleSheet.absoluteFill, styles.miniActionTint, { backgroundColor: withAlpha(ink, 0.08) }]} />
|
|
236
|
+
{loading ? (
|
|
237
|
+
<ActivityIndicator color={ink} />
|
|
238
|
+
) : (
|
|
239
|
+
<Text variant="body" weight="semibold" numberOfLines={2} style={styles.miniLabel} color={ink}>
|
|
240
|
+
{children as ReactNode}
|
|
241
|
+
</Text>
|
|
242
|
+
)}
|
|
243
|
+
</Pressable>
|
|
244
|
+
)
|
|
196
245
|
}
|
|
197
246
|
|
|
247
|
+
/** The gray under a TipKit action's tint: the kit's rgba(116, 116, 128, 0.08). */
|
|
248
|
+
const MINI_GRAY = "rgba(116, 116, 128, 0.08)"
|
|
249
|
+
|
|
198
250
|
/**
|
|
199
251
|
* An action as a row of text in its Button's color under a separator, 46 tall, as iOS tips list them; on Android a
|
|
200
252
|
* text button in the accent, as Material 3's rich tooltip sets its actions. Other elements stand as given.
|
|
@@ -398,6 +450,10 @@ const styles = StyleSheet.create({
|
|
|
398
450
|
androidDescription: { marginTop: 2 },
|
|
399
451
|
actions: { flexBasis: "100%", flexGrow: 1, flexDirection: "column" },
|
|
400
452
|
buttons: { gap: 10 },
|
|
453
|
+
miniDescription: { marginTop: 4 },
|
|
454
|
+
miniAction: { minHeight: 50, paddingHorizontal: 20, paddingVertical: 14, borderRadius: 25, borderCurve: "continuous", alignItems: "center", justifyContent: "center", overflow: "hidden" },
|
|
455
|
+
miniActionTint: { borderRadius: 25 },
|
|
456
|
+
miniLabel: { lineHeight: 18, textAlign: "center" },
|
|
401
457
|
androidActions: { flexDirection: "row", flexWrap: "wrap", gap: 8 },
|
|
402
458
|
row: { minHeight: 46, paddingVertical: 12, borderTopWidth: 1, justifyContent: "center" },
|
|
403
459
|
androidRow: { alignSelf: "flex-start", minHeight: 40, paddingHorizontal: 12, borderRadius: 20, justifyContent: "center" },
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Generated by scripts/build-icons.mjs. Do not edit.
|
|
2
|
+
import { createIcon } from "../../components/Icon/createIcon"
|
|
3
|
+
|
|
4
|
+
export default createIcon("AppleLogo", "0 0 24 24", [["path",{"d":"M20.0911 7.2368C19.3972 7.66168 18.8223 8.25568 18.4204 8.96321C18.0185 9.67075 17.8027 10.4687 17.7932 11.2823C17.7959 12.1981 18.0672 13.0929 18.5735 13.856C19.0798 14.6191 19.7988 15.2169 20.6415 15.5754C20.3093 16.6474 19.8176 17.6632 19.1829 18.5888C18.2748 19.8961 17.3253 21.2032 15.8805 21.2032C14.4358 21.2032 14.0642 20.3638 12.3992 20.3638C10.7755 20.3638 10.1976 21.2308 8.87662 21.2308C7.55564 21.2308 6.63382 20.0198 5.57424 18.5338C4.17461 16.452 3.4054 14.0106 3.35889 11.5024C3.35889 7.37443 6.04214 5.18665 8.68397 5.18665C10.0875 5.18665 11.2572 6.10847 12.1378 6.10847C12.9772 6.10847 14.2844 5.1315 15.8805 5.1315C16.7012 5.11032 17.5145 5.29127 18.2487 5.6584C18.983 6.02553 19.6157 6.56757 20.0911 7.2368ZM15.1238 3.38405C15.8274 2.55637 16.2257 1.51233 16.2521 0.426336C16.2533 0.28317 16.2395 0.140275 16.2108 0C15.0022 0.11806 13.8846 0.694096 13.0872 1.60995C12.3769 2.40465 11.9636 3.42081 11.9176 4.48573C11.9181 4.61524 11.932 4.74435 11.9589 4.87103C12.0542 4.88904 12.1509 4.89827 12.2479 4.89861C12.8049 4.85429 13.347 4.69717 13.8414 4.4368C14.3358 4.17644 14.7721 3.81826 15.1238 3.38405Z","fill":0}]])
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Generated by scripts/build-icons.mjs. Do not edit.
|
|
2
|
+
import { createIcon } from "../../components/Icon/createIcon"
|
|
3
|
+
|
|
4
|
+
export default createIcon("GoogleLogo", "0 0 24 24", [["path",{"d":"M21.0461 12.2099C21.0461 11.5553 20.9874 10.9259 20.8783 10.3217H12.1846V13.8966H17.1524C16.9342 15.0462 16.2797 16.0197 15.2979 16.6742V18.9987H18.2937C20.0391 17.3875 21.0461 15.0211 21.0461 12.2099Z","fill":"#4285F4"}],["path",{"d":"M12.1844 21.2307C14.6767 21.2307 16.7662 20.4084 18.2935 18.9986L15.2977 16.6741C14.4753 17.2279 13.4264 17.5636 12.1844 17.5636C9.78441 17.5636 7.74525 15.944 7.01518 13.7622H3.94385V16.1454C5.46273 19.158 8.57602 21.2307 12.1844 21.2307Z","fill":"#34A853"}],["path",{"d":"M7.01516 13.7539C6.83054 13.2 6.72145 12.6126 6.72145 12C6.72145 11.3874 6.83054 10.8 7.01516 10.2462V7.86295H3.94382C3.31445 9.10491 2.95361 10.5063 2.95361 12C2.95361 13.4937 3.31445 14.8951 3.94382 16.1371L6.33544 14.2741L7.01516 13.7539Z","fill":"#FBBC05"}],["path",{"d":"M12.1844 6.44475C13.5439 6.44475 14.7522 6.91469 15.7173 7.82098L18.3606 5.17762C16.7578 3.68391 14.6767 2.76923 12.1844 2.76923C8.57602 2.76923 5.46273 4.84196 3.94385 7.86294L7.01518 10.2462C7.74525 8.06434 9.78441 6.44475 12.1844 6.44475Z","fill":"#EA4335"}]])
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Generated by scripts/build-icons.mjs. Do not edit.
|
|
2
|
+
import { createIcon } from "../../components/Icon/createIcon"
|
|
3
|
+
|
|
4
|
+
export default createIcon("MicrosoftLogo", "0 0 24 24", [["path",{"d":"M3.25 3.25H11.25V11.25H3.25V3.25Z","fill":"#F35325"}],["path",{"d":"M12.75 3.25H20.75V11.25H12.75V3.25Z","fill":"#81BC06"}],["path",{"d":"M3.25 12.75H11.25V20.75H3.25V12.75Z","fill":"#05A6F0"}],["path",{"d":"M12.75 12.75H20.75V20.75H12.75V12.75Z","fill":"#FFBA08"}]])
|
package/src/icons/plex/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { default as AppPermission } from "./AppPermission"
|
|
|
20
20
|
export { default as AppStore } from "./AppStore"
|
|
21
21
|
export { default as AppStoreSquare } from "./AppStoreSquare"
|
|
22
22
|
export { default as Apple } from "./Apple"
|
|
23
|
+
export { default as AppleLogo } from "./AppleLogo"
|
|
23
24
|
export { default as Archive } from "./Archive"
|
|
24
25
|
export { default as Array } from "./Array"
|
|
25
26
|
export { default as ArrowBottomLeftSm } from "./ArrowBottomLeftSm"
|
|
@@ -268,6 +269,7 @@ export { default as GlobeAlt } from "./GlobeAlt"
|
|
|
268
269
|
export { default as GlobeFilled } from "./GlobeFilled"
|
|
269
270
|
export { default as GlobeOff } from "./GlobeOff"
|
|
270
271
|
export { default as GlobeSpin } from "./GlobeSpin"
|
|
272
|
+
export { default as GoogleLogo } from "./GoogleLogo"
|
|
271
273
|
export { default as Grid } from "./Grid"
|
|
272
274
|
export { default as GridAlt } from "./GridAlt"
|
|
273
275
|
export { default as GripHorizontal } from "./GripHorizontal"
|
|
@@ -361,6 +363,7 @@ export { default as Mic } from "./Mic"
|
|
|
361
363
|
export { default as MicFilled } from "./MicFilled"
|
|
362
364
|
export { default as MicFilledOff } from "./MicFilledOff"
|
|
363
365
|
export { default as MicOff } from "./MicOff"
|
|
366
|
+
export { default as MicrosoftLogo } from "./MicrosoftLogo"
|
|
364
367
|
export { default as MinimizeDown } from "./MinimizeDown"
|
|
365
368
|
export { default as MinimizeLeft } from "./MinimizeLeft"
|
|
366
369
|
export { default as MinimizeRight } from "./MinimizeRight"
|
package/src/index.ts
CHANGED
|
@@ -61,6 +61,7 @@ export {
|
|
|
61
61
|
} from "./components/SegmentedControl/SegmentedControl"
|
|
62
62
|
|
|
63
63
|
export { Switch, type SwitchProps } from "./components/Switch/Switch"
|
|
64
|
+
export { SignInButton, type SignInAction, type SignInButtonProps, type SignInProvider } from "./components/SignInButton/SignInButton"
|
|
64
65
|
export { Checkbox, type CheckboxProps } from "./components/Checkbox/Checkbox"
|
|
65
66
|
export { RadioGroup, type RadioGroupItemProps, type RadioGroupProps } from "./components/RadioGroup/RadioGroup"
|
|
66
67
|
export { Input, InputAdornmentButton, TextField, type InputAdornmentButtonProps, type InputProps, type InputVariant, type TextFieldProps } from "./components/Input/Input"
|
|
@@ -86,7 +87,7 @@ export { ContextMenu, type ContextMenuContentProps, type ContextMenuProps } from
|
|
|
86
87
|
export { ScrollEdge, type ScrollEdgeProps } from "./components/ScrollEdge/ScrollEdge"
|
|
87
88
|
export { DatePicker, type DatePickerDisplay, type DatePickerMode, type DatePickerProps } from "./components/DatePicker/DatePicker"
|
|
88
89
|
export { ActionSheet, type ActionSheetAction, type ActionSheetProps } from "./components/ActionSheet/ActionSheet"
|
|
89
|
-
export { BottomSheet, type BottomSheetFooterProps, type BottomSheetProps } from "./components/BottomSheet/BottomSheet"
|
|
90
|
+
export { BottomSheet, type BottomSheetFooterProps, type BottomSheetHero, type BottomSheetHeroTone, type BottomSheetProps } from "./components/BottomSheet/BottomSheet"
|
|
90
91
|
export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog/Dialog"
|
|
91
92
|
export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, type ToastT, type ToastType } from "./components/Toast/Toast"
|
|
92
93
|
|
package/src/internal/Glass.tsx
CHANGED
|
@@ -13,6 +13,12 @@ export type GlassProps = ViewProps & {
|
|
|
13
13
|
tint?: string
|
|
14
14
|
/** Native glass reacts to touches (iOS 26 interactive glass). */
|
|
15
15
|
interactive?: boolean
|
|
16
|
+
/**
|
|
17
|
+
* iOS 26's clear glass, for controls over a photo, a video or a color: native `.clear` glass on iOS 26, elsewhere
|
|
18
|
+
* the kit's clear fill (`--mobile-glass-clear-background`, gray 153 at 17%) with a light blur, a 0.5 rim and a
|
|
19
|
+
* faint shadow (`--mobile-glass-clear-*`), the same in light and dark: what is under it decides how it reads.
|
|
20
|
+
*/
|
|
21
|
+
clear?: boolean
|
|
16
22
|
/** A fill token for the glass instead of `--mobile-glass-background` (menus, alerts and toasts set their own). */
|
|
17
23
|
fillToken?: string
|
|
18
24
|
/**
|
|
@@ -116,6 +122,12 @@ const lensMask = (width: number, height: number, radius: number) => {
|
|
|
116
122
|
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`
|
|
117
123
|
}
|
|
118
124
|
|
|
125
|
+
/** The clear glass where its tokens are not set: the kit's gray 153 at 17% over a light blur. */
|
|
126
|
+
const CLEAR_FILL = "rgba(153, 153, 153, 0.17)"
|
|
127
|
+
const CLEAR_FILTER = "blur(4px) brightness(1.08)"
|
|
128
|
+
/** Clear glass with no blur (Reduce Transparency, no blur module): a dark gray, as the clear glass over a dark photo. */
|
|
129
|
+
const CLEAR_OPAQUE = "#3a3a3c"
|
|
130
|
+
|
|
119
131
|
/** The filter and the shadow of the glass surfaces of the phone layer, by their fill (mobile-materials.css, touch.css). */
|
|
120
132
|
const SURFACES: Record<string, { filter: string; shadow: string }> = {
|
|
121
133
|
"--menu-mobile-background": { filter: "--menu-mobile-backdrop-filter", shadow: "--menu-shadow" },
|
|
@@ -141,6 +153,7 @@ export function Glass({
|
|
|
141
153
|
elevation = "regular",
|
|
142
154
|
tint,
|
|
143
155
|
interactive,
|
|
156
|
+
clear = false,
|
|
144
157
|
fillToken,
|
|
145
158
|
filterToken,
|
|
146
159
|
shadowToken,
|
|
@@ -156,7 +169,7 @@ export function Glass({
|
|
|
156
169
|
const overrides = useThemeOverrides()
|
|
157
170
|
const shape: ViewStyle = { borderRadius: radius, borderCurve: "continuous" }
|
|
158
171
|
const surface = fillToken ? SURFACES[fillToken] : undefined
|
|
159
|
-
const shadow = theme.token(shadowToken ?? surface?.shadow ?? (elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"))
|
|
172
|
+
const shadow = theme.token(shadowToken ?? surface?.shadow ?? (clear ? "--mobile-glass-clear-shadow" : elevation === "raised" ? "--mobile-glass-shadow-raised" : "--mobile-glass-shadow"))
|
|
160
173
|
const boxShadow = typeof shadow === "string" ? shadow : undefined
|
|
161
174
|
const native = liquidGlassModule()
|
|
162
175
|
// iOS 26's own glass turns frostier by itself with Reduce Transparency
|
|
@@ -165,7 +178,7 @@ export function Glass({
|
|
|
165
178
|
return (
|
|
166
179
|
<GlassView
|
|
167
180
|
{...rest}
|
|
168
|
-
glassEffectStyle="regular"
|
|
181
|
+
glassEffectStyle={clear ? "clear" : "regular"}
|
|
169
182
|
colorScheme={theme.scheme}
|
|
170
183
|
tintColor={tint}
|
|
171
184
|
isInteractive={interactive}
|
|
@@ -176,8 +189,8 @@ export function Glass({
|
|
|
176
189
|
)
|
|
177
190
|
}
|
|
178
191
|
const web = Platform.OS === "web"
|
|
179
|
-
const fillName = fillToken ?? "--mobile-glass-background"
|
|
180
|
-
const filterName = filterToken ?? surface?.filter ?? "--mobile-glass-backdrop-filter"
|
|
192
|
+
const fillName = fillToken ?? (clear ? "--mobile-glass-clear-background" : "--mobile-glass-background")
|
|
193
|
+
const filterName = filterToken ?? surface?.filter ?? (clear ? "--mobile-glass-clear-backdrop-filter" : "--mobile-glass-backdrop-filter")
|
|
181
194
|
const dense = web && !theme.isAndroid ? WEB_DENSE[fillName] : undefined
|
|
182
195
|
const denseFill = dense != null && tint == null && overrides?.[fillName] == null
|
|
183
196
|
// Glass with a fill of its own and the plain glass's filter (the large segmented control) blurs as the plain glass
|
|
@@ -185,9 +198,9 @@ export function Glass({
|
|
|
185
198
|
const plainFilter = web && !theme.isAndroid && dense == null && filterToken == null && filterName === "--mobile-glass-backdrop-filter" && overrides?.[filterName] == null
|
|
186
199
|
const denseFilter = (dense != null && filterToken == null && overrides?.[filterName] == null) || plainFilter
|
|
187
200
|
const webFilter = dense ?? WEB_DENSE["--mobile-glass-background"]
|
|
188
|
-
const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName))
|
|
201
|
+
const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName, clear ? CLEAR_FILL : undefined))
|
|
189
202
|
const filterValue = denseFilter ? (theme.token(webFilter.filter) ?? webFilter.blur) : theme.token(filterName)
|
|
190
|
-
const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : "blur(12px)"
|
|
203
|
+
const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : clear ? CLEAR_FILTER : "blur(12px)"
|
|
191
204
|
const module = web || Platform.OS !== "ios" ? null : blurModule()
|
|
192
205
|
const opaque = reduceTransparency || (!web && module == null)
|
|
193
206
|
if (web && !opaque) {
|
|
@@ -243,11 +256,12 @@ export function Glass({
|
|
|
243
256
|
<View {...rest} style={[shape, { boxShadow }, style]}>
|
|
244
257
|
<View style={[StyleSheet.absoluteFill, shape, { overflow: "hidden" }]} pointerEvents="none">
|
|
245
258
|
{opaque ? (
|
|
246
|
-
|
|
259
|
+
// Clear glass carries a light label over a photo or a color: opaque, it stands on a dark gray so the label reads
|
|
260
|
+
<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) }]} />
|
|
247
261
|
) : module ? (
|
|
248
262
|
<module.BlurView
|
|
249
263
|
intensity={intensityOf(radiusPx)}
|
|
250
|
-
tint={theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight"}
|
|
264
|
+
tint={clear ? "systemUltraThinMaterial" : theme.scheme === "dark" ? "systemChromeMaterialDark" : "systemChromeMaterialLight"}
|
|
251
265
|
style={StyleSheet.absoluteFill}
|
|
252
266
|
/>
|
|
253
267
|
) : null}
|