@plexui/react-native 0.2.15 → 0.2.17
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/BottomSheet/BottomSheet.js +11 -2
- package/dist/es/components/List/List.js +19 -12
- package/dist/es/components/SegmentedControl/SegmentedControl.js +22 -18
- package/dist/es/components/Select/Select.js +5 -4
- package/dist/es/components/TabBar/TabBar.js +68 -4
- package/dist/es/internal/Glass.js +6 -2
- package/dist/types/components/BottomSheet/BottomSheet.d.ts +7 -1
- package/dist/types/components/List/List.d.ts +6 -1
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +8 -1
- package/dist/types/internal/row.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/BottomSheet/BottomSheet.tsx +15 -1
- package/src/components/List/List.tsx +25 -12
- package/src/components/SegmentedControl/SegmentedControl.tsx +25 -10
- package/src/components/Select/Select.tsx +6 -5
- package/src/components/TabBar/TabBar.tsx +83 -3
- package/src/internal/Glass.tsx +6 -2
- package/src/internal/row.ts +2 -0
|
@@ -167,7 +167,7 @@ function BottomSheetRoot(props) {
|
|
|
167
167
|
return _jsx(BottomSheetBase, { ...props });
|
|
168
168
|
}
|
|
169
169
|
/** The sheet with an exit of its own (ActionSheet's item tap); not part of the public API. */
|
|
170
|
-
export function BottomSheetBase({ open, onOpenChange, title, children, dismissible = true, "aria-label": ariaLabel, testID, contentStyle, closeLabel = "Close", exit, onExited, }) {
|
|
170
|
+
export function BottomSheetBase({ open, onOpenChange, title, children, dismissible = true, "aria-label": ariaLabel, testID, contentStyle, closeLabel = "Close", detent = "content", exit, onExited, }) {
|
|
171
171
|
const theme = useTheme();
|
|
172
172
|
const insets = useSafeAreaInsets();
|
|
173
173
|
const { width, height: screen } = useWindowDimensions();
|
|
@@ -210,6 +210,8 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
|
|
|
210
210
|
: { accessibilityViewIsModal: true, "aria-label": ariaLabel };
|
|
211
211
|
// Android's sheet stands under the status bar at most; the phone layer's 16 under the top inset
|
|
212
212
|
const maxHeight = screen - insets.top - (android ? 0 : 16);
|
|
213
|
+
// A detent holds the sheet's height whatever its content: half the screen, the most it takes, or a height
|
|
214
|
+
const fixedHeight = detent === "large" ? maxHeight : detent === "medium" ? Math.min(Math.round(screen / 2), maxHeight) : typeof detent === "number" ? Math.min(detent, maxHeight) : undefined;
|
|
213
215
|
// Android's sheet is as wide as the screen in portrait; in landscape 80% of it and 480dp at least
|
|
214
216
|
const maxWidth = android && width > screen ? Math.max(width * 0.8, Math.min(480, width)) : undefined;
|
|
215
217
|
const closeSize = theme.length("--dialog-sheet-close-size", 44);
|
|
@@ -245,6 +247,8 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
|
|
|
245
247
|
styles.sheet,
|
|
246
248
|
{
|
|
247
249
|
maxHeight,
|
|
250
|
+
// A fixed sheet grows by the keyboard it stands over, within the screen, so its content keeps its room
|
|
251
|
+
height: fixedHeight == null ? undefined : Math.min(fixedHeight + keyboard, maxHeight),
|
|
248
252
|
maxWidth,
|
|
249
253
|
borderTopLeftRadius: radius,
|
|
250
254
|
borderTopRightRadius: radius,
|
|
@@ -255,7 +259,11 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
|
|
|
255
259
|
opacity: reduced ? progress : undefined,
|
|
256
260
|
transform: [{ translateY: reduced ? drag : slide(progress) }],
|
|
257
261
|
},
|
|
258
|
-
], children: [android && title != null ? null : header, _jsx(ScrollView
|
|
262
|
+
], children: [android && title != null ? null : header, _jsx(ScrollView
|
|
263
|
+
// A sheet of a fixed height gives its content the room left, so a footer stays at its bottom
|
|
264
|
+
, {
|
|
265
|
+
// A sheet of a fixed height gives its content the room left, so a footer stays at its bottom
|
|
266
|
+
style: [styles.scroll, fixedHeight != null ? styles.grow : null], ...(android
|
|
259
267
|
? {
|
|
260
268
|
...gesture.content,
|
|
261
269
|
onScroll: (event) => {
|
|
@@ -326,6 +334,7 @@ const styles = StyleSheet.create({
|
|
|
326
334
|
bottom: { flex: 1, justifyContent: "flex-end", alignItems: "center" },
|
|
327
335
|
sheet: { alignSelf: "stretch", overflow: "hidden", borderCurve: "continuous", marginHorizontal: "auto", width: "100%" },
|
|
328
336
|
scroll: { flexGrow: 0, flexShrink: 1 },
|
|
337
|
+
grow: { flexGrow: 1 },
|
|
329
338
|
iosBar: { flexDirection: "row", alignItems: "center", gap: 8 },
|
|
330
339
|
iosHeading: { flex: 1, alignItems: "center", justifyContent: "center" },
|
|
331
340
|
scrimTarget: { position: "absolute", top: 0, left: 0, right: 0 },
|
|
@@ -116,7 +116,7 @@ export function List({ children, header, description, footer, error, surface = "
|
|
|
116
116
|
* in (a multi-select list); a 1px divider from the text's start to the card's end, none under a row with a tile (a
|
|
117
117
|
* tiled row draws none).
|
|
118
118
|
*/
|
|
119
|
-
export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, disabled = false, destructive = false, accessibilityLabel, testID, }) {
|
|
119
|
+
export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, disabled = false, destructive = false, accessibilityLabel, testID, }) {
|
|
120
120
|
const theme = useTheme();
|
|
121
121
|
const { last, top, bottom } = useContext(PlaceContext);
|
|
122
122
|
// A menu opened from the row finds the row (Android lights it over the dim of the screen)
|
|
@@ -151,10 +151,17 @@ export function ListItem({ label, description, leading, leadingColor, value, val
|
|
|
151
151
|
// A control at the end that opens from the row (`RowEnd.press`) gets the row's press, as it gets a toggle's; it stays
|
|
152
152
|
// the one element for a screen reader and the keyboard
|
|
153
153
|
const [endPress, setEndPress] = useState(null);
|
|
154
|
-
|
|
154
|
+
// Once a control has handed the row its press the row stays a pressable frame, so taking the press back (a select
|
|
155
|
+
// disabled) does not swap the frame and remount the row's contents with their state
|
|
156
|
+
const [endHands, setEndHands] = useState(false);
|
|
157
|
+
const handPress = useCallback((open) => {
|
|
158
|
+
setEndPress(() => open);
|
|
159
|
+
if (open != null)
|
|
160
|
+
setEndHands(true);
|
|
161
|
+
}, []);
|
|
155
162
|
const handed = !switchRow && !onPress && !control && !disabled ? endPress : null;
|
|
156
163
|
const press = switchRow ? toggle : (onPress ?? control?.toggle ?? handed ?? undefined);
|
|
157
|
-
const endOwnsFocus = control != null || handed != null;
|
|
164
|
+
const endOwnsFocus = control != null || handed != null || (endHands && press == null);
|
|
158
165
|
// A destructive row is an action, not a page (Settings' Sign Out has no chevron)
|
|
159
166
|
const chevron = disclosure ?? (!!onPress && !switchRow && trailing == null && !destructive);
|
|
160
167
|
const name = accessibilityLabel ?? ([textOf(label), textOf(value)].filter(Boolean).join(", ") || undefined);
|
|
@@ -184,15 +191,15 @@ export function ListItem({ label, description, leading, leadingColor, value, val
|
|
|
184
191
|
const end = !switchRow ? (atStart ? trailing : checkLeads ? null : (control?.node ?? trailing)) : trailing != null ? (_jsxs(View, { style: [styles.pair, { gap: theme.isAndroid ? 16 : theme.length("--field-row-disclosure-gap", 8) }], children: [trailing, track] })) : (track);
|
|
185
192
|
const start = (atStart || checkLeads) && control ? _jsx(RowStartContext.Provider, { value: true, children: control.node }) : leading;
|
|
186
193
|
const startColor = atStart || checkLeads ? undefined : leadingColor;
|
|
187
|
-
return (_jsx(RowFrameContext.Provider, { value: frame, children: theme.isAndroid ? (_jsx(AndroidContent, { handPress: handPress, theme: theme, label: label, description: description, descriptionId: described.id, leading: start, leadingColor: startColor, leadingMark: atStart != null || checkLeads, value: value, valuePlacement: valuePlacement, trailing: end, edgeControl: found != null || switchRow, error: error, disabled: disabled, destructive: destructive, last: last })) : (_jsx(IOSContent, { theme: theme, label: label, description: description, descriptionId: described.id, leading: start, leadingColor: startColor, value: value, valuePlacement: valuePlacement, trailing: end, edgeControl: found != null || switchRow, error: error, chevron: chevron, disabled: disabled, destructive: destructive, last: last })) }));
|
|
194
|
+
return (_jsx(RowFrameContext.Provider, { value: frame, children: theme.isAndroid ? (_jsx(AndroidContent, { handPress: handPress, valueColor: valueColor ?? "accent", theme: theme, label: label, description: description, descriptionId: described.id, leading: start, leadingColor: startColor, leadingMark: atStart != null || checkLeads, value: value, valuePlacement: valuePlacement, trailing: end, edgeControl: found != null || switchRow, error: error, disabled: disabled, destructive: destructive, last: last })) : (_jsx(IOSContent, { handPress: handPress, valueColor: valueColor ?? "secondary", theme: theme, label: label, description: description, descriptionId: described.id, leading: start, leadingColor: startColor, value: value, valuePlacement: valuePlacement, trailing: end, edgeControl: found != null || switchRow, error: error, chevron: chevron, disabled: disabled, destructive: destructive, last: last })) }));
|
|
188
195
|
};
|
|
189
|
-
if (press || onLongPress) {
|
|
196
|
+
if (press || onLongPress || endHands) {
|
|
190
197
|
// Android's rows press in the list selector: the native ripple on a device, the drawn one on the web
|
|
191
198
|
const highlight = controlHighlight(theme.scheme);
|
|
192
199
|
const drawn = theme.isAndroid && !nativeRipple;
|
|
193
200
|
return (_jsx(Pressable, { ref: frameNode, collapsable: false, ...described.props, ...(switchRow ? spaceToggles(toggle) : null),
|
|
194
201
|
// A row that toggles its control is not a second element for a screen reader or a Tab stop: the control is
|
|
195
|
-
accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }, "aria-checked": switchRow ? checked : undefined, disabled: disabled, onPress: press, onLongPress: onLongPress, delayLongPress: onLongPress ? 500 : undefined, accessibilityActions: onLongPress ? [{ name: "longpress" }] : undefined, onAccessibilityAction: onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined, onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: row, children: ({ pressed }) => (_jsxs(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: [ripple.layer, theme.isAndroid ? null : _jsx(RowHighlight, { on: (pressed || held) && lit, last: last }), content(pressed || held)] })) }));
|
|
202
|
+
accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }, "aria-checked": switchRow ? checked : undefined, disabled: disabled || (press == null && onLongPress == null), onPress: press, onLongPress: onLongPress, delayLongPress: onLongPress ? 500 : undefined, accessibilityActions: onLongPress ? [{ name: "longpress" }] : undefined, onAccessibilityAction: onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined, onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: row, children: ({ pressed }) => (_jsxs(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: [ripple.layer, theme.isAndroid ? null : _jsx(RowHighlight, { on: (pressed || held) && lit, last: last }), content(pressed || held)] })) }));
|
|
196
203
|
}
|
|
197
204
|
// A row that only shows (a detail, a value) is one element named by `accessibilityLabel` when it has one; with a
|
|
198
205
|
// control at its end it stays a group, so the control is still reached
|
|
@@ -337,7 +344,7 @@ function useValueBelow(placement, label, value, type, fits) {
|
|
|
337
344
|
const probe = auto ? (_jsxs(View, { pointerEvents: "none", "aria-hidden": true, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: styles.probe, children: [_jsx(Text, { numberOfLines: 1, style: type.label, onLayout: measure("label"), children: label }), _jsx(Text, { numberOfLines: 1, style: type.value, onLayout: measure("value"), children: value })] })) : null;
|
|
338
345
|
return { below, probe, onRowLayout: auto ? measure("row") : undefined, onTrailingLayout: auto ? measure("trailing") : undefined };
|
|
339
346
|
}
|
|
340
|
-
function IOSContent({ theme, label, description, descriptionId, leading, leadingColor, value, valuePlacement, trailing, edgeControl = false, error, chevron, disabled, destructive, last }) {
|
|
347
|
+
function IOSContent({ handPress, valueColor, theme, label, description, descriptionId, leading, leadingColor, value, valuePlacement, trailing, edgeControl = false, error, chevron, disabled, destructive, last }) {
|
|
341
348
|
const inset = theme.length("--list-row-inset", 20);
|
|
342
349
|
const tile = theme.length("--field-row-icon-size", 28);
|
|
343
350
|
const gap = theme.length("--field-row-gap", 16);
|
|
@@ -368,7 +375,7 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
368
375
|
// A switch, a checkbox and a radio stay at the row's edge
|
|
369
376
|
const columns = useContext(ListOptionsContext)?.columns === true && trailing != null;
|
|
370
377
|
const startsColumn = columns && !edgeControl;
|
|
371
|
-
const rowEnd = useMemo(() => ({ fill: setFill, align: startsColumn ? "start" : "end" }), [startsColumn]);
|
|
378
|
+
const rowEnd = useMemo(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end", valueColor }), [handPress, startsColumn, valueColor]);
|
|
372
379
|
const errorOffset = theme.length("--mobile-field-error-offset", 4);
|
|
373
380
|
const errorLine = theme.length("--mobile-field-error-line-height", 20);
|
|
374
381
|
// With an error the label and the control stand on a line of their own over it
|
|
@@ -394,11 +401,11 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
394
401
|
_jsx(Text, { color: secondary, style: labelType, children: value })) : null, description != null ? (_jsx(Text, { nativeID: descriptionId, color: secondary, style: { fontSize: theme.length("--field-row-description-font-size", 15), lineHeight: descriptionLine }, children: description })) : null] }), (value != null && !below) || trailing != null || chevron ? (_jsxs(View, { style: [fill || columns ? styles.endFill : styles.end, columns && !startsColumn ? styles.endAtEdge : null, { gap: disclosureGap }], children: [value != null && !below ? (
|
|
395
402
|
// A long value wraps within the 60% the end takes, as the web's, rather than losing its end; set at the
|
|
396
403
|
// row's end (a phone turns "right" over in a right-to-left layout itself, the web does not)
|
|
397
|
-
_jsx(Text, { color: secondary, style: [labelType, styles.shrink, { textAlign: Platform.OS === "web" && rtl ? "left" : "right" }], children: value })) : null, trailing != null ? (_jsx(View, { style: fill ? styles.grow : startsColumn ? styles.keepStart : styles.keep, onLayout: onTrailingLayout, children: _jsx(RowEndContext.Provider, { value: rowEnd, children: trailing }) })) : null, chevron ? _jsx(Disclosure, { size: 20, color: theme.colors.labelTertiary, style: [styles.disclosure, mirrored(rtl)] }) : null] })) : null] })), error != null ? (_jsxs(View, { accessibilityLiveRegion: "polite", style: [styles.iosError, { marginTop: errorOffset, gap: theme.length("--mobile-field-error-icon-gap", 4) }], children: [_jsx(ExclamationMarkCircle, { size: theme.length("--mobile-field-error-icon-size", 16), color: errorColor(theme), style: { marginTop: (errorLine - theme.length("--mobile-field-error-icon-size", 16)) / 2 } }), _jsx(Text, { color: errorColor(theme), style: [styles.shrink, { fontSize: theme.length("--mobile-field-error-font-size", 15), lineHeight: errorLine }], children: error })] })) : null] })] }));
|
|
404
|
+
_jsx(Text, { color: valueColor === "accent" && !disabled ? theme.colors.accent : secondary, style: [labelType, styles.shrink, { textAlign: Platform.OS === "web" && rtl ? "left" : "right" }], children: value })) : null, trailing != null ? (_jsx(View, { style: fill ? styles.grow : startsColumn ? styles.keepStart : styles.keep, onLayout: onTrailingLayout, children: _jsx(RowEndContext.Provider, { value: rowEnd, children: trailing }) })) : null, chevron ? _jsx(Disclosure, { size: 20, color: theme.colors.labelTertiary, style: [styles.disclosure, mirrored(rtl)] }) : null] })) : null] })), error != null ? (_jsxs(View, { accessibilityLiveRegion: "polite", style: [styles.iosError, { marginTop: errorOffset, gap: theme.length("--mobile-field-error-icon-gap", 4) }], children: [_jsx(ExclamationMarkCircle, { size: theme.length("--mobile-field-error-icon-size", 16), color: errorColor(theme), style: { marginTop: (errorLine - theme.length("--mobile-field-error-icon-size", 16)) / 2 } }), _jsx(Text, { color: errorColor(theme), style: [styles.shrink, { fontSize: theme.length("--mobile-field-error-font-size", 15), lineHeight: errorLine }], children: error })] })) : null] })] }));
|
|
398
405
|
}
|
|
399
406
|
/** The danger ink of a form's error, as the web's FieldError (`--field-error-color`). */
|
|
400
407
|
const errorColor = (theme) => theme.color("--field-error-color", theme.color("--color-text-danger-outline", theme.color("--color-text-danger")));
|
|
401
|
-
function AndroidContent({ handPress, theme, label, description, descriptionId, leading, leadingColor, leadingMark = false, value, valuePlacement, trailing, edgeControl = false, error, disabled, destructive, last, }) {
|
|
408
|
+
function AndroidContent({ handPress, valueColor, theme, label, description, descriptionId, leading, leadingColor, leadingMark = false, value, valuePlacement, trailing, edgeControl = false, error, disabled, destructive, last, }) {
|
|
402
409
|
// A disabled row fades to half, as Android's rows do
|
|
403
410
|
const dim = (color) => (disabled ? withAlpha(color, 0.5) : color);
|
|
404
411
|
const danger = dangerText(theme);
|
|
@@ -419,7 +426,7 @@ function AndroidContent({ handPress, theme, label, description, descriptionId, l
|
|
|
419
426
|
const [fill, setFill] = useState(false);
|
|
420
427
|
const columns = useContext(ListOptionsContext)?.columns === true && trailing != null;
|
|
421
428
|
const startsColumn = columns && !edgeControl;
|
|
422
|
-
const rowEnd = useMemo(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end" }), [handPress, startsColumn]);
|
|
429
|
+
const rowEnd = useMemo(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end", valueColor }), [handPress, startsColumn, valueColor]);
|
|
423
430
|
const parts = (_jsxs(_Fragment, { children: [leading == null ? null : leadingMark ? (_jsx(View, { style: styles.androidMark, children: leading })) : (_jsx(View, { style: tile ? [styles.androidTile, { backgroundColor: leadingColor, opacity: disabled ? 0.5 : 1 }] : styles.androidIcon, children: _jsx(IconDefaultsProvider, { size: 24, color: tile ? "#ffffff" : symbol, children: leading }) })), _jsxs(View, { style: [
|
|
424
431
|
columns ? [styles.androidTextHug, styles.column] : fill ? styles.androidTextHug : styles.androidText,
|
|
425
432
|
// One line centred in the 50dp row (54 beside a text field: a card's input row); with a second line 12 above
|
|
@@ -427,7 +434,7 @@ function AndroidContent({ handPress, theme, label, description, descriptionId, l
|
|
|
427
434
|
{ paddingVertical: error != null ? 0 : description != null || below ? 12 : fill ? 17 : 15 },
|
|
428
435
|
], children: [_jsx(Text, { color: ink, style: styles.androidLabel, children: label }), below ? (
|
|
429
436
|
// A detail row: the value a 13sp gray line under the label
|
|
430
|
-
_jsx(Text, { color: dim(theme.colors.labelSecondary), style: styles.androidDescription, children: value })) : null, description != null ? (_jsx(Text, { nativeID: descriptionId, color: dim(theme.colors.labelSecondary), style: styles.androidDescription, children: description })) : null] }), value != null && !below ? (_jsx(Text, { color: dim(accentText(theme)), numberOfLines: 1, style: [styles.androidLabel, styles.androidValue, { marginEnd: valueEnd - ANDROID_INSET }], children: value })) : null, trailing != null ? (_jsx(View, { style:
|
|
437
|
+
_jsx(Text, { color: dim(theme.colors.labelSecondary), style: styles.androidDescription, children: value })) : null, description != null ? (_jsx(Text, { nativeID: descriptionId, color: dim(theme.colors.labelSecondary), style: styles.androidDescription, children: description })) : null] }), value != null && !below ? (_jsx(Text, { color: dim(valueColor === "accent" ? accentText(theme) : theme.material.onSurfaceVariant), numberOfLines: 1, style: [styles.androidLabel, styles.androidValue, { marginEnd: valueEnd - ANDROID_INSET }], children: value })) : null, trailing != null ? (_jsx(View, { style:
|
|
431
438
|
// A switch or a checkbox stays at the row's edge after the label's column (it stretches in a column cell)
|
|
432
439
|
fill || startsColumn ? [styles.androidEndFill, startsColumn ? styles.androidEndStart : null] : columns ? [styles.androidEnd, styles.androidEndEdge] : styles.androidEnd, onLayout: onTrailingLayout, children: _jsx(RowEndContext.Provider, { value: rowEnd, children: trailing }) })) : null] }));
|
|
433
440
|
return (_jsxs(_Fragment, { children: [onRowLayout ? _jsx(View, { pointerEvents: "none", onLayout: onRowLayout, style: styles.androidSpan }) : null, probe, error != null ? (
|
|
@@ -70,7 +70,7 @@ const optionName = (option) => {
|
|
|
70
70
|
* iOS 26 apps (48pt; 40 in a Toolbar.Row), its thumb sliding to the selection; on Android a segmented capsule, white
|
|
71
71
|
* with a sliding pill of the accent. Props follow @plexui/ui (`SegmentedControl` and `SegmentedControl.Tab`).
|
|
72
72
|
*/
|
|
73
|
-
function SegmentedControlRoot({ value, onChange, onClick, "aria-label": ariaLabel, size = "md", disabled = false, block = false, mobileMaterial, mobileSegmentWidth = "equal", showBadges = false, style, testID, children, }) {
|
|
73
|
+
function SegmentedControlRoot({ value, onChange, onClick, "aria-label": ariaLabel, size = "md", disabled = false, block = false, mobileMaterial, mobileSegmentWidth = "equal", showBadges = false, badgeColor = "label", style, testID, children, }) {
|
|
74
74
|
const theme = useTheme();
|
|
75
75
|
const options = childrenOfType(children, SegmentedControlTab).map((child) => child.props);
|
|
76
76
|
const select = (option) => {
|
|
@@ -85,11 +85,11 @@ function SegmentedControlRoot({ value, onChange, onClick, "aria-label": ariaLabe
|
|
|
85
85
|
});
|
|
86
86
|
// Drawn counts differ from tab to tab, so each segment takes its own width with them, as a messenger's folder tabs
|
|
87
87
|
const counted = showBadges && options.some((option) => option.badge != null);
|
|
88
|
-
const common = { options, value, select, keys, disabled, block, equal: mobileSegmentWidth === "equal" && !counted, showBadges };
|
|
88
|
+
const common = { options, value, select, keys, disabled, block, equal: mobileSegmentWidth === "equal" && !counted, showBadges, badgeColor };
|
|
89
89
|
return (_jsx(View, { accessibilityRole: "tablist", "aria-label": ariaLabel, accessibilityState: { disabled }, testID: testID, style: [block ? styles.block : styles.hug, style], children: theme.isAndroid ? _jsx(AndroidControl, { ...common, size: size }) : _jsx(IOSControl, { ...common, size: size, material: mobileMaterial }) }));
|
|
90
90
|
}
|
|
91
91
|
SegmentedControlRoot.displayName = "SegmentedControl";
|
|
92
|
-
function IOSControl({ options, value, select, keys, disabled, block, equal, showBadges, size, material }) {
|
|
92
|
+
function IOSControl({ options, value, select, keys, disabled, block, equal, showBadges, badgeColor, size, material }) {
|
|
93
93
|
const theme = useTheme();
|
|
94
94
|
const inBar = !!useContext(BarItemContext);
|
|
95
95
|
const { inRow } = useContext(SegmentedControlRowContext);
|
|
@@ -161,7 +161,7 @@ function IOSControl({ options, value, select, keys, disabled, block, equal, show
|
|
|
161
161
|
], children: _jsxs(View, { onLayout: (event) => {
|
|
162
162
|
const w = Math.ceil(event.nativeEvent.layout.width);
|
|
163
163
|
setLabels((prev) => (prev[option.value] === w ? prev : { ...prev, [option.value]: w }));
|
|
164
|
-
}, style: [styles.label, held === option.value ? styles.heldLabel : null], children: [symbolOnly ? (_jsx(IconDefaultsProvider, { size: 20, color: color, children: option.icon })) : (_jsx(Text, { numberOfLines: 1, maxFontSizeMultiplier: maxScale, color: color, weight: isSelected ? look.selectedWeight : look.weight, style: { fontSize: look.fontSize, lineHeight: look.lineHeight }, children: option.children })), showBadges ? _jsx(SegmentCount, { badge: option.badge, selected: isSelected, off: off }) : null] }) }, option.value));
|
|
164
|
+
}, style: [styles.label, held === option.value ? styles.heldLabel : null], children: [symbolOnly ? (_jsx(IconDefaultsProvider, { size: 20, color: color, children: option.icon })) : (_jsx(Text, { numberOfLines: 1, maxFontSizeMultiplier: maxScale, color: color, weight: isSelected ? look.selectedWeight : look.weight, style: { fontSize: look.fontSize, lineHeight: look.lineHeight }, children: option.children })), showBadges ? _jsx(SegmentCount, { badge: option.badge, selected: isSelected, off: off, color: badgeColor }) : null] }) }, option.value));
|
|
165
165
|
})] }));
|
|
166
166
|
if (look.glass) {
|
|
167
167
|
// The glass keeps the control's fill over it: one flat layer, no sheen (touch.css)
|
|
@@ -183,7 +183,7 @@ const ANDROID_MOVE = { duration: 320, easing: curves.easeOutQuint };
|
|
|
183
183
|
* its label in the accent, the others in the secondary gray. The pill slides to a new selection and takes its width.
|
|
184
184
|
* In a bar's row of controls the capsule takes the height of the circles beside it (46dp).
|
|
185
185
|
*/
|
|
186
|
-
function AndroidControl({ options, value, select, keys, disabled, block, equal, showBadges, size }) {
|
|
186
|
+
function AndroidControl({ options, value, select, keys, disabled, block, equal, showBadges, badgeColor, size }) {
|
|
187
187
|
const theme = useTheme();
|
|
188
188
|
const m = theme.material;
|
|
189
189
|
const bar = useContext(BarItemContext);
|
|
@@ -219,13 +219,13 @@ function AndroidControl({ options, value, select, keys, disabled, block, equal,
|
|
|
219
219
|
styles.androidRow,
|
|
220
220
|
{ height, borderRadius: height / 2, backgroundColor: barSurface(m, theme.scheme), boxShadow: barShadow(theme.scheme) },
|
|
221
221
|
block ? styles.stretch : null,
|
|
222
|
-
], children: [frame ? (_jsx(Animated.View, { pointerEvents: "none", style: [styles.androidPill, { height: inner, borderRadius: inner / 2, backgroundColor: withAlpha(m.primary, 0.12), left: x, width }] })) : null, options.map((option) => (_jsx(AndroidSegment, { option: option, selected: option.value === value, off: disabled || !!option.disabled, framed: frame, showBadges: showBadges, height: inner,
|
|
222
|
+
], children: [frame ? (_jsx(Animated.View, { pointerEvents: "none", style: [styles.androidPill, { height: inner, borderRadius: inner / 2, backgroundColor: withAlpha(m.primary, 0.12), left: x, width }] })) : null, options.map((option) => (_jsx(AndroidSegment, { option: option, selected: option.value === value, off: disabled || !!option.disabled, framed: frame, showBadges: showBadges, badgeColor: badgeColor, height: inner,
|
|
223
223
|
// In a filled row equal segments share the width and the others take their label and share what is left; a
|
|
224
224
|
// control that hugs its segments gives equal ones the widest one's width
|
|
225
225
|
size: block ? (equal ? styles.grow : styles.share) : widest ? { minWidth: widest } : null, keys: keys, select: select, onWidth: (w) => setWidths((prev) => (prev[option.value] === w ? prev : { ...prev, [option.value]: w })) }, option.value)))] }));
|
|
226
226
|
}
|
|
227
227
|
/** One segment of the capsule: its label turns from the gray to the accent as the pill comes, and back as it goes. */
|
|
228
|
-
function AndroidSegment({ option, selected, off, framed, showBadges, height, size, keys, select, onWidth }) {
|
|
228
|
+
function AndroidSegment({ option, selected, off, framed, showBadges, badgeColor, height, size, keys, select, onWidth }) {
|
|
229
229
|
const theme = useTheme();
|
|
230
230
|
const m = theme.material;
|
|
231
231
|
const [tint] = useState(() => new Animated.Value(selected ? 1 : 0));
|
|
@@ -251,14 +251,15 @@ function AndroidSegment({ option, selected, off, framed, showBadges, height, siz
|
|
|
251
251
|
selected && !framed ? { backgroundColor: withAlpha(m.primary, 0.12) } : null,
|
|
252
252
|
], children: [isRenderable(option.icon) ? (_jsx(IconDefaultsProvider, { size: 20, color: color, children: option.icon })) : null, isRenderable(option.children) ? (
|
|
253
253
|
// An Animated text, so its color can blend: the face, size and tracking of the kit's Text
|
|
254
|
-
_jsx(Animated.Text, { numberOfLines: 1, style: [textStyle(theme, { weight: "medium" }), { fontSize: 14, lineHeight: 20, letterSpacing: theme.tracking(14), color: label }], children: option.children })) : null, showBadges ? _jsx(SegmentCount, { badge: option.badge, selected: selected, off: off }) : null] }));
|
|
254
|
+
_jsx(Animated.Text, { numberOfLines: 1, style: [textStyle(theme, { weight: "medium" }), { fontSize: 14, lineHeight: 20, letterSpacing: theme.tracking(14), color: label }], children: option.children })) : null, showBadges ? _jsx(SegmentCount, { badge: option.badge, selected: selected, off: off, color: badgeColor }) : null] }));
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
257
257
|
* A tab's count drawn after its label (`showBadges`): a capsule 18 tall, the digits 12 semibold in the screen's color.
|
|
258
258
|
* iOS: the label's color on the selected segment, so it reads on the thumb, the secondary label on the others.
|
|
259
|
-
* Android: the accent on the selected segment, as its label, the gray on the others.
|
|
259
|
+
* Android: the accent on the selected segment, as its label, the gray on the others. `accent`: the accent's capsule and
|
|
260
|
+
* white digits on every segment, on both platforms.
|
|
260
261
|
*/
|
|
261
|
-
function SegmentCount({ badge, selected, off }) {
|
|
262
|
+
function SegmentCount({ badge, selected, off, color }) {
|
|
262
263
|
const theme = useTheme();
|
|
263
264
|
const text = badge != null ? badgeText(badge) : undefined;
|
|
264
265
|
if (!text)
|
|
@@ -266,16 +267,19 @@ function SegmentCount({ badge, selected, off }) {
|
|
|
266
267
|
// iOS: the label's color in a capsule, the bar's ink in it; Android: the segment's own ink, the selected one's
|
|
267
268
|
// container in it (onSecondaryContainer on secondaryContainer), the others' onSurfaceVariant on the surface, so the
|
|
268
269
|
// small digits keep their contrast
|
|
270
|
+
const accent = color === "accent";
|
|
269
271
|
const fill = off
|
|
270
272
|
? theme.color("--alpha-20")
|
|
271
|
-
:
|
|
272
|
-
?
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
:
|
|
278
|
-
|
|
273
|
+
: accent
|
|
274
|
+
? theme.color("--color-background-accent-solid")
|
|
275
|
+
: theme.isAndroid
|
|
276
|
+
? selected
|
|
277
|
+
? theme.material.onSecondaryContainer
|
|
278
|
+
: theme.material.onSurfaceVariant
|
|
279
|
+
: selected
|
|
280
|
+
? theme.colors.text
|
|
281
|
+
: theme.colors.labelSecondary;
|
|
282
|
+
const ink = accent && !off ? theme.color("--color-text-accent-solid", "#FFFFFF") : theme.isAndroid ? (selected ? theme.material.secondaryContainer : theme.material.surface) : theme.colors.background;
|
|
279
283
|
return (_jsx(View, { "aria-hidden": true, style: [styles.count, { backgroundColor: fill }], children: _jsx(Text, { numberOfLines: 1, weight: "semibold", color: ink, style: styles.countText, children: text }) }));
|
|
280
284
|
}
|
|
281
285
|
export const SegmentedControl = Object.assign(SegmentedControlRoot, { Tab: SegmentedControlTab, Option: SegmentedControlTab });
|
|
@@ -77,13 +77,14 @@ export function Select(props) {
|
|
|
77
77
|
const hold = useContext(RowHoldContext);
|
|
78
78
|
const rowEnd = row != null;
|
|
79
79
|
const inRow = rowEnd && !android;
|
|
80
|
-
// At the end of an Android row the select is the row's value, as in an Android value row
|
|
81
|
-
// on the row opens its choice
|
|
80
|
+
// At the end of an Android row the select is the row's value, as in an Android value row. On both platforms a press
|
|
81
|
+
// anywhere on the row opens its choice, as Settings' menu-picker row opens from the whole row on iOS; the row hands
|
|
82
|
+
// its press to the select, which stays the one element for a screen reader
|
|
82
83
|
const androidRow = rowEnd && android;
|
|
83
84
|
// Alone in a row whose label is hidden (a label-hidden `Field row`): the value from the row's text start and the
|
|
84
85
|
// chevrons at its end, on the row's line
|
|
85
86
|
const stacked = row?.stacked === true && block;
|
|
86
|
-
const handRow =
|
|
87
|
+
const handRow = rowEnd && !disabled ? row?.press : undefined;
|
|
87
88
|
useEffect(() => {
|
|
88
89
|
if (!handRow)
|
|
89
90
|
return;
|
|
@@ -107,7 +108,7 @@ export function Select(props) {
|
|
|
107
108
|
// The arrow sits in Compose's trailing icon slot, 12 from the edge
|
|
108
109
|
style: [styles.box, inRow ? styles.row : androidRow ? null : [look.box, { gap: look.gap }], android && !androidRow ? { paddingEnd: 12 } : null, stacked ? styles.stacked : null], children: [android && !androidRow ? _jsx(FieldOutline, { frame: look.frame }) : null, androidRow ? (
|
|
109
110
|
// A value row's value: 16sp in the accent, the placeholder in the hint's gray, faded to half when disabled
|
|
110
|
-
_jsx(Text, { numberOfLines: 1, color: withAlpha(shownLabel != null ? m.primary : withAlpha(m.onSurface, 0.35), disabled ? 0.5 : 1), style: [stacked ? styles.grow : styles.shrink, styles.androidValue, stacked ? styles.startText : null], children: shownLabel ?? placeholder })) : inRow ? (_jsx(Text, { numberOfLines: 1, color: shownLabel != null && !disabled ? theme.colors.labelSecondary : tertiary, style: [stacked ? styles.grow : styles.shrink, { fontSize: theme.length("--field-row-label-font-size", 17), lineHeight: theme.length("--field-row-label-line-height", 22) }], children: shownLabel ?? placeholder })) : (_jsx(Text, { numberOfLines: 1, color: shownLabel != null ? look.text.color : look.placeholder, style: [styles.grow, { fontSize: look.text.fontSize, lineHeight: look.text.lineHeight }], children: shownLabel ?? placeholder })), inRow ? (
|
|
111
|
+
_jsx(Text, { numberOfLines: 1, color: withAlpha(shownLabel != null ? (row?.valueColor === "secondary" ? m.onSurfaceVariant : m.primary) : withAlpha(m.onSurface, 0.35), disabled ? 0.5 : 1), style: [stacked ? styles.grow : styles.shrink, styles.androidValue, stacked ? styles.startText : null], children: shownLabel ?? placeholder })) : inRow ? (_jsx(Text, { numberOfLines: 1, color: shownLabel != null && !disabled ? (row?.valueColor === "accent" ? theme.colors.accent : theme.colors.labelSecondary) : tertiary, style: [stacked ? styles.grow : styles.shrink, { fontSize: theme.length("--field-row-label-font-size", 17), lineHeight: theme.length("--field-row-label-line-height", 22) }], children: shownLabel ?? placeholder })) : (_jsx(Text, { numberOfLines: 1, color: shownLabel != null ? look.text.color : look.placeholder, style: [styles.grow, { fontSize: look.text.fontSize, lineHeight: look.text.lineHeight }], children: shownLabel ?? placeholder })), inRow ? (
|
|
111
112
|
// The menu picker's chevrons, 8.5 by 22 with the 17 symbol overflowing it, 2 inside the row's end
|
|
112
113
|
_jsx(View, { style: styles.rowChevrons, children: _jsx(ChevronUpDown, { size: 17, color: disabled ? tertiary : theme.color("--mobile-accessory-secondary", theme.colors.labelSecondary) }) })) : androidRow ? null : android ? (
|
|
113
114
|
// Turned about the box's center while the picker is open, as Compose rotates its trailing icon 180°
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
3
|
import { Animated, Easing, StyleSheet, View } from "react-native";
|
|
4
4
|
import { Pressable } from "../../internal/Pressable";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
@@ -70,7 +70,14 @@ function IOSTab({ value, label, icon, badge, badgeColor, disabled = false, onPre
|
|
|
70
70
|
// A minimized tab takes the touches of its whole 48pt circle, not only its 40pt face
|
|
71
71
|
hitSlop: collapsed ? capsulePadding : undefined,
|
|
72
72
|
// A tab bar's labels keep their size, as UIKit's: a large text size shows the tab in the large content viewer
|
|
73
|
-
accessibilityShowsLargeContentViewer: true, accessibilityLargeContentTitle: textOf(label) || undefined,
|
|
73
|
+
accessibilityShowsLargeContentViewer: true, accessibilityLargeContentTitle: textOf(label) || undefined, onLayout:
|
|
74
|
+
// An expanded tab only: a minimized one's 40pt face is not where the pill goes when the bar expands
|
|
75
|
+
!circle && !collapsed && context.onTabLayout
|
|
76
|
+
? (event) => {
|
|
77
|
+
const { y, width, height } = event.nativeEvent.layout;
|
|
78
|
+
context.onTabLayout?.(value, { y, width, height });
|
|
79
|
+
}
|
|
80
|
+
: undefined, style: [styles.iosItem, size, circle ? null : { flexShrink: 1, minWidth: 0 }], children: [selected && !collapsed && (circle || context.slidingPill !== value) ? _jsx(View, { pointerEvents: "none", style: [styles.pill, pill, { backgroundColor: theme.color("--tab-bar-item-background-selected") }] }) : null, _jsx(View, { style: [styles.iosIcon, { height: theme.length("--tab-bar-icon-box", 28) }], children: _jsx(IconDefaultsProvider, { size: theme.length("--tab-bar-icon-size", 28), color: color, children: icon }) }), showLabel ? (_jsx(Text, { numberOfLines: 1, allowFontScaling: false, weight: "semibold", color: color, style: { fontSize: theme.length("--tab-bar-label-font-size", 10), lineHeight: theme.length("--tab-bar-label-line-height", 12), maxWidth: "100%" }, children: label })) : null, hasBadge(badge) && !circle ? (_jsx(View, { pointerEvents: "none", style: [styles.iosBadge, iosBadgeStyle(theme, badgeColor ?? context.badgeColor), { top: badgeTop, marginLeft: badgeStart }], children: badge === true ? null : (_jsx(Text, { color: (badgeColor ?? context.badgeColor) === "accent" ? theme.color("--color-text-accent-solid", "#FFFFFF") : theme.color("--tab-bar-badge-color"), style: iosBadgeText(theme), numberOfLines: 1, allowFontScaling: false, children: badge })) })) : null] }));
|
|
74
81
|
}
|
|
75
82
|
const iosBadgeStyle = (theme, color) => {
|
|
76
83
|
const size = theme.length("--tab-bar-badge-size", 18);
|
|
@@ -346,7 +353,61 @@ function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, pro
|
|
|
346
353
|
const visible = shown.length ? shown : capsuleTabs.slice(0, 1);
|
|
347
354
|
const reachable = [...visible, ...(circle ? [circle] : [])];
|
|
348
355
|
const keys = useTabKeys(reachable, value, select);
|
|
349
|
-
|
|
356
|
+
// iOS 26 slides the selection to the new tab: one pill in the capsule, under the tabs, moving from tab to tab
|
|
357
|
+
const [frames, setFrames] = useState({});
|
|
358
|
+
const onTabLayout = useCallback((tab, next) => {
|
|
359
|
+
setFrames((current) => {
|
|
360
|
+
const prev = current[tab];
|
|
361
|
+
return prev && prev.y === next.y && prev.width === next.width && prev.height === next.height ? current : { ...current, [tab]: next };
|
|
362
|
+
});
|
|
363
|
+
}, []);
|
|
364
|
+
// The pill's place from the start of the capsule: its padding and the widths of the tabs before it, in their order
|
|
365
|
+
// (a reorder moves it with no resize to report; the start edge, so a right-to-left bar mirrors it as its tabs)
|
|
366
|
+
const capsuleInline = theme.length("--tab-bar-capsule-padding-inline", 10);
|
|
367
|
+
const selectedIndex = value != null && !minimized ? visible.findIndex((tab) => tab.value === value) : -1;
|
|
368
|
+
const before = selectedIndex >= 0 ? visible.slice(0, selectedIndex) : [];
|
|
369
|
+
const frame = selectedIndex >= 0 && theme.isIOS ? frames[visible[selectedIndex].value] : undefined;
|
|
370
|
+
const pillFrame = frame && before.every((tab) => frames[tab.value] != null)
|
|
371
|
+
? { ...frame, x: capsuleInline + before.reduce((sum, tab) => sum + frames[tab.value].width, 0) }
|
|
372
|
+
: undefined;
|
|
373
|
+
const context = {
|
|
374
|
+
value,
|
|
375
|
+
badgeColor,
|
|
376
|
+
minimized,
|
|
377
|
+
select,
|
|
378
|
+
expand,
|
|
379
|
+
keys,
|
|
380
|
+
onTabLayout: theme.isIOS ? onTabLayout : undefined,
|
|
381
|
+
slidingPill: pillFrame ? value : undefined,
|
|
382
|
+
};
|
|
383
|
+
const pillOutset = theme.length("--tab-bar-pill-outset", 6);
|
|
384
|
+
const [pillX] = useState(() => new Animated.Value(0));
|
|
385
|
+
const [pillWidth] = useState(() => new Animated.Value(0));
|
|
386
|
+
const pillShown = useRef(false);
|
|
387
|
+
const pillLeft = pillFrame ? pillFrame.x - pillOutset : undefined;
|
|
388
|
+
const pillSpan = pillFrame ? pillFrame.width + 2 * pillOutset : undefined;
|
|
389
|
+
// Before the paint, so the pill never shows a frame at its old place or at 0
|
|
390
|
+
useLayoutEffect(() => {
|
|
391
|
+
if (pillLeft == null || pillSpan == null) {
|
|
392
|
+
pillShown.current = false;
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
// It appears in place (the first frame, back from a minimized bar or the circle's tab), then slides: CSS `ease`
|
|
396
|
+
// over 300ms, as SegmentedControl's thumb
|
|
397
|
+
if (!pillShown.current || theme.reducedMotion) {
|
|
398
|
+
pillX.setValue(pillLeft);
|
|
399
|
+
pillWidth.setValue(pillSpan);
|
|
400
|
+
pillShown.current = true;
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const easing = Easing.bezier(0.25, 0.1, 0.25, 1);
|
|
404
|
+
const animation = Animated.parallel([
|
|
405
|
+
Animated.timing(pillX, { toValue: pillLeft, duration: 300, easing, useNativeDriver: false }),
|
|
406
|
+
Animated.timing(pillWidth, { toValue: pillSpan, duration: 300, easing, useNativeDriver: false }),
|
|
407
|
+
]);
|
|
408
|
+
animation.start();
|
|
409
|
+
return () => animation.stop();
|
|
410
|
+
}, [pillLeft, pillSpan, theme.reducedMotion, pillX, pillWidth]);
|
|
350
411
|
if (theme.isAndroid) {
|
|
351
412
|
return (_jsx(TabBarContext.Provider, { value: context, children: _jsx(AndroidBar, { context: context, tabs: capsuleTabs, circle: circle, accent: !!prominentTab, accessory: accessory, background: background, scrolled: scrolled, canvasColor: canvasColor, safeArea: safeArea, ariaLabel: ariaLabel, rest: rest, style: style }) }));
|
|
352
413
|
}
|
|
@@ -376,7 +437,10 @@ function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, pro
|
|
|
376
437
|
{ paddingTop: padTop + (accessory ? accessoryHeight + accessoryGap : 0), paddingBottom },
|
|
377
438
|
physicalPadding(sideLeft, sideRight),
|
|
378
439
|
style,
|
|
379
|
-
], children: [backdrop, accessory ? (_jsx(Glass, { radius: accessoryHeight / 2, elevation: "raised", style: [styles.accessory, accessoryPlace], children: accessory }, "accessory")) : null, _jsxs(View, { style: [styles.iosRow, { gap: theme.length("--tab-bar-gap", 8), justifyContent: circle || minimized ? "space-between" : "center" }], children: [
|
|
440
|
+
], children: [backdrop, accessory ? (_jsx(Glass, { radius: accessoryHeight / 2, elevation: "raised", style: [styles.accessory, accessoryPlace], children: accessory }, "accessory")) : null, _jsxs(View, { style: [styles.iosRow, { gap: theme.length("--tab-bar-gap", 8), justifyContent: circle || minimized ? "space-between" : "center" }], children: [_jsxs(Glass, { radius: 999, elevation: "raised", style: [styles.capsule, minimized ? { padding: capsulePadding } : { paddingVertical: capsulePadding, paddingHorizontal: theme.length("--tab-bar-capsule-padding-inline", 10) }], children: [pillFrame ? (_jsx(Animated.View, { pointerEvents: "none", style: [
|
|
441
|
+
styles.pill,
|
|
442
|
+
{ top: pillFrame.y, height: pillFrame.height, start: pillX, width: pillWidth, backgroundColor: theme.color("--tab-bar-item-background-selected") },
|
|
443
|
+
] })) : null, visible.map((tab) => (_jsx(Tab, { ...tab, context: context }, tab.value)))] }), circle ? (_jsx(Glass, { radius: circleSize / 2, elevation: "raised", style: { width: circleSize, height: circleSize }, children: _jsx(Tab, { ...circle, context: { ...context, minimized: false }, kind: "circle", hideLabel: true }) })) : null] })] }) }));
|
|
380
444
|
}
|
|
381
445
|
TabBarRoot.displayName = "TabBar";
|
|
382
446
|
export const TabBar = Object.assign(TabBarRoot, { Item: TabBarItem });
|
|
@@ -70,9 +70,13 @@ export function Glass({ radius = 0, elevation = "regular", tint, interactive, fi
|
|
|
70
70
|
const filterName = filterToken ?? surface?.filter ?? "--mobile-glass-backdrop-filter";
|
|
71
71
|
const dense = web && !theme.isAndroid ? WEB_DENSE[fillName] : undefined;
|
|
72
72
|
const denseFill = dense != null && tint == null && overrides?.[fillName] == null;
|
|
73
|
-
|
|
73
|
+
// Glass with a fill of its own and the plain glass's filter (the large segmented control) blurs as the plain glass
|
|
74
|
+
// does on the web, so a brand's --mobile-glass-web-backdrop-filter reaches it too
|
|
75
|
+
const plainFilter = web && !theme.isAndroid && dense == null && filterToken == null && filterName === "--mobile-glass-backdrop-filter" && overrides?.[filterName] == null;
|
|
76
|
+
const denseFilter = (dense != null && filterToken == null && overrides?.[filterName] == null) || plainFilter;
|
|
77
|
+
const webFilter = dense ?? WEB_DENSE["--mobile-glass-background"];
|
|
74
78
|
const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName));
|
|
75
|
-
const filterValue = denseFilter ? (theme.token(
|
|
79
|
+
const filterValue = denseFilter ? (theme.token(webFilter.filter) ?? webFilter.blur) : theme.token(filterName);
|
|
76
80
|
const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : "blur(12px)";
|
|
77
81
|
const module = web || Platform.OS !== "ios" ? null : blurModule();
|
|
78
82
|
const opaque = reduceTransparency || (!web && module == null);
|
|
@@ -19,6 +19,12 @@ export type BottomSheetProps = {
|
|
|
19
19
|
* @default "Close"
|
|
20
20
|
*/
|
|
21
21
|
closeLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The sheet's height, as an iOS sheet's detent: `content`, as tall as its content; `medium`, half the screen;
|
|
24
|
+
* `large`, as tall as a sheet goes; or a height in points. A sheet of a fixed height keeps it while its content
|
|
25
|
+
* changes (pages that open inside it), its content scrolling within. @default "content"
|
|
26
|
+
*/
|
|
27
|
+
detent?: "content" | "medium" | "large" | number;
|
|
22
28
|
};
|
|
23
29
|
export type BottomSheetFooterProps = {
|
|
24
30
|
/** The actions, top to bottom: on iOS the main one first, as a setup sheet sets them. */
|
|
@@ -40,7 +46,7 @@ type SheetExit = {
|
|
|
40
46
|
};
|
|
41
47
|
declare function BottomSheetRoot(props: BottomSheetProps): import("react").JSX.Element;
|
|
42
48
|
/** The sheet with an exit of its own (ActionSheet's item tap); not part of the public API. */
|
|
43
|
-
export declare function BottomSheetBase({ open, onOpenChange, title, children, dismissible, "aria-label": ariaLabel, testID, contentStyle, closeLabel, exit, onExited, }: BottomSheetProps & SheetExit): import("react").JSX.Element;
|
|
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;
|
|
44
50
|
/**
|
|
45
51
|
* A sheet from the bottom edge: on iOS 26 the sheet of the phone layer (`--dialog-sheet-radius` 38 on its top corners,
|
|
46
52
|
* a bar 16 under its top edge with Close at the leading edge and the title centered, as the web's phone Sheet; no
|
|
@@ -70,6 +70,11 @@ export type ListItemProps = {
|
|
|
70
70
|
leadingColor?: string;
|
|
71
71
|
/** A value at the end, in the secondary label on iOS (`Wi-Fi … Home`) and the accent on Android. */
|
|
72
72
|
value?: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* The value's color, and a select's at the row's end: `secondary`, the secondary label, as iOS draws it; `accent`, as
|
|
75
|
+
* an Android value row draws it. @default "secondary" on iOS, "accent" on Android
|
|
76
|
+
*/
|
|
77
|
+
valueColor?: "secondary" | "accent";
|
|
73
78
|
/**
|
|
74
79
|
* Where the value stands: at the `end` of the row, `below` the label at the full width of the text, or `auto`: at
|
|
75
80
|
* the end while the label and the value fit beside each other on one line, otherwise below (as Calendar sets a long
|
|
@@ -121,7 +126,7 @@ export type ListItemProps = {
|
|
|
121
126
|
* in (a multi-select list); a 1px divider from the text's start to the card's end, none under a row with a tile (a
|
|
122
127
|
* tiled row draws none).
|
|
123
128
|
*/
|
|
124
|
-
export declare function ListItem({ label, description, leading, leadingColor, value, valuePlacement, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, disabled, destructive, accessibilityLabel, testID, }: ListItemProps): import("react").JSX.Element;
|
|
129
|
+
export declare function ListItem({ label, description, leading, leadingColor, value, valuePlacement, valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, disabled, destructive, accessibilityLabel, testID, }: ListItemProps): import("react").JSX.Element;
|
|
125
130
|
export type StackedRowProps = {
|
|
126
131
|
/** The label over the value; none for a row whose placeholder names the field (`hideLabel`). */
|
|
127
132
|
label?: ReactNode;
|
|
@@ -40,6 +40,13 @@ export type SegmentedControlProps<T extends string> = {
|
|
|
40
40
|
* count. Off, the count is only read with the segment's name, as the native controls draw none. @default false
|
|
41
41
|
*/
|
|
42
42
|
showBadges?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The drawn counts' color. `label`: the label's on the selected segment, the secondary one on the others (Android:
|
|
45
|
+
* the selected segment's ink, the gray on the others), so a count changes with the selection. `accent`: one accent
|
|
46
|
+
* capsule with white digits on every segment, as TabBar's `badgeColor="accent"`, the same whichever is selected.
|
|
47
|
+
* @default "label"
|
|
48
|
+
*/
|
|
49
|
+
badgeColor?: "label" | "accent";
|
|
43
50
|
style?: StyleProp<ViewStyle>;
|
|
44
51
|
testID?: string;
|
|
45
52
|
/** `SegmentedControl.Tab` elements. */
|
|
@@ -78,7 +85,7 @@ declare namespace SegmentedControlTab {
|
|
|
78
85
|
* iOS 26 apps (48pt; 40 in a Toolbar.Row), its thumb sliding to the selection; on Android a segmented capsule, white
|
|
79
86
|
* with a sliding pill of the accent. Props follow @plexui/ui (`SegmentedControl` and `SegmentedControl.Tab`).
|
|
80
87
|
*/
|
|
81
|
-
declare function SegmentedControlRoot<T extends string>({ value, onChange, onClick, "aria-label": ariaLabel, size, disabled, block, mobileMaterial, mobileSegmentWidth, showBadges, style, testID, children, }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
88
|
+
declare function SegmentedControlRoot<T extends string>({ value, onChange, onClick, "aria-label": ariaLabel, size, disabled, block, mobileMaterial, mobileSegmentWidth, showBadges, badgeColor, style, testID, children, }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
82
89
|
declare namespace SegmentedControlRoot {
|
|
83
90
|
var displayName: string;
|
|
84
91
|
}
|
|
@@ -22,6 +22,8 @@ export type RowEnd = {
|
|
|
22
22
|
* tall as its lines.
|
|
23
23
|
*/
|
|
24
24
|
stacked?: boolean;
|
|
25
|
+
/** The row's value color, which a select at its end takes for its value. @default the platform's */
|
|
26
|
+
valueColor?: "secondary" | "accent";
|
|
25
27
|
};
|
|
26
28
|
/**
|
|
27
29
|
* Inside the end of a List row. On iOS a control there takes the row's look, as the web's controls in a `[data-row]` do.
|
package/package.json
CHANGED
|
@@ -30,6 +30,12 @@ export type BottomSheetProps = {
|
|
|
30
30
|
* @default "Close"
|
|
31
31
|
*/
|
|
32
32
|
closeLabel?: string
|
|
33
|
+
/**
|
|
34
|
+
* The sheet's height, as an iOS sheet's detent: `content`, as tall as its content; `medium`, half the screen;
|
|
35
|
+
* `large`, as tall as a sheet goes; or a height in points. A sheet of a fixed height keeps it while its content
|
|
36
|
+
* changes (pages that open inside it), its content scrolling within. @default "content"
|
|
37
|
+
*/
|
|
38
|
+
detent?: "content" | "medium" | "large" | number
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
export type BottomSheetFooterProps = {
|
|
@@ -213,6 +219,7 @@ export function BottomSheetBase({
|
|
|
213
219
|
testID,
|
|
214
220
|
contentStyle,
|
|
215
221
|
closeLabel = "Close",
|
|
222
|
+
detent = "content",
|
|
216
223
|
exit,
|
|
217
224
|
onExited,
|
|
218
225
|
}: BottomSheetProps & SheetExit) {
|
|
@@ -257,6 +264,9 @@ export function BottomSheetBase({
|
|
|
257
264
|
: { accessibilityViewIsModal: true, "aria-label": ariaLabel }
|
|
258
265
|
// Android's sheet stands under the status bar at most; the phone layer's 16 under the top inset
|
|
259
266
|
const maxHeight = screen - insets.top - (android ? 0 : 16)
|
|
267
|
+
// A detent holds the sheet's height whatever its content: half the screen, the most it takes, or a height
|
|
268
|
+
const fixedHeight =
|
|
269
|
+
detent === "large" ? maxHeight : detent === "medium" ? Math.min(Math.round(screen / 2), maxHeight) : typeof detent === "number" ? Math.min(detent, maxHeight) : undefined
|
|
260
270
|
// Android's sheet is as wide as the screen in portrait; in landscape 80% of it and 480dp at least
|
|
261
271
|
const maxWidth = android && width > screen ? Math.max(width * 0.8, Math.min(480, width)) : undefined
|
|
262
272
|
const closeSize = theme.length("--dialog-sheet-close-size", 44)
|
|
@@ -350,6 +360,8 @@ export function BottomSheetBase({
|
|
|
350
360
|
styles.sheet,
|
|
351
361
|
{
|
|
352
362
|
maxHeight,
|
|
363
|
+
// A fixed sheet grows by the keyboard it stands over, within the screen, so its content keeps its room
|
|
364
|
+
height: fixedHeight == null ? undefined : Math.min(fixedHeight + keyboard, maxHeight),
|
|
353
365
|
maxWidth,
|
|
354
366
|
borderTopLeftRadius: radius,
|
|
355
367
|
borderTopRightRadius: radius,
|
|
@@ -366,7 +378,8 @@ export function BottomSheetBase({
|
|
|
366
378
|
{/* Content taller than the screen scrolls; on iOS the drag stays on the bar, on Android it starts at the
|
|
367
379
|
content's top */}
|
|
368
380
|
<ScrollView
|
|
369
|
-
|
|
381
|
+
// A sheet of a fixed height gives its content the room left, so a footer stays at its bottom
|
|
382
|
+
style={[styles.scroll, fixedHeight != null ? styles.grow : null]}
|
|
370
383
|
{...(android
|
|
371
384
|
? {
|
|
372
385
|
...gesture.content,
|
|
@@ -479,6 +492,7 @@ const styles = StyleSheet.create({
|
|
|
479
492
|
bottom: { flex: 1, justifyContent: "flex-end", alignItems: "center" },
|
|
480
493
|
sheet: { alignSelf: "stretch", overflow: "hidden", borderCurve: "continuous", marginHorizontal: "auto", width: "100%" },
|
|
481
494
|
scroll: { flexGrow: 0, flexShrink: 1 },
|
|
495
|
+
grow: { flexGrow: 1 },
|
|
482
496
|
iosBar: { flexDirection: "row", alignItems: "center", gap: 8 },
|
|
483
497
|
iosHeading: { flex: 1, alignItems: "center", justifyContent: "center" },
|
|
484
498
|
scrimTarget: { position: "absolute", top: 0, left: 0, right: 0 },
|
|
@@ -300,6 +300,11 @@ export type ListItemProps = {
|
|
|
300
300
|
leadingColor?: string
|
|
301
301
|
/** A value at the end, in the secondary label on iOS (`Wi-Fi … Home`) and the accent on Android. */
|
|
302
302
|
value?: ReactNode
|
|
303
|
+
/**
|
|
304
|
+
* The value's color, and a select's at the row's end: `secondary`, the secondary label, as iOS draws it; `accent`, as
|
|
305
|
+
* an Android value row draws it. @default "secondary" on iOS, "accent" on Android
|
|
306
|
+
*/
|
|
307
|
+
valueColor?: "secondary" | "accent"
|
|
303
308
|
/**
|
|
304
309
|
* Where the value stands: at the `end` of the row, `below` the label at the full width of the text, or `auto`: at
|
|
305
310
|
* the end while the label and the value fit beside each other on one line, otherwise below (as Calendar sets a long
|
|
@@ -359,6 +364,7 @@ export function ListItem({
|
|
|
359
364
|
leadingColor,
|
|
360
365
|
value,
|
|
361
366
|
valuePlacement = "end",
|
|
367
|
+
valueColor,
|
|
362
368
|
trailing,
|
|
363
369
|
error,
|
|
364
370
|
checked: checkedProp,
|
|
@@ -406,10 +412,16 @@ export function ListItem({
|
|
|
406
412
|
// A control at the end that opens from the row (`RowEnd.press`) gets the row's press, as it gets a toggle's; it stays
|
|
407
413
|
// the one element for a screen reader and the keyboard
|
|
408
414
|
const [endPress, setEndPress] = useState<(() => void) | null>(null)
|
|
409
|
-
|
|
415
|
+
// Once a control has handed the row its press the row stays a pressable frame, so taking the press back (a select
|
|
416
|
+
// disabled) does not swap the frame and remount the row's contents with their state
|
|
417
|
+
const [endHands, setEndHands] = useState(false)
|
|
418
|
+
const handPress = useCallback((open: (() => void) | null) => {
|
|
419
|
+
setEndPress(() => open)
|
|
420
|
+
if (open != null) setEndHands(true)
|
|
421
|
+
}, [])
|
|
410
422
|
const handed = !switchRow && !onPress && !control && !disabled ? endPress : null
|
|
411
423
|
const press = switchRow ? toggle : (onPress ?? control?.toggle ?? handed ?? undefined)
|
|
412
|
-
const endOwnsFocus = control != null || handed != null
|
|
424
|
+
const endOwnsFocus = control != null || handed != null || (endHands && press == null)
|
|
413
425
|
// A destructive row is an action, not a page (Settings' Sign Out has no chevron)
|
|
414
426
|
const chevron = disclosure ?? (!!onPress && !switchRow && trailing == null && !destructive)
|
|
415
427
|
const name = accessibilityLabel ?? ([textOf(label), textOf(value)].filter(Boolean).join(", ") || undefined)
|
|
@@ -449,14 +461,14 @@ export function ListItem({
|
|
|
449
461
|
return (
|
|
450
462
|
<RowFrameContext.Provider value={frame}>
|
|
451
463
|
{theme.isAndroid ? (
|
|
452
|
-
<AndroidContent handPress={handPress} theme={theme} label={label} description={description} descriptionId={described.id} leading={start} leadingColor={startColor} leadingMark={atStart != null || checkLeads} value={value} valuePlacement={valuePlacement} trailing={end} edgeControl={found != null || switchRow} error={error} disabled={disabled} destructive={destructive} last={last} />
|
|
464
|
+
<AndroidContent handPress={handPress} valueColor={valueColor ?? "accent"} theme={theme} label={label} description={description} descriptionId={described.id} leading={start} leadingColor={startColor} leadingMark={atStart != null || checkLeads} value={value} valuePlacement={valuePlacement} trailing={end} edgeControl={found != null || switchRow} error={error} disabled={disabled} destructive={destructive} last={last} />
|
|
453
465
|
) : (
|
|
454
|
-
<IOSContent theme={theme} label={label} description={description} descriptionId={described.id} leading={start} leadingColor={startColor} value={value} valuePlacement={valuePlacement} trailing={end} edgeControl={found != null || switchRow} error={error} chevron={chevron} disabled={disabled} destructive={destructive} last={last} />
|
|
466
|
+
<IOSContent handPress={handPress} valueColor={valueColor ?? "secondary"} theme={theme} label={label} description={description} descriptionId={described.id} leading={start} leadingColor={startColor} value={value} valuePlacement={valuePlacement} trailing={end} edgeControl={found != null || switchRow} error={error} chevron={chevron} disabled={disabled} destructive={destructive} last={last} />
|
|
455
467
|
)}
|
|
456
468
|
</RowFrameContext.Provider>
|
|
457
469
|
)
|
|
458
470
|
}
|
|
459
|
-
if (press || onLongPress) {
|
|
471
|
+
if (press || onLongPress || endHands) {
|
|
460
472
|
// Android's rows press in the list selector: the native ripple on a device, the drawn one on the web
|
|
461
473
|
const highlight = controlHighlight(theme.scheme)
|
|
462
474
|
const drawn = theme.isAndroid && !nativeRipple
|
|
@@ -474,7 +486,7 @@ export function ListItem({
|
|
|
474
486
|
accessibilityLabel={endOwnsFocus ? undefined : name}
|
|
475
487
|
accessibilityState={endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }}
|
|
476
488
|
aria-checked={switchRow ? checked : undefined}
|
|
477
|
-
disabled={disabled}
|
|
489
|
+
disabled={disabled || (press == null && onLongPress == null)}
|
|
478
490
|
onPress={press}
|
|
479
491
|
onLongPress={onLongPress}
|
|
480
492
|
delayLongPress={onLongPress ? 500 : undefined}
|
|
@@ -759,7 +771,7 @@ function useValueBelow(
|
|
|
759
771
|
return { below, probe, onRowLayout: auto ? measure("row") : undefined, onTrailingLayout: auto ? measure("trailing") : undefined }
|
|
760
772
|
}
|
|
761
773
|
|
|
762
|
-
function IOSContent({ theme, label, description, descriptionId, leading, leadingColor, value, valuePlacement, trailing, edgeControl = false, error, chevron, disabled, destructive, last }: ContentProps & { leadingColor?: string; chevron: boolean; last: boolean }) {
|
|
774
|
+
function IOSContent({ handPress, valueColor, theme, label, description, descriptionId, leading, leadingColor, value, valuePlacement, trailing, edgeControl = false, error, chevron, disabled, destructive, last }: ContentProps & { leadingColor?: string; chevron: boolean; last: boolean; handPress: RowEnd["press"]; valueColor: "secondary" | "accent" }) {
|
|
763
775
|
const inset = theme.length("--list-row-inset", 20)
|
|
764
776
|
const tile = theme.length("--field-row-icon-size", 28)
|
|
765
777
|
const gap = theme.length("--field-row-gap", 16)
|
|
@@ -793,7 +805,7 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
793
805
|
// A switch, a checkbox and a radio stay at the row's edge
|
|
794
806
|
const columns = useContext(ListOptionsContext)?.columns === true && trailing != null
|
|
795
807
|
const startsColumn = columns && !edgeControl
|
|
796
|
-
const rowEnd = useMemo<RowEnd>(() => ({ fill: setFill, align: startsColumn ? "start" : "end" }), [startsColumn])
|
|
808
|
+
const rowEnd = useMemo<RowEnd>(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end", valueColor }), [handPress, startsColumn, valueColor])
|
|
797
809
|
const errorOffset = theme.length("--mobile-field-error-offset", 4)
|
|
798
810
|
const errorLine = theme.length("--mobile-field-error-line-height", 20)
|
|
799
811
|
// With an error the label and the control stand on a line of their own over it
|
|
@@ -864,7 +876,7 @@ function IOSContent({ theme, label, description, descriptionId, leading, leading
|
|
|
864
876
|
{value != null && !below ? (
|
|
865
877
|
// A long value wraps within the 60% the end takes, as the web's, rather than losing its end; set at the
|
|
866
878
|
// row's end (a phone turns "right" over in a right-to-left layout itself, the web does not)
|
|
867
|
-
<Text color={secondary} style={[labelType, styles.shrink, { textAlign: Platform.OS === "web" && rtl ? "left" : "right" }]}>
|
|
879
|
+
<Text color={valueColor === "accent" && !disabled ? theme.colors.accent : secondary} style={[labelType, styles.shrink, { textAlign: Platform.OS === "web" && rtl ? "left" : "right" }]}>
|
|
868
880
|
{value}
|
|
869
881
|
</Text>
|
|
870
882
|
) : null}
|
|
@@ -900,6 +912,7 @@ const errorColor = (theme: Theme) => theme.color("--field-error-color", theme.co
|
|
|
900
912
|
|
|
901
913
|
function AndroidContent({
|
|
902
914
|
handPress,
|
|
915
|
+
valueColor,
|
|
903
916
|
theme,
|
|
904
917
|
label,
|
|
905
918
|
description,
|
|
@@ -915,7 +928,7 @@ function AndroidContent({
|
|
|
915
928
|
disabled,
|
|
916
929
|
destructive,
|
|
917
930
|
last,
|
|
918
|
-
}: ContentProps & { leadingColor?: string; leadingMark?: boolean; last: boolean; handPress: RowEnd["press"] }) {
|
|
931
|
+
}: ContentProps & { leadingColor?: string; leadingMark?: boolean; last: boolean; handPress: RowEnd["press"]; valueColor: "secondary" | "accent" }) {
|
|
919
932
|
// A disabled row fades to half, as Android's rows do
|
|
920
933
|
const dim = (color: string) => (disabled ? withAlpha(color, 0.5) : color)
|
|
921
934
|
const danger = dangerText(theme)
|
|
@@ -936,7 +949,7 @@ function AndroidContent({
|
|
|
936
949
|
const [fill, setFill] = useState(false)
|
|
937
950
|
const columns = useContext(ListOptionsContext)?.columns === true && trailing != null
|
|
938
951
|
const startsColumn = columns && !edgeControl
|
|
939
|
-
const rowEnd = useMemo<RowEnd>(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end" }), [handPress, startsColumn])
|
|
952
|
+
const rowEnd = useMemo<RowEnd>(() => ({ fill: setFill, press: handPress, align: startsColumn ? "start" : "end", valueColor }), [handPress, startsColumn, valueColor])
|
|
940
953
|
const parts = (
|
|
941
954
|
<>
|
|
942
955
|
{leading == null ? null : leadingMark ? (
|
|
@@ -972,7 +985,7 @@ function AndroidContent({
|
|
|
972
985
|
) : null}
|
|
973
986
|
</View>
|
|
974
987
|
{value != null && !below ? (
|
|
975
|
-
<Text color={dim(accentText(theme))} numberOfLines={1} style={[styles.androidLabel, styles.androidValue, { marginEnd: valueEnd - ANDROID_INSET }]}>
|
|
988
|
+
<Text color={dim(valueColor === "accent" ? accentText(theme) : theme.material.onSurfaceVariant)} numberOfLines={1} style={[styles.androidLabel, styles.androidValue, { marginEnd: valueEnd - ANDROID_INSET }]}>
|
|
976
989
|
{value}
|
|
977
990
|
</Text>
|
|
978
991
|
) : null}
|
|
@@ -51,6 +51,13 @@ export type SegmentedControlProps<T extends string> = {
|
|
|
51
51
|
* count. Off, the count is only read with the segment's name, as the native controls draw none. @default false
|
|
52
52
|
*/
|
|
53
53
|
showBadges?: boolean
|
|
54
|
+
/**
|
|
55
|
+
* The drawn counts' color. `label`: the label's on the selected segment, the secondary one on the others (Android:
|
|
56
|
+
* the selected segment's ink, the gray on the others), so a count changes with the selection. `accent`: one accent
|
|
57
|
+
* capsule with white digits on every segment, as TabBar's `badgeColor="accent"`, the same whichever is selected.
|
|
58
|
+
* @default "label"
|
|
59
|
+
*/
|
|
60
|
+
badgeColor?: "label" | "accent"
|
|
54
61
|
style?: StyleProp<ViewStyle>
|
|
55
62
|
testID?: string
|
|
56
63
|
/** `SegmentedControl.Tab` elements. */
|
|
@@ -172,6 +179,7 @@ function SegmentedControlRoot<T extends string>({
|
|
|
172
179
|
mobileMaterial,
|
|
173
180
|
mobileSegmentWidth = "equal",
|
|
174
181
|
showBadges = false,
|
|
182
|
+
badgeColor = "label",
|
|
175
183
|
style,
|
|
176
184
|
testID,
|
|
177
185
|
children,
|
|
@@ -192,7 +200,7 @@ function SegmentedControlRoot<T extends string>({
|
|
|
192
200
|
)
|
|
193
201
|
// Drawn counts differ from tab to tab, so each segment takes its own width with them, as a messenger's folder tabs
|
|
194
202
|
const counted = showBadges && options.some((option) => option.badge != null)
|
|
195
|
-
const common = { options, value, select, keys, disabled, block, equal: mobileSegmentWidth === "equal" && !counted, showBadges }
|
|
203
|
+
const common = { options, value, select, keys, disabled, block, equal: mobileSegmentWidth === "equal" && !counted, showBadges, badgeColor }
|
|
196
204
|
return (
|
|
197
205
|
<View accessibilityRole="tablist" aria-label={ariaLabel} accessibilityState={{ disabled }} testID={testID} style={[block ? styles.block : styles.hug, style]}>
|
|
198
206
|
{theme.isAndroid ? <AndroidControl {...common} size={size} /> : <IOSControl {...common} size={size} material={mobileMaterial} />}
|
|
@@ -210,9 +218,10 @@ type ControlProps = {
|
|
|
210
218
|
block: boolean
|
|
211
219
|
equal: boolean
|
|
212
220
|
showBadges: boolean
|
|
221
|
+
badgeColor: "label" | "accent"
|
|
213
222
|
}
|
|
214
223
|
|
|
215
|
-
function IOSControl({ options, value, select, keys, disabled, block, equal, showBadges, size, material }: ControlProps & { size: ControlSize; material?: "glass" | "flat" }) {
|
|
224
|
+
function IOSControl({ options, value, select, keys, disabled, block, equal, showBadges, badgeColor, size, material }: ControlProps & { size: ControlSize; material?: "glass" | "flat" }) {
|
|
216
225
|
const theme = useTheme()
|
|
217
226
|
const inBar = !!useContext(BarItemContext)
|
|
218
227
|
const { inRow } = useContext(SegmentedControlRowContext)
|
|
@@ -326,7 +335,7 @@ function IOSControl({ options, value, select, keys, disabled, block, equal, show
|
|
|
326
335
|
{option.children}
|
|
327
336
|
</Text>
|
|
328
337
|
)}
|
|
329
|
-
{showBadges ? <SegmentCount badge={option.badge} selected={isSelected} off={off} /> : null}
|
|
338
|
+
{showBadges ? <SegmentCount badge={option.badge} selected={isSelected} off={off} color={badgeColor} /> : null}
|
|
330
339
|
</View>
|
|
331
340
|
</Pressable>
|
|
332
341
|
)
|
|
@@ -365,7 +374,7 @@ const ANDROID_MOVE = { duration: 320, easing: curves.easeOutQuint }
|
|
|
365
374
|
* its label in the accent, the others in the secondary gray. The pill slides to a new selection and takes its width.
|
|
366
375
|
* In a bar's row of controls the capsule takes the height of the circles beside it (46dp).
|
|
367
376
|
*/
|
|
368
|
-
function AndroidControl({ options, value, select, keys, disabled, block, equal, showBadges, size }: ControlProps & { size: ControlSize }) {
|
|
377
|
+
function AndroidControl({ options, value, select, keys, disabled, block, equal, showBadges, badgeColor, size }: ControlProps & { size: ControlSize }) {
|
|
369
378
|
const theme = useTheme()
|
|
370
379
|
const m = theme.material
|
|
371
380
|
const bar = useContext(BarItemContext)
|
|
@@ -418,6 +427,7 @@ function AndroidControl({ options, value, select, keys, disabled, block, equal,
|
|
|
418
427
|
off={disabled || !!option.disabled}
|
|
419
428
|
framed={frame}
|
|
420
429
|
showBadges={showBadges}
|
|
430
|
+
badgeColor={badgeColor}
|
|
421
431
|
height={inner}
|
|
422
432
|
// In a filled row equal segments share the width and the others take their label and share what is left; a
|
|
423
433
|
// control that hugs its segments gives equal ones the widest one's width
|
|
@@ -438,6 +448,7 @@ type AndroidSegmentProps = {
|
|
|
438
448
|
/** The pill is placed: the selected segment draws none of its own. */
|
|
439
449
|
framed: boolean
|
|
440
450
|
showBadges: boolean
|
|
451
|
+
badgeColor: "label" | "accent"
|
|
441
452
|
height: number
|
|
442
453
|
size: ViewStyle | null
|
|
443
454
|
keys: ReturnType<typeof useTabKeys>
|
|
@@ -446,7 +457,7 @@ type AndroidSegmentProps = {
|
|
|
446
457
|
}
|
|
447
458
|
|
|
448
459
|
/** One segment of the capsule: its label turns from the gray to the accent as the pill comes, and back as it goes. */
|
|
449
|
-
function AndroidSegment({ option, selected, off, framed, showBadges, height, size, keys, select, onWidth }: AndroidSegmentProps) {
|
|
460
|
+
function AndroidSegment({ option, selected, off, framed, showBadges, badgeColor, height, size, keys, select, onWidth }: AndroidSegmentProps) {
|
|
450
461
|
const theme = useTheme()
|
|
451
462
|
const m = theme.material
|
|
452
463
|
const [tint] = useState(() => new Animated.Value(selected ? 1 : 0))
|
|
@@ -494,7 +505,7 @@ function AndroidSegment({ option, selected, off, framed, showBadges, height, siz
|
|
|
494
505
|
{option.children}
|
|
495
506
|
</Animated.Text>
|
|
496
507
|
) : null}
|
|
497
|
-
{showBadges ? <SegmentCount badge={option.badge} selected={selected} off={off} /> : null}
|
|
508
|
+
{showBadges ? <SegmentCount badge={option.badge} selected={selected} off={off} color={badgeColor} /> : null}
|
|
498
509
|
</Pressable>
|
|
499
510
|
)
|
|
500
511
|
}
|
|
@@ -502,25 +513,29 @@ function AndroidSegment({ option, selected, off, framed, showBadges, height, siz
|
|
|
502
513
|
/**
|
|
503
514
|
* A tab's count drawn after its label (`showBadges`): a capsule 18 tall, the digits 12 semibold in the screen's color.
|
|
504
515
|
* iOS: the label's color on the selected segment, so it reads on the thumb, the secondary label on the others.
|
|
505
|
-
* Android: the accent on the selected segment, as its label, the gray on the others.
|
|
516
|
+
* Android: the accent on the selected segment, as its label, the gray on the others. `accent`: the accent's capsule and
|
|
517
|
+
* white digits on every segment, on both platforms.
|
|
506
518
|
*/
|
|
507
|
-
function SegmentCount({ badge, selected, off }: { badge: SegmentedControlBadgeProp | undefined; selected: boolean; off: boolean }) {
|
|
519
|
+
function SegmentCount({ badge, selected, off, color }: { badge: SegmentedControlBadgeProp | undefined; selected: boolean; off: boolean; color: "label" | "accent" }) {
|
|
508
520
|
const theme = useTheme()
|
|
509
521
|
const text = badge != null ? badgeText(badge) : undefined
|
|
510
522
|
if (!text) return null
|
|
511
523
|
// iOS: the label's color in a capsule, the bar's ink in it; Android: the segment's own ink, the selected one's
|
|
512
524
|
// container in it (onSecondaryContainer on secondaryContainer), the others' onSurfaceVariant on the surface, so the
|
|
513
525
|
// small digits keep their contrast
|
|
526
|
+
const accent = color === "accent"
|
|
514
527
|
const fill = off
|
|
515
528
|
? theme.color("--alpha-20")
|
|
516
|
-
:
|
|
529
|
+
: accent
|
|
530
|
+
? theme.color("--color-background-accent-solid")
|
|
531
|
+
: theme.isAndroid
|
|
517
532
|
? selected
|
|
518
533
|
? theme.material.onSecondaryContainer
|
|
519
534
|
: theme.material.onSurfaceVariant
|
|
520
535
|
: selected
|
|
521
536
|
? theme.colors.text
|
|
522
537
|
: theme.colors.labelSecondary
|
|
523
|
-
const ink = theme.isAndroid ? (selected ? theme.material.secondaryContainer : theme.material.surface) : theme.colors.background
|
|
538
|
+
const ink = accent && !off ? theme.color("--color-text-accent-solid", "#FFFFFF") : theme.isAndroid ? (selected ? theme.material.secondaryContainer : theme.material.surface) : theme.colors.background
|
|
524
539
|
return (
|
|
525
540
|
<View aria-hidden style={[styles.count, { backgroundColor: fill }]}>
|
|
526
541
|
<Text numberOfLines={1} weight="semibold" color={ink} style={styles.countText}>
|
|
@@ -149,13 +149,14 @@ export function Select<T extends SelectOption>(props: SelectProps<T>) {
|
|
|
149
149
|
const hold = useContext(RowHoldContext)
|
|
150
150
|
const rowEnd = row != null
|
|
151
151
|
const inRow = rowEnd && !android
|
|
152
|
-
// At the end of an Android row the select is the row's value, as in an Android value row
|
|
153
|
-
// on the row opens its choice
|
|
152
|
+
// At the end of an Android row the select is the row's value, as in an Android value row. On both platforms a press
|
|
153
|
+
// anywhere on the row opens its choice, as Settings' menu-picker row opens from the whole row on iOS; the row hands
|
|
154
|
+
// its press to the select, which stays the one element for a screen reader
|
|
154
155
|
const androidRow = rowEnd && android
|
|
155
156
|
// Alone in a row whose label is hidden (a label-hidden `Field row`): the value from the row's text start and the
|
|
156
157
|
// chevrons at its end, on the row's line
|
|
157
158
|
const stacked = row?.stacked === true && block
|
|
158
|
-
const handRow =
|
|
159
|
+
const handRow = rowEnd && !disabled ? row?.press : undefined
|
|
159
160
|
useEffect(() => {
|
|
160
161
|
if (!handRow) return
|
|
161
162
|
handRow(dialog ? () => setOpen(true) : () => place(() => setOpen(true)))
|
|
@@ -193,7 +194,7 @@ export function Select<T extends SelectOption>(props: SelectProps<T>) {
|
|
|
193
194
|
// A value row's value: 16sp in the accent, the placeholder in the hint's gray, faded to half when disabled
|
|
194
195
|
<Text
|
|
195
196
|
numberOfLines={1}
|
|
196
|
-
color={withAlpha(shownLabel != null ? m.primary : withAlpha(m.onSurface, 0.35), disabled ? 0.5 : 1)}
|
|
197
|
+
color={withAlpha(shownLabel != null ? (row?.valueColor === "secondary" ? m.onSurfaceVariant : m.primary) : withAlpha(m.onSurface, 0.35), disabled ? 0.5 : 1)}
|
|
197
198
|
style={[stacked ? styles.grow : styles.shrink, styles.androidValue, stacked ? styles.startText : null]}
|
|
198
199
|
>
|
|
199
200
|
{shownLabel ?? placeholder}
|
|
@@ -201,7 +202,7 @@ export function Select<T extends SelectOption>(props: SelectProps<T>) {
|
|
|
201
202
|
) : inRow ? (
|
|
202
203
|
<Text
|
|
203
204
|
numberOfLines={1}
|
|
204
|
-
color={shownLabel != null && !disabled ? theme.colors.labelSecondary : tertiary}
|
|
205
|
+
color={shownLabel != null && !disabled ? (row?.valueColor === "accent" ? theme.colors.accent : theme.colors.labelSecondary) : tertiary}
|
|
205
206
|
style={[stacked ? styles.grow : styles.shrink, { fontSize: theme.length("--field-row-label-font-size", 17), lineHeight: theme.length("--field-row-label-line-height", 22) }]}
|
|
206
207
|
>
|
|
207
208
|
{shownLabel ?? placeholder}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, useCallback, useContext, useEffect, useRef, useState, type ReactElement, type ReactNode } from "react"
|
|
1
|
+
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, type ReactElement, type ReactNode } from "react"
|
|
2
2
|
import { Animated, Easing, StyleSheet, View, type LayoutChangeEvent, type NativeScrollEvent, type NativeSyntheticEvent, type StyleProp, type ViewProps, type ViewStyle } from "react-native"
|
|
3
3
|
import { Pressable } from "../../internal/Pressable"
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
|
@@ -115,8 +115,15 @@ type TabBarContextValue = {
|
|
|
115
115
|
select: (value: string) => void
|
|
116
116
|
expand: () => void
|
|
117
117
|
keys: ReturnType<typeof useTabKeys>
|
|
118
|
+
/** iOS: the capsule draws one selection pill that slides between the tabs; each tab reports its frame for it. */
|
|
119
|
+
onTabLayout?: (value: string, frame: TabFrame) => void
|
|
120
|
+
/** The tab whose pill the capsule draws (its frame is known); until then the selected tab draws its own. */
|
|
121
|
+
slidingPill?: string
|
|
118
122
|
}
|
|
119
123
|
|
|
124
|
+
/** A tab's size and its top in the capsule (its place along the row comes from the tabs' order and widths). */
|
|
125
|
+
type TabFrame = { y: number; width: number; height: number }
|
|
126
|
+
|
|
120
127
|
const TabBarContext = createContext<TabBarContextValue | null>(null)
|
|
121
128
|
|
|
122
129
|
/** A badge shows unless it is empty: nothing, false, an empty text or a count of 0 (iOS hides `.badge(0)`). */
|
|
@@ -190,9 +197,18 @@ function IOSTab({ value, label, icon, badge, badgeColor, disabled = false, onPre
|
|
|
190
197
|
// A tab bar's labels keep their size, as UIKit's: a large text size shows the tab in the large content viewer
|
|
191
198
|
accessibilityShowsLargeContentViewer
|
|
192
199
|
accessibilityLargeContentTitle={textOf(label) || undefined}
|
|
200
|
+
onLayout={
|
|
201
|
+
// An expanded tab only: a minimized one's 40pt face is not where the pill goes when the bar expands
|
|
202
|
+
!circle && !collapsed && context.onTabLayout
|
|
203
|
+
? (event: LayoutChangeEvent) => {
|
|
204
|
+
const { y, width, height } = event.nativeEvent.layout
|
|
205
|
+
context.onTabLayout?.(value, { y, width, height })
|
|
206
|
+
}
|
|
207
|
+
: undefined
|
|
208
|
+
}
|
|
193
209
|
style={[styles.iosItem, size, circle ? null : { flexShrink: 1, minWidth: 0 }]}
|
|
194
210
|
>
|
|
195
|
-
{selected && !collapsed ? <View pointerEvents="none" style={[styles.pill, pill, { backgroundColor: theme.color("--tab-bar-item-background-selected") }]} /> : null}
|
|
211
|
+
{selected && !collapsed && (circle || context.slidingPill !== value) ? <View pointerEvents="none" style={[styles.pill, pill, { backgroundColor: theme.color("--tab-bar-item-background-selected") }]} /> : null}
|
|
196
212
|
<View style={[styles.iosIcon, { height: theme.length("--tab-bar-icon-box", 28) }]}>
|
|
197
213
|
<IconDefaultsProvider size={theme.length("--tab-bar-icon-size", 28)} color={color}>
|
|
198
214
|
{icon}
|
|
@@ -686,7 +702,62 @@ function TabBarRoot({
|
|
|
686
702
|
const visible = shown.length ? shown : capsuleTabs.slice(0, 1)
|
|
687
703
|
const reachable = [...visible, ...(circle ? [circle] : [])]
|
|
688
704
|
const keys = useTabKeys(reachable, value, select)
|
|
689
|
-
|
|
705
|
+
// iOS 26 slides the selection to the new tab: one pill in the capsule, under the tabs, moving from tab to tab
|
|
706
|
+
const [frames, setFrames] = useState<Record<string, TabFrame>>({})
|
|
707
|
+
const onTabLayout = useCallback((tab: string, next: TabFrame) => {
|
|
708
|
+
setFrames((current) => {
|
|
709
|
+
const prev = current[tab]
|
|
710
|
+
return prev && prev.y === next.y && prev.width === next.width && prev.height === next.height ? current : { ...current, [tab]: next }
|
|
711
|
+
})
|
|
712
|
+
}, [])
|
|
713
|
+
// The pill's place from the start of the capsule: its padding and the widths of the tabs before it, in their order
|
|
714
|
+
// (a reorder moves it with no resize to report; the start edge, so a right-to-left bar mirrors it as its tabs)
|
|
715
|
+
const capsuleInline = theme.length("--tab-bar-capsule-padding-inline", 10)
|
|
716
|
+
const selectedIndex = value != null && !minimized ? visible.findIndex((tab) => tab.value === value) : -1
|
|
717
|
+
const before = selectedIndex >= 0 ? visible.slice(0, selectedIndex) : []
|
|
718
|
+
const frame = selectedIndex >= 0 && theme.isIOS ? frames[visible[selectedIndex].value] : undefined
|
|
719
|
+
const pillFrame =
|
|
720
|
+
frame && before.every((tab) => frames[tab.value] != null)
|
|
721
|
+
? { ...frame, x: capsuleInline + before.reduce((sum, tab) => sum + frames[tab.value].width, 0) }
|
|
722
|
+
: undefined
|
|
723
|
+
const context: TabBarContextValue = {
|
|
724
|
+
value,
|
|
725
|
+
badgeColor,
|
|
726
|
+
minimized,
|
|
727
|
+
select,
|
|
728
|
+
expand,
|
|
729
|
+
keys,
|
|
730
|
+
onTabLayout: theme.isIOS ? onTabLayout : undefined,
|
|
731
|
+
slidingPill: pillFrame ? value : undefined,
|
|
732
|
+
}
|
|
733
|
+
const pillOutset = theme.length("--tab-bar-pill-outset", 6)
|
|
734
|
+
const [pillX] = useState(() => new Animated.Value(0))
|
|
735
|
+
const [pillWidth] = useState(() => new Animated.Value(0))
|
|
736
|
+
const pillShown = useRef(false)
|
|
737
|
+
const pillLeft = pillFrame ? pillFrame.x - pillOutset : undefined
|
|
738
|
+
const pillSpan = pillFrame ? pillFrame.width + 2 * pillOutset : undefined
|
|
739
|
+
// Before the paint, so the pill never shows a frame at its old place or at 0
|
|
740
|
+
useLayoutEffect(() => {
|
|
741
|
+
if (pillLeft == null || pillSpan == null) {
|
|
742
|
+
pillShown.current = false
|
|
743
|
+
return
|
|
744
|
+
}
|
|
745
|
+
// It appears in place (the first frame, back from a minimized bar or the circle's tab), then slides: CSS `ease`
|
|
746
|
+
// over 300ms, as SegmentedControl's thumb
|
|
747
|
+
if (!pillShown.current || theme.reducedMotion) {
|
|
748
|
+
pillX.setValue(pillLeft)
|
|
749
|
+
pillWidth.setValue(pillSpan)
|
|
750
|
+
pillShown.current = true
|
|
751
|
+
return
|
|
752
|
+
}
|
|
753
|
+
const easing = Easing.bezier(0.25, 0.1, 0.25, 1)
|
|
754
|
+
const animation = Animated.parallel([
|
|
755
|
+
Animated.timing(pillX, { toValue: pillLeft, duration: 300, easing, useNativeDriver: false }),
|
|
756
|
+
Animated.timing(pillWidth, { toValue: pillSpan, duration: 300, easing, useNativeDriver: false }),
|
|
757
|
+
])
|
|
758
|
+
animation.start()
|
|
759
|
+
return () => animation.stop()
|
|
760
|
+
}, [pillLeft, pillSpan, theme.reducedMotion, pillX, pillWidth])
|
|
690
761
|
|
|
691
762
|
if (theme.isAndroid) {
|
|
692
763
|
return (
|
|
@@ -761,6 +832,15 @@ function TabBarRoot({
|
|
|
761
832
|
elevation="raised"
|
|
762
833
|
style={[styles.capsule, minimized ? { padding: capsulePadding } : { paddingVertical: capsulePadding, paddingHorizontal: theme.length("--tab-bar-capsule-padding-inline", 10) }]}
|
|
763
834
|
>
|
|
835
|
+
{pillFrame ? (
|
|
836
|
+
<Animated.View
|
|
837
|
+
pointerEvents="none"
|
|
838
|
+
style={[
|
|
839
|
+
styles.pill,
|
|
840
|
+
{ top: pillFrame.y, height: pillFrame.height, start: pillX, width: pillWidth, backgroundColor: theme.color("--tab-bar-item-background-selected") },
|
|
841
|
+
]}
|
|
842
|
+
/>
|
|
843
|
+
) : null}
|
|
764
844
|
{visible.map((tab) => (
|
|
765
845
|
<Tab key={tab.value} {...tab} context={context} />
|
|
766
846
|
))}
|
package/src/internal/Glass.tsx
CHANGED
|
@@ -122,9 +122,13 @@ export function Glass({
|
|
|
122
122
|
const filterName = filterToken ?? surface?.filter ?? "--mobile-glass-backdrop-filter"
|
|
123
123
|
const dense = web && !theme.isAndroid ? WEB_DENSE[fillName] : undefined
|
|
124
124
|
const denseFill = dense != null && tint == null && overrides?.[fillName] == null
|
|
125
|
-
|
|
125
|
+
// Glass with a fill of its own and the plain glass's filter (the large segmented control) blurs as the plain glass
|
|
126
|
+
// does on the web, so a brand's --mobile-glass-web-backdrop-filter reaches it too
|
|
127
|
+
const plainFilter = web && !theme.isAndroid && dense == null && filterToken == null && filterName === "--mobile-glass-backdrop-filter" && overrides?.[filterName] == null
|
|
128
|
+
const denseFilter = (dense != null && filterToken == null && overrides?.[filterName] == null) || plainFilter
|
|
129
|
+
const webFilter = dense ?? WEB_DENSE["--mobile-glass-background"]
|
|
126
130
|
const fill = tint ?? (denseFill ? theme.color(dense.fill, theme.scheme === "dark" ? dense.dark : dense.light) : theme.color(fillName))
|
|
127
|
-
const filterValue = denseFilter ? (theme.token(
|
|
131
|
+
const filterValue = denseFilter ? (theme.token(webFilter.filter) ?? webFilter.blur) : theme.token(filterName)
|
|
128
132
|
const filter = blur != null ? `blur(${blur}px)` : typeof filterValue === "string" ? filterValue : "blur(12px)"
|
|
129
133
|
const module = web || Platform.OS !== "ios" ? null : blurModule()
|
|
130
134
|
const opaque = reduceTransparency || (!web && module == null)
|
package/src/internal/row.ts
CHANGED