@vvedantb/native-ui 0.23.0 → 0.24.1

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 CHANGED
@@ -22,7 +22,7 @@ Peers the app must already have (Expo SDK 57 / RN 0.76+):
22
22
  Optional, only if you import those components:
23
23
 
24
24
  - `@rn-primitives/portal` — `Select`. Mount one `<PortalHost />` from this package at the app root (for example in the root layout), outside any `Modal`. The package does not re-export it, so install it with `@rn-primitives/select`.
25
- - `@gorhom/bottom-sheet` — `BottomSheetContainer`
25
+ - `@swmansion/react-native-bottom-sheet` — `BottomSheetContainer`. It needs the New Architecture, React Native 0.82 or later and a native build (no Expo Go), and no root provider.
26
26
  - `@react-native-community/datetimepicker` and `dayjs` — `DateTimeField`
27
27
  - `@clerk/clerk-expo`, `convex`, `expo-auth-session`, `expo-web-browser` and `expo-router` — `@vvedantb/native-ui/auth` (0.7.0). `expo-router` also for `@vvedantb/native-ui/expo-web-root`.
28
28
  - `react-native-gesture-handler` (`>=2.0.0`) — `@vvedantb/native-ui/gesture-handler` (Unreleased). Wrap the app in `GestureHandlerRootView`, and put `GestureHandlerProvider` from that entry inside it: the sheet drags (`SheetContent`, the compact `DialogContent`) then run on Gesture Handler, on the UI thread, and each overlay's `Modal` gets its own root view (Android needs one in every `Modal`). It also turns on the `SwipeableRow` swipe. Without the provider, the sheets drag with `PanResponder`, with the same rules, and a `SwipeableRow` does not swipe. Only that entry imports the peer, so an app without it bundles as before. In a Metro monorepo, resolve the peer from the app (one copy), as for `react`.
@@ -75,7 +75,7 @@ The `Select` note stays: mount one `<PortalHost />` from `@rn-primitives/portal`
75
75
 
76
76
  ## Entry points
77
77
 
78
- The root entry exports everything. It still imports `BottomSheetContainer` and `DateTimeField`, so Metro resolves `@gorhom/bottom-sheet`, `@react-native-community/datetimepicker` and `dayjs` for any import from it. Apps without those peers, such as V Store, should import from the smaller entries below. Between them, they export every name the root exports.
78
+ The root entry exports everything. It still imports `BottomSheetContainer` and `DateTimeField`, so Metro resolves `@swmansion/react-native-bottom-sheet`, `@react-native-community/datetimepicker` and `dayjs` for any import from it. Apps without those peers, such as V Store, should import from the smaller entries below. Between them, they export every name the root exports.
79
79
 
80
80
  | Entry | Exports | Optional peers it reaches |
81
81
  | --- | --- | --- |
