@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.
@@ -1,75 +1,37 @@
1
- import BottomSheet, {
2
- BottomSheetBackdrop,
3
- BottomSheetView,
4
- } from "@gorhom/bottom-sheet";
5
- import type { BottomSheetDefaultBackdropProps } from "@gorhom/bottom-sheet/lib/typescript/components/bottomSheetBackdrop/types";
1
+ import { ModalBottomSheet } from "@swmansion/react-native-bottom-sheet";
2
+ import type { ModalDetent } from "@swmansion/react-native-bottom-sheet";
6
3
  import { IconX } from "@tabler/icons-react-native";
7
- import React, { useCallback } from "react";
8
- import {
9
- Platform,
10
- Text,
11
- TouchableOpacity,
12
- View,
13
- type ViewProps,
14
- } from "react-native";
4
+ import React, { useCallback, useEffect, useMemo, useState } from "react";
5
+ import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
15
6
  import { Colors } from "./colors";
16
7
  import { textStyle, typeStyle } from "./controlStyles";
17
8
  import { floatingSolidFill } from "./floating";
18
- import { GlassSheetBackground } from "./LiquidGlass";
9
+ import { withAlpha } from "./palette";
19
10
  import { useLargerText } from "./theme";
11
+ import { tokens } from "./tokens";
20
12
  import { useScheme } from "./useScheme";
21
13
 
22
- // One snap point, set explicitly. With dynamic sizing the sheet can measure to
23
- // height 0 on Android and never appear.
24
- const SNAP_POINTS = ["40%"];
25
14
  const SHEET_RADIUS = 20;
26
15
 
27
- /**
28
- * Opaque sheet chrome for Android. The glass background needs a measured blur
29
- * target, which is not reliable once an RN `Modal` has been dismissed.
30
- */
31
- function SolidSheetBackground({
32
- style,
33
- pointerEvents,
34
- }: {
35
- style?: ViewProps["style"];
36
- pointerEvents?: ViewProps["pointerEvents"];
37
- }) {
38
- const scheme = useScheme();
39
- return (
40
- <View
41
- pointerEvents={pointerEvents}
42
- style={[
43
- style,
44
- {
45
- backgroundColor: floatingSolidFill[scheme],
46
- borderTopLeftRadius: SHEET_RADIUS,
47
- borderTopRightRadius: SHEET_RADIUS,
48
- },
49
- ]}
50
- />
51
- );
52
- }
16
+ // A single open detent at 40% by default. A caller can pass several detents for
17
+ // multi-detent sizing. The closed detent (0) is added by the component.
18
+ const DEFAULT_DETENTS: readonly ModalDetent[] = ["40%"];
53
19
 
54
- function SheetBackdrop(props: BottomSheetDefaultBackdropProps) {
55
- return (
56
- <BottomSheetBackdrop
57
- {...props}
58
- appearsOnIndex={0}
59
- disappearsOnIndex={-1}
60
- opacity={0.5}
61
- />
62
- );
63
- }
20
+ // A dimming scrim. The library scales this alpha to 0 at the closed detent and to
21
+ // full at an open one.
22
+ const SCRIM_COLOR = "rgba(0, 0, 0, 0.5)";
64
23
 
65
24
  /**
66
- * A controlled bottom sheet over the screen, built on gorhom's default-export
67
- * `BottomSheet` (the named `BottomSheet` export is undefined).
25
+ * A controlled bottom sheet over the screen, driven by `visible` and `onClose`,
26
+ * with a title and a close button.
27
+ *
28
+ * It is built on `ModalBottomSheet` from Software Mansion's
29
+ * `@swmansion/react-native-bottom-sheet` in `windowOverlay` mode, so it needs no
30
+ * root provider. The library needs the New Architecture, React Native 0.82 or
31
+ * later and a native build (no Expo Go).
68
32
  *
69
- * It renders nothing while `visible` is false. A closed gorhom sheet still lays
70
- * out an absolute-fill host that can cover the triggers beneath it, and
71
- * `BottomSheetModal.present()` did nothing after an RN `Modal` had been
72
- * dismissed on Android.
33
+ * `detents` sets the open detents, shortest first. The default is a single 40%
34
+ * detent. The closed detent is added by the component.
73
35
  */
