@plexui/react-native 0.1.1 → 0.2.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/README.md +34 -0
- package/dist/es/components/ActionSheet/ActionSheet.js +53 -19
- package/dist/es/components/Alert/Alert.js +163 -0
- package/dist/es/components/Avatar/Avatar.js +20 -8
- package/dist/es/components/BottomActions/BottomActions.js +34 -0
- package/dist/es/components/BottomSheet/BottomSheet.js +85 -17
- package/dist/es/components/Button/Button.js +108 -28
- package/dist/es/components/Card/Card.js +16 -8
- package/dist/es/components/Checkbox/Checkbox.js +67 -99
- package/dist/es/components/Chip/Chip.js +16 -7
- package/dist/es/components/Dialog/Dialog.js +38 -24
- package/dist/es/components/Field/Field.js +91 -0
- package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +59 -0
- package/dist/es/components/Icon/createIcon.js +13 -2
- package/dist/es/components/Indicator/CircularProgress.js +80 -0
- package/dist/es/components/Indicator/LoadingDots.js +46 -0
- package/dist/es/components/Indicator/LoadingIndicator.js +101 -0
- package/dist/es/components/Indicator/index.js +3 -0
- package/dist/es/components/Input/Input.js +69 -60
- package/dist/es/components/InputGroup/InputGroup.js +130 -0
- package/dist/es/components/List/List.js +175 -59
- package/dist/es/components/Menu/Menu.js +69 -40
- package/dist/es/components/NavigationButton/NavigationButton.js +20 -4
- package/dist/es/components/OTPInput/OTPInput.js +9 -3
- package/dist/es/components/PageControl/PageControl.js +13 -7
- package/dist/es/components/Popover/Popover.js +128 -0
- package/dist/es/components/Progress/Progress.js +142 -0
- package/dist/es/components/ProgressSteps/ProgressSteps.js +207 -0
- package/dist/es/components/RollingNumber/RollingNumber.js +125 -0
- package/dist/es/components/Select/Select.js +97 -34
- package/dist/es/components/Separator/Separator.js +31 -0
- package/dist/es/components/ShimmerText/ShimmerText.js +98 -0
- package/dist/es/components/Stepper/Stepper.js +219 -0
- package/dist/es/components/Switch/Switch.js +26 -12
- package/dist/es/components/TagInput/TagInput.js +121 -0
- package/dist/es/components/Text/Text.js +7 -4
- package/dist/es/components/TextLink/TextLink.js +42 -0
- package/dist/es/components/Textarea/Textarea.js +12 -0
- package/dist/es/components/Tip/Tip.js +193 -0
- package/dist/es/components/Toolbar/Toolbar.js +6 -2
- package/dist/es/components/Tooltip/Tooltip.js +272 -0
- package/dist/es/index.js +20 -2
- package/dist/es/internal/FloatingPanel.js +111 -0
- package/dist/es/internal/fieldStack.js +73 -0
- package/dist/es/internal/floating.js +97 -0
- package/dist/es/internal/ripple.js +119 -0
- package/dist/es/internal/row.js +2 -1
- package/dist/es/internal/transition.js +113 -0
- package/dist/es/theme/ThemeProvider.js +41 -9
- package/dist/es/theme/material.js +37 -7
- package/dist/types/components/ActionSheet/ActionSheet.d.ts +15 -7
- package/dist/types/components/Alert/Alert.d.ts +51 -0
- package/dist/types/components/Avatar/Avatar.d.ts +4 -2
- package/dist/types/components/BottomActions/BottomActions.d.ts +18 -0
- package/dist/types/components/BottomSheet/BottomSheet.d.ts +4 -2
- package/dist/types/components/Button/Button.d.ts +20 -5
- package/dist/types/components/Card/Card.d.ts +14 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +4 -3
- package/dist/types/components/Chip/Chip.d.ts +12 -1
- package/dist/types/components/Dialog/Dialog.d.ts +9 -5
- package/dist/types/components/Field/Field.d.ts +64 -0
- package/dist/types/components/FloatingLabelInput/FloatingLabelInput.d.ts +42 -0
- package/dist/types/components/Indicator/CircularProgress.d.ts +34 -0
- package/dist/types/components/Indicator/LoadingDots.d.ts +17 -0
- package/dist/types/components/Indicator/LoadingIndicator.d.ts +46 -0
- package/dist/types/components/Indicator/index.d.ts +3 -0
- package/dist/types/components/Input/Input.d.ts +13 -3
- package/dist/types/components/InputGroup/InputGroup.d.ts +71 -0
- package/dist/types/components/List/List.d.ts +57 -14
- package/dist/types/components/Menu/Menu.d.ts +4 -0
- package/dist/types/components/NavigationButton/NavigationButton.d.ts +11 -3
- package/dist/types/components/OTPInput/OTPInput.d.ts +10 -1
- package/dist/types/components/PageControl/PageControl.d.ts +11 -1
- package/dist/types/components/Popover/Popover.d.ts +86 -0
- package/dist/types/components/Progress/Progress.d.ts +56 -0
- package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +61 -0
- package/dist/types/components/RollingNumber/RollingNumber.d.ts +36 -0
- package/dist/types/components/Select/Select.d.ts +36 -8
- package/dist/types/components/Separator/Separator.d.ts +19 -0
- package/dist/types/components/ShimmerText/ShimmerText.d.ts +28 -0
- package/dist/types/components/Stepper/Stepper.d.ts +61 -0
- package/dist/types/components/Switch/Switch.d.ts +5 -5
- package/dist/types/components/TagInput/TagInput.d.ts +44 -0
- package/dist/types/components/TextLink/TextLink.d.ts +30 -0
- package/dist/types/components/Textarea/Textarea.d.ts +19 -0
- package/dist/types/components/Tip/Tip.d.ts +71 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +9 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +84 -0
- package/dist/types/index.d.ts +20 -2
- package/dist/types/internal/FloatingPanel.d.ts +70 -0
- package/dist/types/internal/fieldStack.d.ts +48 -0
- package/dist/types/internal/floating.d.ts +71 -0
- package/dist/types/internal/ripple.d.ts +17 -0
- package/dist/types/internal/row.d.ts +15 -3
- package/dist/types/internal/transition.d.ts +37 -0
- package/dist/types/theme/ThemeProvider.d.ts +28 -4
- package/dist/types/theme/material.d.ts +20 -6
- package/dist/types/theme/types.d.ts +8 -0
- package/package.json +2 -2
- package/src/components/ActionSheet/ActionSheet.tsx +107 -38
- package/src/components/Alert/Alert.tsx +279 -0
- package/src/components/Avatar/Avatar.tsx +21 -9
- package/src/components/BottomActions/BottomActions.tsx +54 -0
- package/src/components/BottomSheet/BottomSheet.tsx +111 -25
- package/src/components/Button/Button.tsx +170 -35
- package/src/components/Card/Card.tsx +33 -9
- package/src/components/Checkbox/Checkbox.tsx +89 -124
- package/src/components/Chip/Chip.tsx +49 -6
- package/src/components/Dialog/Dialog.tsx +68 -37
- package/src/components/Field/Field.tsx +227 -0
- package/src/components/FloatingLabelInput/FloatingLabelInput.tsx +144 -0
- package/src/components/Icon/createIcon.tsx +16 -6
- package/src/components/Indicator/CircularProgress.tsx +141 -0
- package/src/components/Indicator/LoadingDots.tsx +79 -0
- package/src/components/Indicator/LoadingIndicator.tsx +166 -0
- package/src/components/Indicator/index.ts +3 -0
- package/src/components/Input/Input.tsx +126 -97
- package/src/components/InputGroup/InputGroup.tsx +261 -0
- package/src/components/List/List.tsx +345 -88
- package/src/components/Menu/Menu.tsx +83 -41
- package/src/components/NavigationButton/NavigationButton.tsx +35 -5
- package/src/components/OTPInput/OTPInput.tsx +21 -2
- package/src/components/PageControl/PageControl.tsx +36 -8
- package/src/components/Popover/Popover.tsx +261 -0
- package/src/components/Progress/Progress.tsx +255 -0
- package/src/components/ProgressSteps/ProgressSteps.tsx +415 -0
- package/src/components/RollingNumber/RollingNumber.tsx +189 -0
- package/src/components/Select/Select.tsx +175 -71
- package/src/components/Separator/Separator.tsx +51 -0
- package/src/components/ShimmerText/ShimmerText.tsx +144 -0
- package/src/components/Stepper/Stepper.tsx +386 -0
- package/src/components/Switch/Switch.tsx +26 -12
- package/src/components/TagInput/TagInput.tsx +227 -0
- package/src/components/Text/Text.tsx +8 -4
- package/src/components/TextLink/TextLink.tsx +77 -0
- package/src/components/Textarea/Textarea.tsx +23 -0
- package/src/components/Tip/Tip.tsx +410 -0
- package/src/components/Toolbar/Toolbar.tsx +27 -2
- package/src/components/Tooltip/Tooltip.tsx +478 -0
- package/src/index.ts +36 -2
- package/src/internal/FloatingPanel.tsx +199 -0
- package/src/internal/fieldStack.tsx +179 -0
- package/src/internal/floating.ts +131 -0
- package/src/internal/ripple.tsx +132 -0
- package/src/internal/row.ts +16 -3
- package/src/internal/transition.ts +124 -0
- package/src/theme/ThemeProvider.tsx +65 -15
- package/src/theme/material.ts +39 -7
- package/src/theme/types.ts +8 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useContext, useEffect, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Pressable, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
2
|
+
import { Animated, Easing, Pressable, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
3
|
import Svg, { Path } from "react-native-svg"
|
|
4
4
|
import CheckMd from "../../icons/plex/CheckMd"
|
|
5
5
|
import Minus from "../../icons/plex/Minus"
|
|
6
6
|
import { spaceToggles, useDescription } from "../../internal/a11y"
|
|
7
7
|
import { ControlLabel, controlLabelLine } from "../../internal/ControlLabel"
|
|
8
|
-
import { RowEndContext, RowHoldContext, rowHold } from "../../internal/row"
|
|
9
|
-
import {
|
|
8
|
+
import { RowEndContext, RowHoldContext, RowStartContext, rowHold } from "../../internal/row"
|
|
9
|
+
import { androidGray, withAlpha } from "../../theme/material"
|
|
10
10
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
11
|
-
import { ANDROID_ROW_END,
|
|
11
|
+
import { ANDROID_ROW_END, iosCheckmarkColor, selectionColor } from "../Switch/Switch"
|
|
12
12
|
|
|
13
13
|
export type CheckboxProps = {
|
|
14
14
|
checked?: boolean | "indeterminate"
|
|
@@ -20,7 +20,7 @@ export type CheckboxProps = {
|
|
|
20
20
|
orientation?: "left" | "right"
|
|
21
21
|
/** `ghost`: the checkmark alone, as an iOS list row draws it. @default "solid" */
|
|
22
22
|
variant?: "solid" | "ghost"
|
|
23
|
-
/** Kept for the API of @plexui/ui: the phone box is a circle on
|
|
23
|
+
/** Kept for the API of @plexui/ui: the phone box is a circle on both platforms. */
|
|
24
24
|
pill?: boolean
|
|
25
25
|
invalid?: boolean
|
|
26
26
|
disabled?: boolean
|
|
@@ -29,18 +29,23 @@ export type CheckboxProps = {
|
|
|
29
29
|
style?: StyleProp<ViewStyle>
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/** Android's
|
|
33
|
-
const ANDROID_BOX =
|
|
32
|
+
/** Android's round check: a 20dp circle (the reference's 19.8), in a 48dp target that reaches 14dp past it. */
|
|
33
|
+
const ANDROID_BOX = 20
|
|
34
34
|
const ANDROID_REACH = (48 - ANDROID_BOX) / 2
|
|
35
|
-
/** A checkbox
|
|
35
|
+
/** A checkbox with a label: the text starts 11dp after the circle (the web's -3 margin and 14 of the target). */
|
|
36
36
|
const ANDROID_LABEL_GAP = 11
|
|
37
|
-
/** A checkbox row's
|
|
37
|
+
/** A checkbox at a List row's end stands 21dp in from the row's edge. */
|
|
38
38
|
const ANDROID_ROW_INSET = 21
|
|
39
|
+
/** The ring of an empty circle, 1.5dp. */
|
|
40
|
+
const ANDROID_RING = 1.5
|
|
41
|
+
/** Android's check eases both ways on cubic-bezier(0.37, 0, 0.63, 1) (the web's `--android-checkbox-ease`). */
|
|
42
|
+
const androidCheckEase = Easing.bezier(0.37, 0, 0.63, 1)
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* A checkbox: on iOS the 22pt circle of the phone layer (`--checkbox-*`: a 1.5pt ring, filled in the primary with a
|
|
42
|
-
* check), on Android
|
|
43
|
-
* color with a round-capped check) in a 48dp target.
|
|
46
|
+
* check), on Android the reference's round check (a 20dp circle, a 1.5dp ring in a light gray, filled in the
|
|
47
|
+
* selection color with a white round-capped check) in a 48dp target. As the first control of a List row (`RowStart`)
|
|
48
|
+
* it leads the row, 22 in.
|
|
44
49
|
*/
|
|
45
50
|
export function Checkbox({
|
|
46
51
|
checked: checkedProp,
|
|
@@ -57,27 +62,39 @@ export function Checkbox({
|
|
|
57
62
|
style,
|
|
58
63
|
}: CheckboxProps) {
|
|
59
64
|
const theme = useTheme()
|
|
60
|
-
// At a List row's end with no text of its own: the row is its label
|
|
61
|
-
|
|
65
|
+
// At a List row's end with no text of its own: the row is its label. Leading the row (Android's multi-select row),
|
|
66
|
+
// the row sets its place
|
|
67
|
+
const atRowStart = useContext(RowStartContext) && label == null && description == null
|
|
68
|
+
const inRow = useContext(RowEndContext) != null && label == null && description == null && !atRowStart
|
|
62
69
|
const hold = useContext(RowHoldContext)
|
|
63
70
|
const [own, setOwn] = useState(defaultChecked)
|
|
64
71
|
const state = checkedProp ?? own
|
|
65
72
|
const on = state !== false
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
|
|
73
|
+
// Android's round check, as the web's: the ring and the fill turn in 150ms, then the mark is drawn from its start
|
|
74
|
+
// in 150ms; unchecking fades the mark out in 150ms as the fill goes. Android only: iOS shows a list row's
|
|
75
|
+
// checkmark, which does not animate
|
|
76
|
+
const [fillIn] = useState(() => new Animated.Value(on ? 1 : 0))
|
|
77
|
+
const [draw] = useState(() => new Animated.Value(on ? 1 : 0))
|
|
78
|
+
const [markIn] = useState(() => new Animated.Value(on ? 1 : 0))
|
|
69
79
|
const animate = theme.isAndroid && !disabled
|
|
70
80
|
useEffect(() => {
|
|
81
|
+
const values = [fillIn, draw, markIn]
|
|
71
82
|
// A disabled box snaps: no motion between enabled and disabled
|
|
72
83
|
if (theme.reducedMotion || !animate) {
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
values.forEach((value) => {
|
|
85
|
+
value.stopAnimation()
|
|
86
|
+
value.setValue(on ? 1 : 0)
|
|
87
|
+
})
|
|
75
88
|
return
|
|
76
89
|
}
|
|
77
|
-
const
|
|
90
|
+
const timing = (value: Animated.Value, toValue: number, delay = 0) =>
|
|
91
|
+
Animated.timing(value, { toValue, duration: 150, delay, easing: androidCheckEase, useNativeDriver: false })
|
|
92
|
+
const animation = on
|
|
93
|
+
? Animated.parallel([timing(fillIn, 1), Animated.sequence([Animated.timing(markIn, { toValue: 1, duration: 0, useNativeDriver: false }), timing(draw, 1, 150)])])
|
|
94
|
+
: Animated.parallel([timing(fillIn, 0), Animated.sequence([timing(markIn, 0), Animated.timing(draw, { toValue: 0, duration: 0, useNativeDriver: false })])])
|
|
78
95
|
animation.start()
|
|
79
96
|
return () => animation.stop()
|
|
80
|
-
}, [on, animate, theme.reducedMotion,
|
|
97
|
+
}, [on, animate, theme.reducedMotion, fillIn, draw, markIn])
|
|
81
98
|
const toggle = () => {
|
|
82
99
|
if (disabled) return
|
|
83
100
|
// An indeterminate box checks on a press, as Radix does on the web
|
|
@@ -89,25 +106,29 @@ export function Checkbox({
|
|
|
89
106
|
let box: ReactNode
|
|
90
107
|
const hasText = label != null || description != null
|
|
91
108
|
if (theme.isAndroid) {
|
|
92
|
-
// The
|
|
93
|
-
//
|
|
94
|
-
// the near-white primary at night
|
|
109
|
+
// The ring a light gray (#B0B9C2, --gray-500 at night), the fill the selection color, the error when invalid
|
|
110
|
+
// (in a List row the error is the row's line: the circle keeps its colors). The mark is the fill's own text
|
|
111
|
+
// color: white on the accent and on the ink of a light theme, dark on the near-white primary at night
|
|
95
112
|
const m = theme.material
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
const red = invalid && !inRow && !atRowStart
|
|
114
|
+
const ring = red ? m.error : androidGray(theme, "checkboxRing")
|
|
115
|
+
const fill = red ? m.error : selectionColor(theme)
|
|
116
|
+
const markColor = red ? m.onError : theme.color(`--color-text-${theme.selectionColor}-solid`, "#FFFFFF")
|
|
117
|
+
// The 48dp target reaches past the circle without taking room: on the outer side the circle keeps the row's edge,
|
|
118
|
+
// on the label's side the text starts 11dp after it. At a List row's end the circle stands 21dp in; leading a
|
|
119
|
+
// row the row places it
|
|
120
|
+
const reach: ViewStyle = atRowStart
|
|
121
|
+
? { margin: -ANDROID_REACH }
|
|
122
|
+
: inRow
|
|
123
|
+
? { marginStart: -ANDROID_REACH, marginEnd: -(ANDROID_REACH - (ANDROID_ROW_INSET - ANDROID_ROW_END)) }
|
|
124
|
+
: orientation === "right"
|
|
125
|
+
? { marginEnd: -ANDROID_REACH, marginStart: hasText ? -(ANDROID_REACH - ANDROID_LABEL_GAP) : 0 }
|
|
126
|
+
: { marginStart: -ANDROID_REACH, marginEnd: hasText ? -(ANDROID_REACH - ANDROID_LABEL_GAP) : 0 }
|
|
127
|
+
// No press of its own: a row shows the press. Disabled, the circle keeps its colors at half (as a checkbox row's)
|
|
107
128
|
box = (
|
|
108
129
|
<View style={[styles.androidTarget, reach]}>
|
|
109
130
|
<View style={disabled ? styles.half : null}>
|
|
110
|
-
<
|
|
131
|
+
<AndroidCheck fillIn={fillIn} draw={draw} markIn={markIn} ring={ring} fill={fill} markColor={markColor} indeterminate={state === "indeterminate"} />
|
|
111
132
|
</View>
|
|
112
133
|
</View>
|
|
113
134
|
)
|
|
@@ -180,98 +201,41 @@ export function Checkbox({
|
|
|
180
201
|
)
|
|
181
202
|
}
|
|
182
203
|
|
|
183
|
-
/** The
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
const LONG_ARM = { length: 7 * Math.SQRT2, angle: -45 }
|
|
204
|
+
/** The reference's check in its 20dp circle, and the dash of a mixed one: 2dp strokes with round ends. */
|
|
205
|
+
const CHECK_PATH = "M5.2 11l3 3 6.6-6.6"
|
|
206
|
+
const DASH_PATH = "M6 10h8"
|
|
187
207
|
|
|
188
208
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
209
|
+
* Android's round check: a 20dp circle whose 1.5dp ring turns from the gray to the fill as the fill comes in
|
|
210
|
+
* (`fillIn`), and the mark, shown by `markIn` and drawn from its start as a clip opens over it (`draw`).
|
|
191
211
|
*/
|
|
192
|
-
function
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
212
|
+
function AndroidCheck({
|
|
213
|
+
fillIn,
|
|
214
|
+
draw,
|
|
215
|
+
markIn,
|
|
216
|
+
ring,
|
|
217
|
+
fill,
|
|
218
|
+
markColor,
|
|
219
|
+
indeterminate,
|
|
220
|
+
}: {
|
|
221
|
+
fillIn: Animated.Value
|
|
222
|
+
draw: Animated.Value
|
|
223
|
+
markIn: Animated.Value
|
|
224
|
+
ring: string
|
|
225
|
+
fill: string
|
|
226
|
+
markColor: string
|
|
227
|
+
indeterminate: boolean
|
|
228
|
+
}) {
|
|
229
|
+
const borderColor = fillIn.interpolate({ inputRange: [0, 1], outputRange: [ring, fill] })
|
|
230
|
+
const backgroundColor = fillIn.interpolate({ inputRange: [0, 1], outputRange: [withAlpha(fill, 0), fill] })
|
|
196
231
|
return (
|
|
197
|
-
<Animated.View
|
|
198
|
-
style={[
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
width: Animated.add(along(1), 2),
|
|
203
|
-
// The bar's middle is half its length along the arm from the corner; its box is then half its width back
|
|
204
|
-
left: Animated.add(along((cos - 1) / 2), CORNER.x - 1),
|
|
205
|
-
top: Animated.add(along(sin / 2), CORNER.y - 1),
|
|
206
|
-
transform: [{ rotate: `${angle}deg` }],
|
|
207
|
-
},
|
|
208
|
-
]}
|
|
209
|
-
/>
|
|
210
|
-
)
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/** A rounded rectangle from `from` to `to` on both axes, as a path of fixed shape (its numbers alone change). */
|
|
214
|
-
const roundedSquare = (from: number, to: number, corner: number) => {
|
|
215
|
-
const n = (value: number) => value.toFixed(4)
|
|
216
|
-
const [a, b, r] = [from, to, corner]
|
|
217
|
-
return (
|
|
218
|
-
`M ${n(a + r)} ${n(a)} H ${n(b - r)} A ${n(r)} ${n(r)} 0 0 1 ${n(b)} ${n(a + r)} V ${n(b - r)} A ${n(r)} ${n(r)} 0 0 1 ${n(b - r)} ${n(b)} ` +
|
|
219
|
-
`H ${n(a + r)} A ${n(r)} ${n(r)} 0 0 1 ${n(a)} ${n(b - r)} V ${n(a + r)} A ${n(r)} ${n(r)} 0 0 1 ${n(a + r)} ${n(a)} Z`
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/** The outline's width, at rest and around the hole. */
|
|
224
|
-
const ANDROID_RING = 1.33
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* The box at `progress`, a 4dp-cornered square with the hole it cuts. Over the first half the box shrinks 1dp on each
|
|
228
|
-
* side while the hole, fixed in the 18dp frame, closes 16dp per unit of progress (to 7dp in from the outline) with
|
|
229
|
-
* corners of 3dp, or of half its width once it is under 6dp; past the middle the box is solid and grows back.
|
|
230
|
-
*/
|
|
231
|
-
function androidBoxPath(progress: number) {
|
|
232
|
-
const half = Math.min(1, progress * 2)
|
|
233
|
-
const box = progress <= 0.5 ? half : 2 - progress * 2
|
|
234
|
-
const holed = progress <= 0.5
|
|
235
|
-
const closed = ANDROID_RING + Math.min(7, 8 * half)
|
|
236
|
-
const hole = holed ? ANDROID_BOX - 2 * closed : 0
|
|
237
|
-
const from = holed ? closed : ANDROID_BOX / 2
|
|
238
|
-
return `${roundedSquare(box, ANDROID_BOX - box, 4)} ${roundedSquare(from, from + hole, Math.min(3, hole / 2))}`
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Android's square checkbox, drawn from its numbers. Over the first half of `progress` the box shrinks 1dp on each
|
|
244
|
-
* side while its 1.33dp outline closes inward and turns from the outline's color to the fill's; over the second half
|
|
245
|
-
* the box grows back and the mark grows from its corner. One path draws the box and its hole, redrawn from the
|
|
246
|
-
* progress on each frame (an animated path's props do not reach an SVG element on the web).
|
|
247
|
-
*/
|
|
248
|
-
function AndroidBox({ progress, initial, ring, fill, markColor, indeterminate }: { progress: Animated.Value; initial: number; ring: string; fill: string; markColor: string; indeterminate: boolean }) {
|
|
249
|
-
const [at, setAt] = useState(initial)
|
|
250
|
-
useEffect(() => {
|
|
251
|
-
const id = progress.addListener(({ value }) => setAt(value))
|
|
252
|
-
return () => progress.removeListener(id)
|
|
253
|
-
}, [progress])
|
|
254
|
-
const grow = progress.interpolate({ inputRange: [0.5, 1], outputRange: [0, 1], extrapolate: "clamp" })
|
|
255
|
-
const shown = progress.interpolate({ inputRange: [0.5, 0.5001], outputRange: [0, 1], extrapolate: "clamp" })
|
|
256
|
-
return (
|
|
257
|
-
<View style={styles.androidFrame}>
|
|
258
|
-
<Svg width={ANDROID_BOX} height={ANDROID_BOX} style={StyleSheet.absoluteFill}>
|
|
259
|
-
<Path d={androidBoxPath(at)} fill={mix(fill, ring, Math.min(1, at * 2))} fillRule="evenodd" />
|
|
260
|
-
</Svg>
|
|
261
|
-
<Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, { opacity: shown }]}>
|
|
262
|
-
{indeterminate ? (
|
|
263
|
-
// The box has no indeterminate look: a 2dp dash with round ends across the middle, growing from its center
|
|
264
|
-
<Animated.View
|
|
265
|
-
style={[styles.arm, { backgroundColor: markColor, top: ANDROID_BOX / 2 - 1, width: grow.interpolate({ inputRange: [0, 1], outputRange: [2, 10] }), left: grow.interpolate({ inputRange: [0, 1], outputRange: [8, 4] }) }]}
|
|
266
|
-
/>
|
|
267
|
-
) : (
|
|
268
|
-
<>
|
|
269
|
-
<CheckArm grow={grow} color={markColor} {...SHORT_ARM} />
|
|
270
|
-
<CheckArm grow={grow} color={markColor} {...LONG_ARM} />
|
|
271
|
-
</>
|
|
272
|
-
)}
|
|
232
|
+
<Animated.View style={[styles.androidCircle, { borderColor, backgroundColor }]}>
|
|
233
|
+
<Animated.View pointerEvents="none" style={[styles.androidClip, { opacity: markIn, width: draw.interpolate({ inputRange: [0, 1], outputRange: [0, ANDROID_BOX] }) }]}>
|
|
234
|
+
<Svg width={ANDROID_BOX} height={ANDROID_BOX} viewBox="0 0 20 20">
|
|
235
|
+
<Path d={indeterminate ? DASH_PATH : CHECK_PATH} fill="none" stroke={markColor} strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
|
|
236
|
+
</Svg>
|
|
273
237
|
</Animated.View>
|
|
274
|
-
</View>
|
|
238
|
+
</Animated.View>
|
|
275
239
|
)
|
|
276
240
|
}
|
|
277
241
|
|
|
@@ -284,6 +248,7 @@ const styles = StyleSheet.create({
|
|
|
284
248
|
fill: { flexGrow: 1 },
|
|
285
249
|
androidTarget: { width: 48, height: 48, alignItems: "center", justifyContent: "center" },
|
|
286
250
|
half: { opacity: 0.5 },
|
|
287
|
-
|
|
288
|
-
|
|
251
|
+
androidCircle: { width: ANDROID_BOX, height: ANDROID_BOX, borderRadius: ANDROID_BOX / 2, borderWidth: ANDROID_RING },
|
|
252
|
+
// The mark spans the circle's box, over its ring
|
|
253
|
+
androidClip: { position: "absolute", top: -ANDROID_RING, left: -ANDROID_RING, height: ANDROID_BOX, overflow: "hidden" },
|
|
289
254
|
})
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { useEffect, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Easing, Pressable, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
2
|
+
import { Animated, Easing, Platform, Pressable, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import ChevronDownSm from "../../icons/plex/ChevronDownSm"
|
|
3
4
|
import CloseBold from "../../icons/plex/CloseBold"
|
|
4
5
|
import { spaceToggles } from "../../internal/a11y"
|
|
5
6
|
import { withAlpha } from "../../theme/material"
|
|
6
7
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
7
8
|
import { IconDefaultsProvider } from "../Icon/createIcon"
|
|
9
|
+
import { MaterialArrowDropDown } from "../Icon/material"
|
|
8
10
|
import { Text, textStyle } from "../Text/Text"
|
|
9
11
|
|
|
10
12
|
export type ChipProps = {
|
|
@@ -17,6 +19,17 @@ export type ChipProps = {
|
|
|
17
19
|
onPress?: () => void
|
|
18
20
|
/** A symbol before the label. */
|
|
19
21
|
icon?: ReactNode
|
|
22
|
+
/** A symbol after the label. */
|
|
23
|
+
trailingIcon?: ReactNode
|
|
24
|
+
/**
|
|
25
|
+
* The chip opens a menu (a filter that picks among options): a chevron after the label (iOS `chevron.down`, Material
|
|
26
|
+
* `arrow_drop_down`) unless `trailingIcon` is given, and `aria-haspopup` for a screen reader. `true` is a menu;
|
|
27
|
+
* `"listbox"` and `"dialog"` name what it opens.
|
|
28
|
+
*/
|
|
29
|
+
menu?: boolean | "menu" | "listbox" | "dialog"
|
|
30
|
+
/** Whether the chip's menu is open (`aria-expanded`). */
|
|
31
|
+
expanded?: boolean
|
|
32
|
+
accessibilityLabel?: string
|
|
20
33
|
/** An input chip: a cross at the end that calls this. */
|
|
21
34
|
onRemove?: () => void
|
|
22
35
|
/** @default "Remove" */
|
|
@@ -32,7 +45,23 @@ export type ChipProps = {
|
|
|
32
45
|
* capsule, 15/20 medium, the soft gray fill, the Plex primary when selected, as a selected Plex Button). The web has
|
|
33
46
|
* no Chip; the props follow Toggle-like controls (`selected`, `onSelectedChange`) and Badge's `onRemove`.
|
|
34
47
|
*/
|
|
35
|
-
export function Chip({
|
|
48
|
+
export function Chip({
|
|
49
|
+
children,
|
|
50
|
+
selected: selectedProp,
|
|
51
|
+
defaultSelected,
|
|
52
|
+
onSelectedChange,
|
|
53
|
+
onPress,
|
|
54
|
+
icon,
|
|
55
|
+
trailingIcon,
|
|
56
|
+
menu,
|
|
57
|
+
expanded,
|
|
58
|
+
accessibilityLabel,
|
|
59
|
+
onRemove,
|
|
60
|
+
removeLabel = "Remove",
|
|
61
|
+
disabled = false,
|
|
62
|
+
testID,
|
|
63
|
+
style,
|
|
64
|
+
}: ChipProps) {
|
|
36
65
|
const theme = useTheme()
|
|
37
66
|
const [own, setOwn] = useState(defaultSelected ?? false)
|
|
38
67
|
const filter = selectedProp !== undefined || defaultSelected !== undefined || onSelectedChange !== undefined
|
|
@@ -88,6 +117,8 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
88
117
|
const label = android ? { fontSize: 14, lineHeight: 18 } : { fontSize: 15, lineHeight: 20 }
|
|
89
118
|
const leading = icon
|
|
90
119
|
const iconSize = android ? 18 : 17
|
|
120
|
+
// A menu chip's chevron: Material's 18dp arrow_drop_down, iOS's small chevron.down at the label's weight
|
|
121
|
+
const trailing = trailingIcon ?? (menu ? android ? <MaterialArrowDropDown size={18} /> : <ChevronDownSm size={14} /> : null)
|
|
91
122
|
const leadingColor = color
|
|
92
123
|
// The chip is drawn 32 (34) tall inside a 48dp (44pt) touch target, as Compose's minimum interactive size and the
|
|
93
124
|
// HIG ask: the target is the layout box, the chip a layer inside it, so every press in the target reaches it
|
|
@@ -112,7 +143,8 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
112
143
|
paddingVertical: inset + (height - label.lineHeight) / 2,
|
|
113
144
|
// Android: 12 at the sides, 8 before an icon and 6 after it
|
|
114
145
|
paddingLeft: leading != null ? (android ? 8 : 12) : android ? 12 : 14,
|
|
115
|
-
|
|
146
|
+
// Android: 8 after a trailing icon (Compose's FilterChip), iOS 10
|
|
147
|
+
paddingRight: onRemove ? 0 : trailing != null ? (android ? 8 : 10) : android ? 12 : 14,
|
|
116
148
|
gap: 6,
|
|
117
149
|
opacity: !android && pressed ? 0.7 : 1,
|
|
118
150
|
}
|
|
@@ -139,6 +171,13 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
139
171
|
{children}
|
|
140
172
|
</Text>
|
|
141
173
|
)}
|
|
174
|
+
{trailing != null ? (
|
|
175
|
+
<View>
|
|
176
|
+
<IconDefaultsProvider size={iconSize} color={leadingColor}>
|
|
177
|
+
{trailing}
|
|
178
|
+
</IconDefaultsProvider>
|
|
179
|
+
</View>
|
|
180
|
+
) : null}
|
|
142
181
|
</>
|
|
143
182
|
)
|
|
144
183
|
const interactive = filter || !!onPress
|
|
@@ -146,9 +185,13 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
146
185
|
const dim = android && disabled ? styles.dim : null
|
|
147
186
|
const handlers = {
|
|
148
187
|
...(filter ? spaceToggles(press) : {}),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
188
|
+
// A menu chip is a button that opens its menu, even when it shows a chosen filter
|
|
189
|
+
accessibilityRole: filter && !menu ? ("checkbox" as const) : ("button" as const),
|
|
190
|
+
accessibilityLabel,
|
|
191
|
+
accessibilityState: { disabled, checked: filter && !menu ? selected : undefined, selected: filter && menu && Platform.OS !== "web" ? selected : undefined, expanded },
|
|
192
|
+
"aria-checked": filter && !menu ? selected : undefined,
|
|
193
|
+
"aria-haspopup": menu ? (menu === true ? ("menu" as const) : menu) : undefined,
|
|
194
|
+
"aria-expanded": menu ? expanded : undefined,
|
|
152
195
|
disabled,
|
|
153
196
|
onPress: press,
|
|
154
197
|
onPressIn: () => setPressed(true),
|
|
@@ -2,6 +2,7 @@ import { useId, useState, type ReactNode } from "react"
|
|
|
2
2
|
import { Animated, KeyboardAvoidingView, Platform, Pressable, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native"
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
|
4
4
|
import { Glass } from "../../internal/Glass"
|
|
5
|
+
import { useRipple } from "../../internal/ripple"
|
|
5
6
|
import { useKeyboardHeight } from "../../internal/keyboard"
|
|
6
7
|
import { androidDialogMotion, canTransformGlass, glassOpacity, iosDim, Overlay, ANDROID_DIALOG, ANDROID_DIM } from "../../internal/Overlay"
|
|
7
8
|
import { withAlpha, dangerText } from "../../theme/material"
|
|
@@ -42,7 +43,7 @@ export type DialogProps = {
|
|
|
42
43
|
/**
|
|
43
44
|
* A dialog that asks for a decision: on iOS the alert of iOS 26 (UIAlertController `.alert`: 320 wide, glass, radius
|
|
44
45
|
* 34, capsule actions 48 tall, `--dialog-alert-*`, Dialog.module.css), on Android a flat alert (at most 356 wide,
|
|
45
|
-
* radius
|
|
46
|
+
* radius 21, a Medium 20 title over 16 text, text buttons in the accent at the end, Android's dialog animation). The
|
|
46
47
|
* web Dialog's `mobileVariant="alert"` as one call; a sheet is `BottomSheet`.
|
|
47
48
|
*/
|
|
48
49
|
export function Dialog({ open, onOpenChange, title, description, actions = [], children, mobileLayout, dismissible, testID }: DialogProps) {
|
|
@@ -183,8 +184,11 @@ export type ChoiceDialogProps = {
|
|
|
183
184
|
onClose: () => void
|
|
184
185
|
/** The setting's name, over the rows. */
|
|
185
186
|
title?: ReactNode
|
|
186
|
-
/** The
|
|
187
|
+
/** The button that closes the dialog with no change (the one button of a single choice). */
|
|
187
188
|
cancelLabel: string
|
|
189
|
+
/** A multiple choice's button after Cancel, which applies the rows checked (`onOk`) and closes the dialog. */
|
|
190
|
+
okLabel?: string
|
|
191
|
+
onOk?: () => void
|
|
188
192
|
/** The rows, across the dialog's whole width; they scroll under the title when the screen is short. */
|
|
189
193
|
children: ReactNode
|
|
190
194
|
/** Props for the element that holds the rows (its role and name). */
|
|
@@ -193,10 +197,11 @@ export type ChoiceDialogProps = {
|
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
/**
|
|
196
|
-
* Android's
|
|
197
|
-
*
|
|
200
|
+
* Android's choice alert: the dialog's panel, its title and rows across its width; one Cancel button for a single
|
|
201
|
+
* choice (a row picks and closes), Cancel and OK at the end, 8 apart, for a multiple one (the rows check, OK applies).
|
|
202
|
+
* Select's picker on Android; not part of the public API.
|
|
198
203
|
*/
|
|
199
|
-
export function ChoiceDialog({ open, onClose, title, cancelLabel, children, listProps, testID }: ChoiceDialogProps) {
|
|
204
|
+
export function ChoiceDialog({ open, onClose, title, cancelLabel, okLabel, onOk, children, listProps, testID }: ChoiceDialogProps) {
|
|
200
205
|
const theme = useTheme()
|
|
201
206
|
const ids = { title: useId(), description: useId() }
|
|
202
207
|
const a11y =
|
|
@@ -213,7 +218,14 @@ export function ChoiceDialog({ open, onClose, title, cancelLabel, children, list
|
|
|
213
218
|
<AndroidDialog
|
|
214
219
|
theme={theme}
|
|
215
220
|
title={title}
|
|
216
|
-
actions={
|
|
221
|
+
actions={
|
|
222
|
+
okLabel != null
|
|
223
|
+
? [
|
|
224
|
+
{ label: cancelLabel, variant: "cancel", testID: testID ? `${testID}-cancel` : undefined },
|
|
225
|
+
{ label: okLabel, preferred: true, onPress: onOk, testID: testID ? `${testID}-ok` : undefined },
|
|
226
|
+
]
|
|
227
|
+
: [{ label: cancelLabel, testID: testID ? `${testID}-cancel` : undefined }]
|
|
228
|
+
}
|
|
217
229
|
run={run}
|
|
218
230
|
ids={ids}
|
|
219
231
|
list={<View {...listProps}>{children}</View>}
|
|
@@ -366,27 +378,14 @@ function AndroidDialog({ theme, title, description, actions, run, ids, children,
|
|
|
366
378
|
const order = stacked ? [...bar.keys()].reverse() : [...bar.keys()]
|
|
367
379
|
const button = (index: number) => {
|
|
368
380
|
const action = bar[index]
|
|
369
|
-
// Android's dialog button: Medium 16 in the accent, red for a destructive one, half faded when
|
|
370
|
-
// disabled; its press a pill of the label's color at 10%
|
|
371
|
-
const color = action.variant === "destructive" ? dangerText(theme) : m.primary
|
|
372
381
|
return (
|
|
373
|
-
<
|
|
382
|
+
<AndroidDialogButton
|
|
374
383
|
key={actions.indexOf(action)}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const next = event.nativeEvent.layout.width
|
|
381
|
-
setWidths((current) => (current[index] === next ? current : Object.assign([...current], { [index]: next })))
|
|
382
|
-
}}
|
|
383
|
-
testID={action.testID}
|
|
384
|
-
style={({ pressed }) => [styles.androidButton, { opacity: action.disabled ? 0.5 : 1 }, pressed ? { backgroundColor: withAlpha(color, 0.1) } : null]}
|
|
385
|
-
>
|
|
386
|
-
<Text color={color} style={[styles.androidLabel, { ...theme.font("medium") }]}>
|
|
387
|
-
{action.label}
|
|
388
|
-
</Text>
|
|
389
|
-
</Pressable>
|
|
384
|
+
theme={theme}
|
|
385
|
+
action={action}
|
|
386
|
+
run={run}
|
|
387
|
+
onWidth={(next) => setWidths((current) => (current[index] === next ? current : Object.assign([...current], { [index]: next })))}
|
|
388
|
+
/>
|
|
390
389
|
)
|
|
391
390
|
}
|
|
392
391
|
return (
|
|
@@ -417,7 +416,7 @@ function AndroidDialog({ theme, title, description, actions, run, ids, children,
|
|
|
417
416
|
</ScrollView>
|
|
418
417
|
)}
|
|
419
418
|
{bar.length ? (
|
|
420
|
-
<View onLayout={(event) => setRoom(event.nativeEvent.layout.width - 16)} style={stacked ? styles.androidStack :
|
|
419
|
+
<View onLayout={(event) => setRoom(event.nativeEvent.layout.width - 16)} style={stacked ? styles.androidStack : styles.androidActions}>
|
|
421
420
|
{order.map((index) =>
|
|
422
421
|
// The neutral actions at the start, a space, then the negative and the positive
|
|
423
422
|
!stacked && index === neutral.length && neutral.length ? [<View key="space" style={styles.grow} />, button(index)] : button(index),
|
|
@@ -428,6 +427,36 @@ function AndroidDialog({ theme, title, description, actions, run, ids, children,
|
|
|
428
427
|
)
|
|
429
428
|
}
|
|
430
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Android's dialog button: Medium 16 in the accent, red for a destructive one, half faded when disabled; its press the
|
|
432
|
+
* ripple of the label's color at 10% from the touch point, clipped to its 20dp pill (the platform's on a device).
|
|
433
|
+
*/
|
|
434
|
+
function AndroidDialogButton({ theme, action, run, onWidth }: { theme: Theme; action: DialogAction; run: (action: DialogAction) => void; onWidth: (width: number) => void }) {
|
|
435
|
+
const color = action.variant === "destructive" ? dangerText(theme) : theme.material.primary
|
|
436
|
+
const press = withAlpha(color, 0.1)
|
|
437
|
+
const nativeRipple = Platform.OS === "android"
|
|
438
|
+
const ripple = useRipple(press, !nativeRipple, theme.reducedMotion)
|
|
439
|
+
return (
|
|
440
|
+
<Pressable
|
|
441
|
+
accessibilityRole="button"
|
|
442
|
+
accessibilityState={{ disabled: !!action.disabled }}
|
|
443
|
+
disabled={action.disabled}
|
|
444
|
+
onPress={() => run(action)}
|
|
445
|
+
onPressIn={nativeRipple ? undefined : ripple.start}
|
|
446
|
+
onPressOut={nativeRipple ? undefined : ripple.end}
|
|
447
|
+
android_ripple={nativeRipple ? { color: press, foreground: true } : undefined}
|
|
448
|
+
onLayout={(event) => onWidth(event.nativeEvent.layout.width)}
|
|
449
|
+
testID={action.testID}
|
|
450
|
+
style={[styles.androidButton, { opacity: action.disabled ? 0.5 : 1 }]}
|
|
451
|
+
>
|
|
452
|
+
{ripple.layer}
|
|
453
|
+
<Text color={color} style={[styles.androidLabel, { ...theme.font("medium") }]}>
|
|
454
|
+
{action.label}
|
|
455
|
+
</Text>
|
|
456
|
+
</Pressable>
|
|
457
|
+
)
|
|
458
|
+
}
|
|
459
|
+
|
|
431
460
|
/** The space between dialog buttons, in a row and stacked. */
|
|
432
461
|
const GAP = 8
|
|
433
462
|
|
|
@@ -441,21 +470,22 @@ const styles = StyleSheet.create({
|
|
|
441
470
|
grow: { flex: 1, flexBasis: 0 },
|
|
442
471
|
centered: { textAlign: "center" },
|
|
443
472
|
iosAction: { alignItems: "center", justifyContent: "center", paddingVertical: 13, paddingHorizontal: 16, borderCurve: "continuous" },
|
|
444
|
-
// Android's alert:
|
|
445
|
-
//
|
|
446
|
-
|
|
447
|
-
|
|
473
|
+
// Android's alert: 21dp corners (the catalog's); the text 24 in. Measured on the reference's alerts: the title's
|
|
474
|
+
// baseline 40 under the top, the message's first 33 under it in lines 18.75 apart (16sp Roboto's), its last 59
|
|
475
|
+
// over the buttons' (Roboto's font padding sets these 2 to 3 lower than the layout's 19, 10 and 20 would)
|
|
476
|
+
android: { flexShrink: 1, borderRadius: 21, overflow: "hidden" },
|
|
477
|
+
androidText: { paddingHorizontal: 24, paddingTop: 21, paddingBottom: 21, gap: 13 },
|
|
448
478
|
androidTitle: { fontSize: 20, lineHeight: 24 },
|
|
449
|
-
// Over a list the title keeps its 24 at the sides
|
|
450
|
-
|
|
479
|
+
// Over a list the title keeps its 24 at the sides, its line 21 under the panel's top (its capitals 25 under it and
|
|
480
|
+
// its baseline 40, as the reference's) and 11 over the rows, which start 56 under the top (the first radio at 71), as
|
|
481
|
+
// the web's
|
|
482
|
+
androidListTitle: { paddingHorizontal: 24, paddingTop: 21, paddingBottom: 11 },
|
|
451
483
|
// A list with no title starts 8 under the panel's top
|
|
452
484
|
androidListTop: { paddingTop: 8 },
|
|
453
|
-
androidMessage: { fontSize: 16, lineHeight:
|
|
485
|
+
androidMessage: { fontSize: 16, lineHeight: 18.75 },
|
|
454
486
|
androidContent: { marginTop: 6 },
|
|
455
|
-
// The button row:
|
|
456
|
-
androidActions: { flexDirection: "row", justifyContent: "flex-end", alignItems: "center", gap: GAP, paddingHorizontal: 8, paddingVertical:
|
|
457
|
-
// Under a list of choices the row is 56: 8 over and under the buttons (measured on the platform's single-choice dialog)
|
|
458
|
-
androidListActions: { paddingVertical: 8 },
|
|
487
|
+
// The button row: 56 tall (8 over and under its 40dp buttons, measured on the reference's alerts), 8 in from the sides
|
|
488
|
+
androidActions: { flexDirection: "row", justifyContent: "flex-end", alignItems: "center", gap: GAP, paddingHorizontal: 8, paddingVertical: 8 },
|
|
459
489
|
// Stacked: 8 over and under the 40dp buttons (two make 96)
|
|
460
490
|
androidStack: { alignItems: "flex-end", paddingHorizontal: 8, paddingVertical: 8 },
|
|
461
491
|
// Android's dialog button: 40 tall, at least 64 wide, 12 at the sides; at least 40, so a larger font grows it
|
|
@@ -467,6 +497,7 @@ const styles = StyleSheet.create({
|
|
|
467
497
|
paddingHorizontal: 12,
|
|
468
498
|
paddingVertical: 8,
|
|
469
499
|
borderRadius: 20,
|
|
500
|
+
overflow: "hidden",
|
|
470
501
|
alignItems: "center",
|
|
471
502
|
justifyContent: "center",
|
|
472
503
|
},
|