@@ -94,7 +94,7 @@ The root entry exports everything. It still imports `BottomSheetContainer` and `
94
94
  | `@vvedantb/native-ui/ambient` | `AmbientBackground` | `expo-linear-gradient` (loader) |
95
95
  | `@vvedantb/native-ui/blur`, `/haptics` | the loaders | `expo-blur`, `expo-haptics` (loaders) |
96
96
  | `@vvedantb/native-ui/push` | `useExpoPushRegistration`, `getExpoPushToken`, `showPushesInForeground`, the three loaders and the types (0.9.0). Pass `register` from your backend (for `@vvedantb/server`: `useMutation(api.push.register)`) and route taps in `onNotificationTap` | `expo-notifications`, `expo-constants`, `expo-device` (loaders) |
97
- | `@vvedantb/native-ui/bottom-sheet` | `BottomSheetContainer` | `@gorhom/bottom-sheet` (import), `expo-blur` (loader) |
97
+ | `@vvedantb/native-ui/bottom-sheet` | `BottomSheetContainer` | `@swmansion/react-native-bottom-sheet` (import) |
98
98
  | `@vvedantb/native-ui/gesture-handler` | `GestureHandlerProvider` (Unreleased): the sheet drags on Gesture Handler, and the `SwipeableRow` swipe | `react-native-gesture-handler` (import) |
99
99
  | `@vvedantb/native-ui/keyboard-controller` | `KeyboardControllerProvider` (Unreleased): the composer, transcript and forms follow the keyboard | `react-native-keyboard-controller` (import) |
100
100
  | `@vvedantb/native-ui/date-time` | `DateTimeField`, `DateTimeFieldProps` (0.5.0) | `@react-native-community/datetimepicker`, `dayjs` (import) |
@@ -348,7 +348,7 @@ configureTheme({ font: { regular: "Inter_400Regular", medium: "Inter_500Medium",
348
348
  | Actions and fields | `Button` (`default`/`primary`, `secondary`, `outline`, `destructive`, `ghost`, `link`, `tinted`; `sm`/`small`, `default`/`medium`, `lg`/`large`, `icon`; `shape` `pill`/`rounded` from 0.6.0), `IconButton` (0.5.0), `CaptureButton` (0.5.0), `Input`, `SearchInput` (0.3.9), `PasswordInput` (0.11.0), `Textarea`, `Label`, `Select`, `Switch`, `Checkbox`, `LabeledSwitchRow`, `ColorSwatches` (0.5.0), `DateTimeField` (date-only, empty and clearable from 0.5.0) |
349
349
  | Display | `Card` (+ `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`; `onPress` from 0.5.0), `Badge`, `StatusDot` (`info` from 0.5.0), `Avatar` (+ `AvatarImage`, `AvatarFallback`, `initials()`), `Separator`, `Progress`, `Spinner`, `CenteredSpinner`, `Skeleton`, `EmptyState` (+ `EmptyState.Root` and parts), `ListRow` (`leading`, `titleEnd`, `control`, `onLongPress` from 0.5.0), `StatGrid` (0.5.0), `SectionLabel` (0.5.0), `Chip`, `Text` (0.5.0, `/primitives` only) |
350
350
  | Navigation | `Tabs` (+ `TabsList`, `TabsTrigger` (`minHeight` from 0.14.0), `TabsContent`), `PillTabs`, `PageIndicator` (0.5.0), `FloatingTabBar`, `FloatingFAB`, `HeaderIconButton`, `ThemeToggle` (0.3.16), `StackPageHeader` (0.5.0) |
351
- | Overlays | `Dialog`, `AlertDialog`, `ConfirmDialog`, `Sheet` (RN `Modal`, each with the web part names; a `SheetContent` or compact `DialogContent` drags down to close), `SheetRow` (0.5.0), `BottomSheetContainer` (`@gorhom/bottom-sheet`), `DropdownMenu` (Unreleased; see below) |
351
+ | Overlays | `Dialog`, `AlertDialog`, `ConfirmDialog`, `Sheet` (RN `Modal`, each with the web part names; a `SheetContent` or compact `DialogContent` drags down to close), `SheetRow` (0.5.0), `BottomSheetContainer` (`@swmansion/react-native-bottom-sheet`; optional `detents`), `DropdownMenu` (Unreleased; see below) |
352
352
  | Selection | `BulkActionBar` (Unreleased; see below) |
353
353
  | Feedback | `toast()` and `<Toaster />` |
354
354
  | Brand and upgrade | `APP_ICONS`, `IconVibot` and the other `Icon*`, `AppMark`, `AppWordmark`, `GoogleMark` (0.3.15), `FAMILY_APPS`, `V_PRO_APP_BENEFITS`, `UpgradeToProCard`, `PricingModal` |
@@ -614,7 +614,7 @@ import {
614
614
  ```
615
615
 
616
616
  - `Message`: `onLongPress`, `actions` (`{ key, label, icon?, destructive?, onPress }[]`), `actionSheetTitle`, `highlighted`. With neither `onLongPress` nor `actions` it is the same `View` as before. With either it is a `Pressable` with the same layout and view props, and it stays a non-accessible container so inner buttons keep focus: also offer Reply in a `MessageActionsBar` for screen reader users. `highlighted` draws a primary wash that fades over 1.4 seconds (`MESSAGE_HIGHLIGHT_MS`) and a ring while true; with Reduce Motion it holds still. Set it back to `false` after the scroll.