74
36
  export function BottomSheetContainer({
75
37
  visible,
@@ -77,50 +39,98 @@ export function BottomSheetContainer({
77
39
  title,
78
40
  children,
79
41
  closeTestID,
42
+ detents = DEFAULT_DETENTS,
80
43
  }: {
81
44
  visible: boolean;
82
45
  onClose: () => void;
83
46
  title: string;
84
47
  children: React.ReactNode;
85
48
  closeTestID?: string;
49
+ /** Open detents, shortest first. The closed detent is added automatically. */
50
+ detents?: readonly ModalDetent[];
86
51
  }) {
87
52
  const largerText = useLargerText();
88
- const isDark = useScheme() === "dark";
89
- const renderBackdrop = useCallback(
90
- (props: BottomSheetDefaultBackdropProps) => <SheetBackdrop {...props} />,
91
- [],
53
+ const scheme = useScheme();
54
+ const isDark = scheme === "dark";
55
+
56
+ // The library sheet is controlled by a detent index. The first detent is the
57
+ // closed state (0); the open detents follow.
58
+ const detentList = useMemo<ModalDetent[]>(() => [0, ...detents], [detents]);
59
+ const [index, setIndex] = useState(0);
60
+
61
+ // Keep the index in step with `visible`: open to the first detent, close to 0.
62
+ useEffect(() => {
63
+ setIndex((current) => (visible ? (current === 0 ? 1 : current) : 0));
64
+ }, [visible]);
65
+
66
+ // A user-driven drag to the closed detent reports here; tell the parent.
67
+ const handleIndexChange = useCallback(
68
+ (next: number) => {
69
+ setIndex(next);
70
+ if (next === 0) onClose();
71
+ },
72
+ [onClose],
92
73
  );
93
74
 
94
- if (!visible) {
95
- return null;
96
- }
75
+ // A scrim tap or system Back asks the sheet to close; close it and tell the parent.
76
+ const handleCloseRequest = useCallback(() => {
77
+ setIndex(0);
78
+ onClose();
79
+ }, [onClose]);
80
+
81
+ const surface = (
82
+ <View
83
+ style={[StyleSheet.absoluteFill, { backgroundColor: floatingSolidFill[scheme] }]}
84
+ />
85
+ );
97
86
 
98
87
  return (
99
- <BottomSheet
100
- index={0}
101
- snapPoints={SNAP_POINTS}
102
- enableDynamicSizing={false}
103
- enablePanDownToClose
104
- enableContentPanningGesture={false}
105
- enableHandlePanningGesture
106
- keyboardBehavior="interactive"
107
- onClose={onClose}
108
- backdropComponent={renderBackdrop}
109
- backgroundComponent={
110
- Platform.OS === "android" ? SolidSheetBackground : GlassSheetBackground
111
- }
112
- handleIndicatorStyle={{
113
- backgroundColor: isDark ? Colors.white : Colors.neutral[800],
88
+ <ModalBottomSheet
89
+ index={index}
90
+ detents={detentList}
91
+ // Unmount the content once the sheet settles closed.
92
+ lazy
93
+ windowOverlay
94
+ scrimColor={SCRIM_COLOR}
95
+ scrimAccessibilityLabel="Close"
96
+ surface={surface}
97
+ surfaceStyle={{
98
+ borderTopLeftRadius: SHEET_RADIUS,
99
+ borderTopRightRadius: SHEET_RADIUS,
114
100
  }}
101
+ onIndexChange={handleIndexChange}
102
+ onCloseRequest={handleCloseRequest}
115
103
  >
116
- {/* Padding is a style, not a NativeWind class: `BottomSheetView` does not
117
- always apply `className`, and an unpadded sheet can measure too small. */}
118
- <BottomSheetView style={{ padding: 20, paddingBottom: 48 }}>
119
- <View className="mb-4 flex-row items-center justify-between gap-3">
104
+ <View style={{ flex: 1, paddingTop: 12 }}>
105
+ <View
106
+ accessibilityElementsHidden
107
+ importantForAccessibility="no-hide-descendants"
108
+ style={{
109
+ alignSelf: "center",
110
+ height: 6,
111
+ width: 40,
112
+ borderRadius: 999,
113
+ backgroundColor: withAlpha(tokens.color.muted[scheme], 0.4),
114
+ }}
115
+ />
116
+ <View
117
+ style={{
118
+ flexDirection: "row",
119
+ alignItems: "center",
120
+ justifyContent: "space-between",
121
+ gap: 12,
122
+ paddingHorizontal: 20,
123
+ marginTop: 16,
124
+ marginBottom: 16,
125
+ }}
126
+ >
120
127
  <Text
121
128
  accessibilityRole="header"
122
- className={`${largerText ? "text-2xl" : "text-xl"} flex-1 font-instrument-sans-semibold`}
123
- style={[textStyle("foreground", isDark ? "dark" : "light"), typeStyle("semibold")]}
129
+ style={[
130
+ { flex: 1, fontSize: largerText ? 24 : 20 },
131
+ textStyle("foreground", scheme),
132
+ typeStyle("semibold"),
133
+ ]}
124
134
  >
125
135
  {title}
126
136
  </Text>
@@ -128,16 +138,18 @@ export function BottomSheetContainer({
128
138
  testID={closeTestID}
129
139
  accessibilityRole="button"
130
140
  accessibilityLabel="Close"
131
- onPress={onClose}
132
- className="-mr-2 h-12 w-12 items-center justify-center"
141
+ onPress={handleCloseRequest}
142
+ style={{ marginRight: -8, height: 48, width: 48, alignItems: "center", justifyContent: "center" }}
133
143
  hitSlop={8}
134
144
  activeOpacity={0.7}
135
145
  >
136
- <IconX size={largerText ? 32 : 28} color={isDark ? "white" : "black"} />
146
+ <IconX size={largerText ? 32 : 28} color={isDark ? Colors.white : Colors.black} />
137
147
  </TouchableOpacity>
138
148
  </View>
139
- {children}
140
- </BottomSheetView>
141
- </BottomSheet>
149
+ <View style={{ flex: 1, paddingHorizontal: 20, paddingBottom: 48 }}>
150
+ {children}
151
+ </View>
152
+ </View>
153
+ </ModalBottomSheet>
142
154
  );
143
155
  }
@@ -1,5 +1,7 @@
1
- import { Pressable, View } from "react-native";
1
+ import { Pressable } from "react-native";
2
+ import Animated from "react-native-reanimated";
2
3
  import { cn } from "./cn";
4
+ import { usePressScale } from "./pressScale";
3
5
  import { withAlpha } from "./palette";
4
6
  import { tokens } from "./tokens";
5
7
 
@@ -16,7 +18,8 @@ export const CAPTURE_BUTTON = { size: 76, ring: 4, gap: 4 } as const;
16
18
 
17
19
  /**
18
20
  * A camera shutter: a 76 white ring around a white disc, for a live preview in
19
- * light and dark alike. The disc shrinks to 90% while pressed. Larger than the
21
+ * light and dark alike. The disc eases down to 90% in 100 ms while pressed
22
+ * and back in 160 ms; with Reduce Motion it dims instead. Larger than the
20
23
  * 44 target, so it needs no hit slop. A labelled button, dimmed and ignoring
21
24
  * presses when `disabled`.
22
25
  */
@@ -28,6 +31,7 @@ export function CaptureButton({
28
31
  }: CaptureButtonProps) {
29
32
  const { size, ring, gap } = CAPTURE_BUTTON;
30
33
  const inner = size - 2 * (ring + gap);
34
+ const press = usePressScale({ scale: 0.9, dim: 1, reducedDim: 0.7, pressInMs: 100, disabled });
31
35
  return (
32
36
  <Pressable
33
37
  testID={testID}
@@ -36,6 +40,8 @@ export function CaptureButton({
36
40
  accessibilityState={{ disabled }}
37
41
  disabled={disabled}
38
42
  onPress={onPress}
43
+ onPressIn={press.onPressIn}
44
+ onPressOut={press.onPressOut}
39
45
  className={cn("items-center justify-center", disabled && "opacity-50")}
40
46
  style={{
41
47
  width: size,
@@ -46,17 +52,17 @@ export function CaptureButton({
46
52
  backgroundColor: withAlpha(tokens.color.black, 0.15),
47
53
  }}
48
54
  >
49
- {({ pressed }) => (
50
- <View
51
- style={{
55
+ <Animated.View
56
+ style={[
57
+ {
52
58
  width: inner,
53
59
  height: inner,
54
60
  borderRadius: inner / 2,
55
61
  backgroundColor: tokens.color.white,
56
- transform: [{ scale: pressed && !disabled ? 0.9 : 1 }],
57
- }}
58
- />
59
- )}
62
+ },
63
+ press.style,
64
+ ]}
65
+ />
60
66
  </Pressable>
61
67
  );
62
68
  }
package/src/Chip.tsx CHANGED
@@ -1,4 +1,5 @@
1
- import { Pressable, Text } from "react-native";
1
+ import { Text } from "react-native";
2
+ import { AnimatedPressable, usePressScale } from "./pressScale";
2
3
  import { textStyle, typeStyle } from "./controlStyles";
3
4
  import { useLargerText } from "./theme";
4
5
  import { useScheme } from "./useScheme";
@@ -18,6 +19,7 @@ export function Chip({
18
19
  }) {
19
20
  const largerText = useLargerText();
20
21
  const scheme = useScheme();
22
+ const press = usePressScale();
21
23
  const size = round
22
24
  ? largerText
23
25
  ? "h-14 w-14"
@@ -26,13 +28,16 @@ export function Chip({
26
28
  ? "min-h-14 px-5 py-3"
27
29
  : "min-h-12 px-4 py-2";
28
30
  return (
29
- <Pressable
31
+ <AnimatedPressable
30
32
  testID={testID}
31
33
  accessibilityRole="button"
32
34
  accessibilityLabel={label}
33
35
  accessibilityState={{ selected }}
34
36
  onPress={onPress}
35
- className={`items-center justify-center rounded-full border border-white/40 active:opacity-70 dark:border-white/10 ${
37
+ onPressIn={press.onPressIn}
38
+ onPressOut={press.onPressOut}
39
+ style={press.style}
40
+ className={`items-center justify-center rounded-full border border-white/40 dark:border-white/10 ${
36
41
  size
37
42
  } ${selected ? "bg-pink-100 dark:bg-pink-900/40" : "bg-secondary"}`}
38
43
  >
@@ -46,6 +51,6 @@ export function Chip({
46
51
  >
47
52
  {label}
48
53
  </Text>
49
- </Pressable>
54
+ </AnimatedPressable>
50
55
  );
51
56
  }
@@ -1,8 +1,9 @@
1
- import { Pressable, View } from "react-native";
1
+ import { View } from "react-native";
2
2
  import { IconCheck } from "@tabler/icons-react-native";
3
3
  import { cn } from "./cn";
4
4
  import { touchSlop } from "./controlStyles";
5
5
  import { selectionHaptic } from "./haptics";
6
+ import { AnimatedPressable, usePressScale } from "./pressScale";
6
7
  import { withAlpha } from "./palette";
7
8
  import { useLargerText } from "./theme";
8
9
  import { tokens } from "./tokens";
@@ -91,43 +92,87 @@ export function ColorSwatches({
91
92
  const isSelected = color.toLowerCase() === selected;
92
93
  const check = isSelected ? swatchCheckColor(color) : null;
93
94
  return (
94
- <Pressable
95
+ <Swatch
95
96
  key={`${color}-${index}`}
96
97
  testID={testID ? `${testID}-${index}` : undefined}
97
- accessibilityRole="radio"
98
- accessibilityLabel={labels?.[index] ?? color}
99
- accessibilityState={{ checked: isSelected, disabled }}
100
- hitSlop={touchSlop(outer)}
98
+ label={labels?.[index] ?? color}
99
+ color={color}
100
+ selected={isSelected}
101
+ check={check}
101
102
  disabled={disabled}
103
+ diameter={diameter}
104
+ outer={outer}
102
105
  onPress={() => {
103
106
  selectionHaptic();
104
107
  onChange(color);
105
108
  }}
106
- className="items-center justify-center active:opacity-70"
107
- style={{
108
- width: outer,
109
- height: outer,
110
- borderRadius: outer / 2,
111
- borderWidth: RING,
112
- borderColor: isSelected ? tokens.color.foreground[scheme] : "transparent",
113
- }}
114
- >
115
- <View
116
- className="items-center justify-center"
117
- style={{
118
- width: diameter,
119
- height: diameter,
120
- borderRadius: diameter / 2,
121
- backgroundColor: color,
122
- borderWidth: 1,
123
- borderColor: withAlpha(tokens.color.foreground[scheme], 0.12),
124
- }}
125
- >
126
- {check ? <IconCheck size={Math.round(diameter / 2)} color={check} strokeWidth={2} /> : null}
127
- </View>
128
- </Pressable>
109
+ />
129
110
  );
130
111
  })}
131
112
  </View>
132
113
  );
133
114
  }
115
+
116
+ /** One swatch: a radio that scales a little on press. The slop does not scale. */
117
+ function Swatch({
118
+ testID,
119
+ label,
120
+ color,
121
+ selected,
122
+ check,
123
+ disabled,
124
+ diameter,
125
+ outer,
126
+ onPress,
127
+ }: {
128
+ testID?: string;
129
+ label: string;
130
+ color: string;
131
+ selected: boolean;
132
+ check: string | null;
133
+ disabled: boolean;
134
+ diameter: number;
135
+ outer: number;
136
+ onPress: () => void;
137
+ }) {
138
+ const scheme = useScheme();
139
+ const press = usePressScale({ disabled });
140
+ return (
141
+ <AnimatedPressable
142
+ testID={testID}
143
+ accessibilityRole="radio"
144
+ accessibilityLabel={label}
145
+ accessibilityState={{ checked: selected, disabled }}
146
+ hitSlop={touchSlop(outer)}
147
+ disabled={disabled}
148
+ onPress={onPress}
149
+ onPressIn={press.onPressIn}
150
+ onPressOut={press.onPressOut}
151
+ className="items-center justify-center"
152
+ style={[
153
+ {
154
+ width: outer,
155
+ height: outer,
156
+ borderRadius: outer / 2,
157
+ borderWidth: RING,
158
+ borderColor: selected ? tokens.color.foreground[scheme] : "transparent",
159
+ },
160
+ press.style,
161
+ ]}
162
+ >
163
+ <View
164
+ className="items-center justify-center"
165
+ style={{
166
+ width: diameter,
167
+ height: diameter,
168
+ borderRadius: diameter / 2,
169
+ backgroundColor: color,
170
+ borderWidth: 1,
171
+ borderColor: withAlpha(tokens.color.foreground[scheme], 0.12),
172
+ }}
173
+ >
174
+ {check ? <IconCheck size={Math.round(diameter / 2)} color={check} strokeWidth={2} /> : null}
175
+ </View>
176
+ </AnimatedPressable>
177
+ );
178
+ }
package/src/Dialog.tsx CHANGED
@@ -10,6 +10,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
10
10
  import { IconX } from "@tabler/icons-react-native";
11
11
  import { FloatingSurface } from "./FloatingSurface";
12
12
  import { cn } from "./cn";
13
+ import { AnimatedPressable, usePressScale } from "./pressScale";
13
14
  import { isCompactOverlay, textStyle, typeStyle } from "./controlStyles";
14
15
  import { DialogLayoutContext, useDialogLayout, type DialogLayout } from "./dialogLayout";
15
16
  import { palette } from "./palette";
@@ -162,14 +163,22 @@ function DialogHandle() {
162
163
  function DialogCloseButton() {
163
164
  const largerText = useLargerText();
164
165
  const scheme = useScheme();
166
+ const press = usePressScale();
167
+ // `asChild`: the close press goes into this animated `Pressable`, so the
168
+ // button scales while `overlay.tsx` stays as it is.
165
169
  return (
166
- <DialogClose
167
- testID="dialog-close"
168
- accessibilityLabel="Close"
169
- hitSlop={8}
170
- className="absolute right-2 top-2 h-11 w-11 items-center justify-center rounded-lg active:opacity-70"
171
- >
172
- <IconX size={largerText ? 26 : 16} color={tokens.color.muted[scheme]} />
170
+ <DialogClose asChild>
171
+ <AnimatedPressable
172
+ testID="dialog-close"
173
+ accessibilityLabel="Close"
174
+ hitSlop={8}
175
+ onPressIn={press.onPressIn}
176
+ onPressOut={press.onPressOut}
177
+ style={press.style}
178
+ className="absolute right-2 top-2 h-11 w-11 items-center justify-center rounded-lg"
179
+ >
180
+ <IconX size={largerText ? 26 : 16} color={tokens.color.muted[scheme]} />
181
+ </AnimatedPressable>
173
182
  </DialogClose>
174
183
  );
175
184
  }
@@ -1,8 +1,9 @@
1
1
  import type { ReactNode } from "react";
2
- import { Platform, Pressable, View } from "react-native";
2
+ import { Platform, View } from "react-native";
3
3
  import { cn } from "./cn";
4
4
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
5
  import { FloatingSurface } from "./FloatingSurface";
6
+ import { AnimatedPressable, usePressScale } from "./pressScale";
6
7
  import { useAccentColor, useLargerText } from "./theme";
7
8
  import {
8
9
  FLOATING_INSET,
@@ -24,6 +25,7 @@ export function FloatingFAB({
24
25
  const insets = useSafeAreaInsets();
25
26
  const largerText = useLargerText();
26
27
  const accentColor = useAccentColor();
28
+ const press = usePressScale({ scale: 0.95 });
27
29
  const size = largerText ? 64 : 56;
28
30
  const tabBar = largerText
29
31
  ? FLOATING_TAB_BAR_HEIGHT_LARGE
@@ -39,24 +41,29 @@ export function FloatingFAB({
39
41
  }}
40
42
  >
41
43
  <FloatingSurface radius={size / 2} blur={false}>
42
- <Pressable
44
+ <AnimatedPressable
43
45
  testID={testID}
44
46
  accessibilityRole="button"
45
47
  accessibilityLabel={label}
46
48
  onPress={onPress}
47
- // Layout in the function style and no `className`: NativeWind drops a
48
- // function `style` next to a `className`.
49
- style={({ pressed }) => ({
50
- alignItems: "center",
51
- justifyContent: "center",
52
- width: size,
53
- height: size,
54
- backgroundColor: accentColor,
55
- opacity: pressed ? 0.7 : 1,
56
- })}
49
+ onPressIn={press.onPressIn}
50
+ onPressOut={press.onPressOut}
51
+ // Layout in `style` and no `className`: NativeWind drops a function
52
+ // `style` next to a `className`, and the press scale and dim come
53
+ // from the animated style, not a function style.
54
+ style={[
55
+ {
56
+ alignItems: "center",
57
+ justifyContent: "center",
58
+ width: size,
59
+ height: size,
60
+ backgroundColor: accentColor,
61
+ },
62
+ press.style,
63
+ ]}
57
64
  >
58
65
  {children}
59
- </Pressable>
66
+ </AnimatedPressable>
60
67
  </FloatingSurface>
61
68
  </View>
62
69
  );
@@ -1,8 +1,7 @@
1
1
  import type { ComponentType } from "react";
2
- import { Pressable } from "react-native";
3
2
  import type { IconProps } from "@tabler/icons-react-native";
4
- import { cn } from "./cn";
5
3
  import { touchSlop } from "./controlStyles";
4
+ import { AnimatedPressable, usePressScale } from "./pressScale";
6
5
  import { withAlpha } from "./palette";
7
6
  import { useLargerText } from "./theme";
8
7
  import { tokens } from "./tokens";
@@ -69,8 +68,9 @@ export function IconButton({
69
68
  const largerText = useLargerText();
70
69
  const [diameter, iconSize] = METRICS[largerText ? "larger" : "regular"][size];
71
70
  const { color, ...frame } = iconButtonColors(variant, scheme);
71
+ const press = usePressScale({ restOpacity: disabled ? 0.5 : 1, disabled });
72
72
  return (
73
- <Pressable
73
+ <AnimatedPressable
74
74
  testID={testID}
75
75
  accessibilityRole="button"
76
76
  accessibilityLabel={label}
@@ -78,10 +78,12 @@ export function IconButton({
78
78
  hitSlop={touchSlop(diameter)}
79
79
  disabled={disabled}
80
80
  onPress={onPress}
81
- className={cn("items-center justify-center active:opacity-70", disabled && "opacity-50")}
82
- style={{ width: diameter, height: diameter, borderRadius: diameter / 2, borderWidth: 1, ...frame }}
81
+ onPressIn={press.onPressIn}
82
+ onPressOut={press.onPressOut}
83
+ className="items-center justify-center"
84
+ style={[{ width: diameter, height: diameter, borderRadius: diameter / 2, borderWidth: 1, ...frame }, press.style]}
83
85
  >
84
86
  <Icon size={iconSize} color={iconColor ?? color} />
85
- </Pressable>
87
+ </AnimatedPressable>
86
88
  );
87
89
  }
@@ -1,7 +1,8 @@
1
1
  import { Children, type ReactNode } from "react";
2
- import { Pressable, Text, View, type ViewProps } from "react-native";
2
+ import { Text, View, type ViewProps } from "react-native";
3
3
  import { cn } from "./cn";
4
4
  import { cardStyle, textStyle, typeStyle } from "./controlStyles";
5
+ import { AnimatedPressable, usePressScale } from "./pressScale";
5
6
  import { StatusDot } from "./StatusDot";
6
7
  import { Spinner } from "./Spinner";
7
8
  import { useLargerText } from "./theme";
@@ -31,16 +32,19 @@ export type PinnedBotTileProps = {
31
32
  export function PinnedBotTile({ title, leading, unread = false, generating = false, onPress, onLongPress, testID }: PinnedBotTileProps) {
32
33
  const scheme = useScheme();
33
34
  const largerText = useLargerText();
35
+ const press = usePressScale();
34
36
  const state = [unread ? "unread" : null, generating ? "generating" : null].filter(Boolean).join(", ");
35
37
  return (
36
- <Pressable
38
+ <AnimatedPressable
37
39
  testID={testID}
38
40
  accessibilityRole="button"
39
41
  accessibilityLabel={state ? `${title}, ${state}` : title}
40
42
  onPress={onPress}
41
43
  onLongPress={onLongPress}
42
- className={cn("min-w-0 items-center justify-center gap-2 px-3 py-4 active:opacity-70", largerText ? "min-h-36" : "min-h-28")}
43
- style={cardStyle(scheme)}
44
+ onPressIn={press.onPressIn}
45
+ onPressOut={press.onPressOut}
46
+ className={cn("min-w-0 items-center justify-center gap-2 px-3 py-4", largerText ? "min-h-36" : "min-h-28")}
47
+ style={[cardStyle(scheme), press.style]}
44
48
  >
45
49
  {leading}
46
50
  <Text
@@ -60,7 +64,7 @@ export function PinnedBotTile({ title, leading, unread = false, generating = fal
60
64
  <Spinner size="sm" decorative />
61
65
  </View>
62
66
  ) : null}
63
- </Pressable>
67
+ </AnimatedPressable>
64
68
  );
65
69
  }
66
70