617
- - `MessageActionSheet` (`open`, `onClose`, `actions`, `title`, `cancelLabel`, `testID`): an RN `Modal` bottom sheet, no `@gorhom/bottom-sheet`. Closes on the backdrop, Cancel, Android back and after an action. Destructive rows use the danger colour. Rows are 48 high (56 with larger text).
617
+ - `MessageActionSheet` (`open`, `onClose`, `actions`, `title`, `cancelLabel`, `testID`): an RN `Modal` bottom sheet that needs no bottom-sheet library. Closes on the backdrop, Cancel, Android back and after an action. Destructive rows use the danger colour. Rows are 48 high (56 with larger text).
618
618
  - `ReplyQuoteChip` (`author`, `text`, `onDismiss`, `dismissLabel`, `accessibilityLabel`, `testID`): author and up to two lines of text, with an X (44 point target, "Dismiss reply quote"). Labelled "Replying to {author}". `PromptInput` `replyTo` draws it above `header`; passing it as `header` works too.
619
619
  - `MessageQuote` (`author`, `text`, `onPress`, `accessibilityLabel`, `testID`): a left border, the author and up to two lines. With `onPress` it is a button.
620
620
  - Bot label in a group chat (0.13.0): `<Message from="assistant" bot={{ name: "Planner", avatar: <Avatar size="xs" /> }}>`. Or leave `Message` alone and render `<MessageBotLabel name="Planner" />` above `MessageContent` in `ChatThread` `renderMessage`. `ChatThread` needs no change.
@@ -1,208 +1,301 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import BottomSheet, { BottomSheetBackdrop, BottomSheetView } from "@gorhom/bottom-sheet";
2
+ import { ModalBottomSheet } from "@swmansion/react-native-bottom-sheet";
3
3
  import { IconX } from "@tabler/icons-react-native";
4
- import React, { useCallback } from "react";
5
- import { Platform, Text, TouchableOpacity, View } from "react-native";
4
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
5
+ import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
6
6
  import { Colors } from "./colors";
7
7
  import { textStyle, typeStyle } from "./controlStyles";
8
8
  import { floatingSolidFill } from "./floating";
9
- import { GlassSheetBackground } from "./LiquidGlass";
9
+ import { withAlpha } from "./palette";
10
10
  import { useLargerText } from "./theme";
11
+ import { tokens } from "./tokens";
11
12
  import { useScheme } from "./useScheme";
12
-
13
- // One snap point, set explicitly. With dynamic sizing the sheet can measure to
14
- // height 0 on Android and never appear.
15
- const SNAP_POINTS = ["40%"];
16
13
  const SHEET_RADIUS = 20;
17
14
 
18
- /**
19
- * Opaque sheet chrome for Android. The glass background needs a measured blur
20
- * target, which is not reliable once an RN `Modal` has been dismissed.
21
- */
22
- function SolidSheetBackground(t0) {
23
- const $ = _c(8);
24
- const {
25
- style,
26
- pointerEvents
27
- } = t0;
28
- const scheme = useScheme();
29
- const t1 = floatingSolidFill[scheme];
30
- let t2;
31
- if ($[0] !== t1) {
32
- t2 = {
33
- backgroundColor: t1,
34
- borderTopLeftRadius: SHEET_RADIUS,
35
- borderTopRightRadius: SHEET_RADIUS
36
- };
37
- $[0] = t1;
38
- $[1] = t2;
39
- } else {
40
- t2 = $[1];
41
- }
42
- let t3;
43
- if ($[2] !== style || $[3] !== t2) {
44
- t3 = [style, t2];
45
- $[2] = style;
46
- $[3] = t2;
47
- $[4] = t3;
48
- } else {
49
- t3 = $[4];
50
- }
51
- let t4;
52
- if ($[5] !== pointerEvents || $[6] !== t3) {
53
- t4 = <View pointerEvents={pointerEvents} style={t3} />;
54
- $[5] = pointerEvents;
55
- $[6] = t3;
56
- $[7] = t4;
57
- } else {
58
- t4 = $[7];
59
- }
60
- return t4;
61
- }
62
- function SheetBackdrop(props) {
63
- const $ = _c(2);
64
- let t0;
65
- if ($[0] !== props) {
66
- t0 = <BottomSheetBackdrop {...props} appearsOnIndex={0} disappearsOnIndex={-1} opacity={0.5} />;
67
- $[0] = props;
68
- $[1] = t0;
69
- } else {
70
- t0 = $[1];
71
- }
72
- return t0;
73
- }
15
+ // A single open detent at 40% by default. A caller can pass several detents for
16
+ // multi-detent sizing. The closed detent (0) is added by the component.
17
+ const DEFAULT_DETENTS = ["40%"];
18
+
19
+ // A dimming scrim. The library scales this alpha to 0 at the closed detent and to
20
+ // full at an open one.
21
+ const SCRIM_COLOR = "rgba(0, 0, 0, 0.5)";
74
22
 
75
23
  /**
76
- * A controlled bottom sheet over the screen, built on gorhom's default-export
77
- * `BottomSheet` (the named `BottomSheet` export is undefined).
24
+ * A controlled bottom sheet over the screen, driven by `visible` and `onClose`,
25
+ * with a title and a close button.
26
+ *
27
+ * It is built on `ModalBottomSheet` from Software Mansion's
28
+ * `@swmansion/react-native-bottom-sheet` in `windowOverlay` mode, so it needs no
29
+ * root provider. The library needs the New Architecture, React Native 0.82 or
30
+ * later and a native build (no Expo Go).
78
31
  *
79
- * It renders nothing while `visible` is false. A closed gorhom sheet still lays
80
- * out an absolute-fill host that can cover the triggers beneath it, and
81
- * `BottomSheetModal.present()` did nothing after an RN `Modal` had been
82
- * dismissed on Android.
32
+ * `detents` sets the open detents, shortest first. The default is a single 40%
33
+ * detent. The closed detent is added by the component.
83
34
  */
84
35
  export function BottomSheetContainer(t0) {
85
- const $ = _c(29);
36
+ const $ = _c(54);
86
37
  const {
87
38
  visible,
88
39
  onClose,
89
40
  title,
90
41
  children,
91
- closeTestID
42
+ closeTestID,
43
+ detents: t1
92
44
  } = t0;
45
+ const detents = t1 === undefined ? DEFAULT_DETENTS : t1;
93
46
  const largerText = useLargerText();
94
- const isDark = useScheme() === "dark";
95
- const renderBackdrop = _temp;
96
- if (!visible) {
97
- return null;
98
- }
99
- const t1 = isDark ? Colors.white : Colors.neutral[800];
47
+ const scheme = useScheme();
48
+ const isDark = scheme === "dark";
100
49
  let t2;
101
- if ($[0] !== t1) {
102
- t2 = {
103
- backgroundColor: t1
104
- };
105
- $[0] = t1;
50
+ if ($[0] !== detents) {
51
+ t2 = [0, ...detents];
52
+ $[0] = detents;
106
53
  $[1] = t2;
107
54
  } else {
108
55
  t2 = $[1];
109
56
  }
57
+ const detentList = t2;
58
+ const [index, setIndex] = useState(0);
110
59
  let t3;
111
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
112
- t3 = {
113
- padding: 20,
114
- paddingBottom: 48
60
+ let t4;
61
+ if ($[2] !== visible) {
62
+ t3 = () => {
63
+ setIndex(current => visible ? current === 0 ? 1 : current : 0);
115
64
  };
116
- $[2] = t3;
65
+ t4 = [visible];
66
+ $[2] = visible;
67
+ $[3] = t3;
68
+ $[4] = t4;
117
69
  } else {
118
- t3 = $[2];
70
+ t3 = $[3];
71
+ t4 = $[4];
119
72
  }
120
- const t4 = `${largerText ? "text-2xl" : "text-xl"} flex-1 font-instrument-sans-semibold`;
121
- const t5 = isDark ? "dark" : "light";
122
- let t6;
123
- if ($[3] !== t5) {
124
- t6 = textStyle("foreground", t5);
125
- $[3] = t5;
126
- $[4] = t6;
73
+ useEffect(t3, t4);
74
+ let t5;
75
+ if ($[5] !== onClose) {
76
+ t5 = next => {
77
+ setIndex(next);
78
+ if (next === 0) {
79
+ onClose();
80
+ }
81
+ };
82
+ $[5] = onClose;
83
+ $[6] = t5;
127
84
  } else {
128
- t6 = $[4];
85
+ t5 = $[6];
129
86
  }
130
- let t7;
131
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
132
- t7 = typeStyle("semibold");
133
- $[5] = t7;
87
+ const handleIndexChange = t5;
88
+ let t6;
89
+ if ($[7] !== onClose) {
90
+ t6 = () => {
91
+ setIndex(0);
92
+ onClose();
93
+ };
94
+ $[7] = onClose;
95
+ $[8] = t6;
134
96
  } else {
135
- t7 = $[5];
97
+ t6 = $[8];
136
98
  }
99
+ const handleCloseRequest = t6;
100
+ const t7 = floatingSolidFill[scheme];
137
101
  let t8;
138
- if ($[6] !== t6) {
139
- t8 = [t6, t7];
140
- $[6] = t6;
141
- $[7] = t8;
102
+ if ($[9] !== t7) {
103
+ t8 = <View style={[StyleSheet.absoluteFill, {
104
+ backgroundColor: t7
105
+ }]} />;
106
+ $[9] = t7;
107
+ $[10] = t8;
142
108
  } else {
143
- t8 = $[7];
109
+ t8 = $[10];
144
110
  }
111
+ const surface = t8;
145
112
  let t9;
146
- if ($[8] !== t4 || $[9] !== t8 || $[10] !== title) {
147
- t9 = <Text accessibilityRole="header" className={t4} style={t8}>{title}</Text>;
148
- $[8] = t4;
149
- $[9] = t8;
150
- $[10] = title;
113
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
114
+ t9 = {
115
+ borderTopLeftRadius: SHEET_RADIUS,
116
+ borderTopRightRadius: SHEET_RADIUS
117
+ };
151
118
  $[11] = t9;
152
119
  } else {
153
120
  t9 = $[11];
154
121
  }
155
- const t10 = largerText ? 32 : 28;
156
- const t11 = isDark ? "white" : "black";
157
- let t12;
158
- if ($[12] !== t10 || $[13] !== t11) {
159
- t12 = <IconX size={t10} color={t11} />;
122
+ let t10;
123
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
124
+ t10 = {
125
+ flex: 1,
126
+ paddingTop: 12
127
+ };
160
128
  $[12] = t10;
129
+ } else {
130
+ t10 = $[12];
131
+ }
132
+ const t11 = tokens.color.muted[scheme];
133
+ let t12;
134
+ if ($[13] !== t11) {
135
+ t12 = withAlpha(t11, 0.4);
161
136
  $[13] = t11;
162
137
  $[14] = t12;
163
138
  } else {
164
139
  t12 = $[14];
165
140
  }
166
141
  let t13;
167
- if ($[15] !== closeTestID || $[16] !== onClose || $[17] !== t12) {
168
- t13 = <TouchableOpacity testID={closeTestID} accessibilityRole="button" accessibilityLabel="Close" onPress={onClose} className="-mr-2 h-12 w-12 items-center justify-center" hitSlop={8} activeOpacity={0.7}>{t12}</TouchableOpacity>;
169
- $[15] = closeTestID;
170
- $[16] = onClose;
171
- $[17] = t12;
172
- $[18] = t13;
142
+ if ($[15] !== t12) {
143
+ t13 = <View accessibilityElementsHidden={true} importantForAccessibility="no-hide-descendants" style={{
144
+ alignSelf: "center",
145
+ height: 6,
146
+ width: 40,
147
+ borderRadius: 999,
148
+ backgroundColor: t12
149
+ }} />;
150
+ $[15] = t12;
151
+ $[16] = t13;
173
152
  } else {
174
- t13 = $[18];
153
+ t13 = $[16];
175
154
  }
176
155
  let t14;
177
- if ($[19] !== t13 || $[20] !== t9) {
178
- t14 = <View className="mb-4 flex-row items-center justify-between gap-3">{t9}{t13}</View>;
179
- $[19] = t13;
180
- $[20] = t9;
181
- $[21] = t14;
156
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
157
+ t14 = {
158
+ flexDirection: "row",
159
+ alignItems: "center",
160
+ justifyContent: "space-between",
161
+ gap: 12,
162
+ paddingHorizontal: 20,
163
+ marginTop: 16,
164
+ marginBottom: 16
165
+ };
166
+ $[17] = t14;
167
+ } else {
168
+ t14 = $[17];
169
+ }
170
+ const t15 = largerText ? 24 : 20;
171
+ let t16;
172
+ if ($[18] !== t15) {
173
+ t16 = {
174
+ flex: 1,
175
+ fontSize: t15
176
+ };
177
+ $[18] = t15;
178
+ $[19] = t16;
182
179
  } else {
183
- t14 = $[21];
180
+ t16 = $[19];
184
181
  }
185
- let t15;
186
- if ($[22] !== children || $[23] !== t14) {
187
- t15 = <BottomSheetView style={t3}>{t14}{children}</BottomSheetView>;
188
- $[22] = children;
189
- $[23] = t14;
190
- $[24] = t15;
182
+ let t17;
183
+ if ($[20] !== scheme) {
184
+ t17 = textStyle("foreground", scheme);
185
+ $[20] = scheme;
186
+ $[21] = t17;
191
187
  } else {
192
- t15 = $[24];
188
+ t17 = $[21];
193
189
  }
194
- let t16;
195
- if ($[25] !== onClose || $[26] !== t15 || $[27] !== t2) {
196
- t16 = <BottomSheet index={0} snapPoints={SNAP_POINTS} enableDynamicSizing={false} enablePanDownToClose={true} enableContentPanningGesture={false} enableHandlePanningGesture={true} keyboardBehavior="interactive" onClose={onClose} backdropComponent={renderBackdrop} backgroundComponent={Platform.OS === "android" ? SolidSheetBackground : GlassSheetBackground} handleIndicatorStyle={t2}>{t15}</BottomSheet>;
197
- $[25] = onClose;
198
- $[26] = t15;
199
- $[27] = t2;
200
- $[28] = t16;
190
+ let t18;
191
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
192
+ t18 = typeStyle("semibold");
193
+ $[22] = t18;
201
194
  } else {
202
- t16 = $[28];
195
+ t18 = $[22];
203
196
  }
204
- return t16;
205
- }
206
- function _temp(props) {
207
- return <SheetBackdrop {...props} />;
197
+ let t19;
198
+ if ($[23] !== t16 || $[24] !== t17) {
199
+ t19 = [t16, t17, t18];
200
+ $[23] = t16;
201
+ $[24] = t17;
202
+ $[25] = t19;
203
+ } else {
204
+ t19 = $[25];
205
+ }
206
+ let t20;
207
+ if ($[26] !== t19 || $[27] !== title) {
208
+ t20 = <Text accessibilityRole="header" style={t19}>{title}</Text>;
209
+ $[26] = t19;
210
+ $[27] = title;
211
+ $[28] = t20;
212
+ } else {
213
+ t20 = $[28];
214
+ }
215
+ let t21;
216
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
217
+ t21 = {
218
+ marginRight: -8,
219
+ height: 48,
220
+ width: 48,
221
+ alignItems: "center",
222
+ justifyContent: "center"
223
+ };
224
+ $[29] = t21;
225
+ } else {
226
+ t21 = $[29];
227
+ }
228
+ const t22 = largerText ? 32 : 28;
229
+ const t23 = isDark ? Colors.white : Colors.black;
230
+ let t24;
231
+ if ($[30] !== t22 || $[31] !== t23) {
232
+ t24 = <IconX size={t22} color={t23} />;
233
+ $[30] = t22;
234
+ $[31] = t23;
235
+ $[32] = t24;
236
+ } else {
237
+ t24 = $[32];
238
+ }
239
+ let t25;
240
+ if ($[33] !== closeTestID || $[34] !== handleCloseRequest || $[35] !== t24) {
241
+ t25 = <TouchableOpacity testID={closeTestID} accessibilityRole="button" accessibilityLabel="Close" onPress={handleCloseRequest} style={t21} hitSlop={8} activeOpacity={0.7}>{t24}</TouchableOpacity>;
242
+ $[33] = closeTestID;
243
+ $[34] = handleCloseRequest;
244
+ $[35] = t24;
245
+ $[36] = t25;
246
+ } else {
247
+ t25 = $[36];
248
+ }
249
+ let t26;
250
+ if ($[37] !== t20 || $[38] !== t25) {
251
+ t26 = <View style={t14}>{t20}{t25}</View>;
252
+ $[37] = t20;
253
+ $[38] = t25;
254
+ $[39] = t26;
255
+ } else {
256
+ t26 = $[39];
257
+ }
258
+ let t27;
259
+ if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
260
+ t27 = {
261
+ flex: 1,
262
+ paddingHorizontal: 20,
263
+ paddingBottom: 48
264
+ };
265
+ $[40] = t27;
266
+ } else {
267
+ t27 = $[40];
268
+ }
269
+ let t28;
270
+ if ($[41] !== children) {
271
+ t28 = <View style={t27}>{children}</View>;
272
+ $[41] = children;
273
+ $[42] = t28;
274
+ } else {
275
+ t28 = $[42];
276
+ }
277
+ let t29;
278
+ if ($[43] !== t13 || $[44] !== t26 || $[45] !== t28) {
279
+ t29 = <View style={t10}>{t13}{t26}{t28}</View>;
280
+ $[43] = t13;
281
+ $[44] = t26;
282
+ $[45] = t28;
283
+ $[46] = t29;
284
+ } else {
285
+ t29 = $[46];
286
+ }
287
+ let t30;
288
+ if ($[47] !== detentList || $[48] !== handleCloseRequest || $[49] !== handleIndexChange || $[50] !== index || $[51] !== surface || $[52] !== t29) {
289
+ t30 = <ModalBottomSheet index={index} detents={detentList} lazy={true} windowOverlay={true} scrimColor={SCRIM_COLOR} scrimAccessibilityLabel="Close" surface={surface} surfaceStyle={t9} onIndexChange={handleIndexChange} onCloseRequest={handleCloseRequest}>{t29}</ModalBottomSheet>;
290
+ $[47] = detentList;
291
+ $[48] = handleCloseRequest;
292
+ $[49] = handleIndexChange;
293
+ $[50] = index;
294
+ $[51] = surface;
295
+ $[52] = t29;
296
+ $[53] = t30;
297
+ } else {
298
+ t30 = $[53];
299
+ }
300
+ return t30;
208
301
  }
@@ -1,6 +1,8 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { Pressable, View } from "react-native";
2
+ import { Pressable } from "react-native";
3
+ import Animated from "react-native-reanimated";
3
4
  import { cn } from "./cn";
5
+ import { usePressScale } from "./pressScale";
4
6
  import { withAlpha } from "./palette";
5
7
  import { tokens } from "./tokens";
6
8
  /** Shutter metrics: outer diameter, ring width and the gap inside the ring. */
@@ -12,12 +14,13 @@ export const CAPTURE_BUTTON = {
12
14
 
13
15
  /**
14
16
  * A camera shutter: a 76 white ring around a white disc, for a live preview in
15
- * light and dark alike. The disc shrinks to 90% while pressed. Larger than the
17
+ * light and dark alike. The disc eases down to 90% in 100 ms while pressed
18
+ * and back in 160 ms; with Reduce Motion it dims instead. Larger than the
16
19
  * 44 target, so it needs no hit slop. A labelled button, dimmed and ignoring
17
20
  * presses when `disabled`.
18
21
  */
19
22
  export function CaptureButton(t0) {
20
- const $ = _c(15);
23
+ const $ = _c(20);
21
24
  const {
22
25
  onPress,
23
26
  disabled: t1,
@@ -35,6 +38,10 @@ export function CaptureButton(t0) {
35
38
  let t3;
36
39
  if ($[0] !== disabled) {
37
40
  t3 = {
41
+ scale: 0.9,
42
+ dim: 1,
43
+ reducedDim: 0.7,
44
+ pressInMs: 100,
38
45
  disabled
39
46
  };
40
47
  $[0] = disabled;
@@ -42,18 +49,31 @@ export function CaptureButton(t0) {
42
49
  } else {
43
50
  t3 = $[1];
44
51
  }
45
- const t4 = disabled && "opacity-50";
46
- let t5;
47
- if ($[2] !== t4) {
48
- t5 = cn("items-center justify-center", t4);
49
- $[2] = t4;
50
- $[3] = t5;
52
+ const press = usePressScale(t3);
53
+ let t4;
54
+ if ($[2] !== disabled) {
55
+ t4 = {
56
+ disabled
57
+ };
58
+ $[2] = disabled;
59
+ $[3] = t4;
60
+ } else {
61
+ t4 = $[3];
62
+ }
63
+ const t5 = press.onPressIn;
64
+ const t6 = press.onPressOut;
65
+ const t7 = disabled && "opacity-50";
66
+ let t8;
67
+ if ($[4] !== t7) {
68
+ t8 = cn("items-center justify-center", t7);
69
+ $[4] = t7;
70
+ $[5] = t8;
51
71
  } else {
52
- t5 = $[3];
72
+ t8 = $[5];
53
73
  }
54
- let t6;
55
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
56
- t6 = {
74
+ let t9;
75
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
76
+ t9 = {
57
77
  width: size,
58
78
  height: size,
59
79
  borderRadius: size / 2,
@@ -61,44 +81,45 @@ export function CaptureButton(t0) {
61
81
  borderColor: tokens.color.white,
62
82
  backgroundColor: withAlpha(tokens.color.black, 0.15)
63
83
  };
64
- $[4] = t6;
84
+ $[6] = t9;
65
85
  } else {
66
- t6 = $[4];
86
+ t9 = $[6];
67
87
  }
68
- let t7;
69
- if ($[5] !== disabled) {
70
- t7 = t8 => {
71
- const {
72
- pressed
73
- } = t8;
74
- return <View style={{
75
- width: inner,
76
- height: inner,
77
- borderRadius: inner / 2,
78
- backgroundColor: tokens.color.white,
79
- transform: [{
80
- scale: pressed && !disabled ? 0.9 : 1
81
- }]
82
- }} />;
88
+ let t10;
89
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
90
+ t10 = {
91
+ width: inner,
92
+ height: inner,
93
+ borderRadius: inner / 2,
94
+ backgroundColor: tokens.color.white
83
95
  };
84
- $[5] = disabled;
85
- $[6] = t7;
96
+ $[7] = t10;
86
97
  } else {
87
- t7 = $[6];
98
+ t10 = $[7];
88
99
  }
89
- let t8;
90
- if ($[7] !== accessibilityLabel || $[8] !== disabled || $[9] !== onPress || $[10] !== t3 || $[11] !== t5 || $[12] !== t7 || $[13] !== testID) {
91
- t8 = <Pressable testID={testID} accessibilityRole="button" accessibilityLabel={accessibilityLabel} accessibilityState={t3} disabled={disabled} onPress={onPress} className={t5} style={t6}>{t7}</Pressable>;
92
- $[7] = accessibilityLabel;
93
- $[8] = disabled;
94
- $[9] = onPress;
95
- $[10] = t3;
96
- $[11] = t5;
97
- $[12] = t7;
98
- $[13] = testID;
99
- $[14] = t8;
100
+ let t11;
101
+ if ($[8] !== press.style) {
102
+ t11 = <Animated.View style={[t10, press.style]} />;
103
+ $[8] = press.style;
104
+ $[9] = t11;
105
+ } else {
106
+ t11 = $[9];
107
+ }
108
+ let t12;
109
+ if ($[10] !== accessibilityLabel || $[11] !== disabled || $[12] !== onPress || $[13] !== press.onPressIn || $[14] !== press.onPressOut || $[15] !== t11 || $[16] !== t4 || $[17] !== t8 || $[18] !== testID) {
110
+ t12 = <Pressable testID={testID} accessibilityRole="button" accessibilityLabel={accessibilityLabel} accessibilityState={t4} disabled={disabled} onPress={onPress} onPressIn={t5} onPressOut={t6} className={t8} style={t9}>{t11}</Pressable>;
111
+ $[10] = accessibilityLabel;
112
+ $[11] = disabled;
113
+ $[12] = onPress;
114
+ $[13] = press.onPressIn;
115
+ $[14] = press.onPressOut;
116
+ $[15] = t11;
117
+ $[16] = t4;
118
+ $[17] = t8;
119
+ $[18] = testID;
120
+ $[19] = t12;
100
121
  } else {
101
- t8 = $[14];
122
+ t12 = $[19];
102
123
  }
103
- return t8;
124
+ return t12;
104
125
  }