@vvedantb/native-ui 0.25.1 → 0.25.3

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.
@@ -14,8 +14,10 @@ import { useScheme } from "../useScheme";
14
14
  import { META_TEXT_STYLE, chatTextSize } from "./chat-text";
15
15
  import { ChatIconButton } from "./icon-button";
16
16
  import { MESSAGE_ACTIONS_TITLE, MessageActionSheet } from "./message-action-sheet";
17
+ import { useOptionalConversation } from "./conversation-context";
17
18
  import { MessageContextMenu } from "./message-context-menu";
18
19
  import { ChatTextColorContext, ResponseText } from "./response-text";
20
+ import { usePressed } from "../usePressed";
19
21
  const MessageContext = createContext("assistant");
20
22
 
21
23
  /** The bot behind an incoming message in a group chat. */
@@ -123,7 +125,7 @@ const HELD_STYLE = {
123
125
  opacity: 0.9
124
126
  };
125
127
  export function Message(t0) {
126
- const $ = _c(52);
128
+ const $ = _c(57);
127
129
  let actionSheetTitle;
128
130
  let actions;
129
131
  let bot;
@@ -177,18 +179,20 @@ export function Message(t0) {
177
179
  const highlighted = t1 === undefined ? false : t1;
178
180
  const user = from === "user";
179
181
  const [sheetOpen, setSheetOpen] = useState(false);
180
- const [pressing, setPressing] = useState(false);
182
+ const press = usePressed();
181
183
  const [held, setHeld] = useState(null);
182
184
  const pressable = useRef(null);
183
185
  const hasActions = actions != null && actions.length > 0;
184
186
  const longPressable = onLongPress != null || hasActions || menu != null;
187
+ const conversation = useOptionalConversation();
185
188
  let t2;
186
- if ($[12] !== hasActions || $[13] !== menu || $[14] !== onLongPress) {
189
+ if ($[12] !== conversation || $[13] !== hasActions || $[14] !== menu || $[15] !== onLongPress) {
187
190
  t2 = () => {
188
191
  impactHaptic("medium");
189
192
  onLongPress?.();
190
193
  if (menu) {
191
194
  const built = menu();
195
+ conversation?.openOverlay();
192
196
  pressable.current?.measureInWindow((x, y, width, height) => setHeld({
193
197
  anchor: {
194
198
  x,
@@ -204,119 +208,134 @@ export function Message(t0) {
204
208
  }
205
209
  }
206
210
  };
207
- $[12] = hasActions;
208
- $[13] = menu;
209
- $[14] = onLongPress;
210
- $[15] = t2;
211
+ $[12] = conversation;
212
+ $[13] = hasActions;
213
+ $[14] = menu;
214
+ $[15] = onLongPress;
215
+ $[16] = t2;
211
216
  } else {
212
- t2 = $[15];
217
+ t2 = $[16];
213
218
  }
214
219
  const longPress = t2;
215
- const t3 = user ? "flex-end" : "flex-start";
216
- const t4 = user ? "flex-end" : "stretch";
217
- let t5;
218
- if ($[16] !== t3 || $[17] !== t4) {
219
- t5 = {
220
- alignSelf: t3,
221
- alignItems: t4
220
+ let t3;
221
+ if ($[17] !== conversation) {
222
+ t3 = () => {
223
+ setHeld(null);
224
+ conversation?.closeOverlay();
222
225
  };
223
- $[16] = t3;
224
- $[17] = t4;
225
- $[18] = t5;
226
+ $[17] = conversation;
227
+ $[18] = t3;
226
228
  } else {
227
- t5 = $[18];
229
+ t3 = $[18];
228
230
  }
231
+ const closeMenu = t3;
232
+ const t4 = user ? "flex-end" : "flex-start";
233
+ const t5 = user ? "flex-end" : "stretch";
229
234
  let t6;
230
- if ($[19] !== style || $[20] !== t5) {
231
- t6 = [t5, style];
232
- $[19] = style;
235
+ if ($[19] !== t4 || $[20] !== t5) {
236
+ t6 = {
237
+ alignSelf: t4,
238
+ alignItems: t5
239
+ };
240
+ $[19] = t4;
233
241
  $[20] = t5;
234
242
  $[21] = t6;
235
243
  } else {
236
244
  t6 = $[21];
237
245
  }
238
- const layout = t6;
239
246
  let t7;
240
- if ($[22] !== className) {
241
- t7 = cn("w-full max-w-[95%] gap-2", className);
242
- $[22] = className;
243
- $[23] = t7;
247
+ if ($[22] !== style || $[23] !== t6) {
248
+ t7 = [t6, style];
249
+ $[22] = style;
250
+ $[23] = t6;
251
+ $[24] = t7;
244
252
  } else {
245
- t7 = $[23];
253
+ t7 = $[24];
246
254
  }
247
- const merged = t7;
255
+ const layout = t7;
248
256
  let t8;
249
- if ($[24] !== bot || $[25] !== user) {
250
- t8 = bot && !user ? <MessageBotLabel name={bot.name} avatar={bot.avatar} /> : null;
251
- $[24] = bot;
252
- $[25] = user;
257
+ if ($[25] !== className) {
258
+ t8 = cn("w-full max-w-[95%] gap-2", className);
259
+ $[25] = className;
253
260
  $[26] = t8;
254
261
  } else {
255
262
  t8 = $[26];
256
263
  }
264
+ const merged = t8;
257
265
  let t9;
258
- if ($[27] !== highlighted) {
259
- t9 = highlighted ? <MessageHighlight /> : null;
260
- $[27] = highlighted;
261
- $[28] = t9;
266
+ if ($[27] !== bot || $[28] !== user) {
267
+ t9 = bot && !user ? <MessageBotLabel name={bot.name} avatar={bot.avatar} /> : null;
268
+ $[27] = bot;
269
+ $[28] = user;
270
+ $[29] = t9;
262
271
  } else {
263
- t9 = $[28];
272
+ t9 = $[29];
264
273
  }
265
274
  let t10;
266
- if ($[29] !== children || $[30] !== t8 || $[31] !== t9) {
267
- t10 = <>{t8}{children}{t9}</>;
268
- $[29] = children;
269
- $[30] = t8;
270
- $[31] = t9;
271
- $[32] = t10;
275
+ if ($[30] !== highlighted) {
276
+ t10 = highlighted ? <MessageHighlight /> : null;
277
+ $[30] = highlighted;
278
+ $[31] = t10;
272
279
  } else {
273
- t10 = $[32];
280
+ t10 = $[31];
274
281
  }
275
- const parts = t10;
276
282
  let t11;
277
- if ($[33] !== actionSheetTitle || $[34] !== actions || $[35] !== from || $[36] !== hasActions || $[37] !== held || $[38] !== layout || $[39] !== longPress || $[40] !== longPressable || $[41] !== menu || $[42] !== merged || $[43] !== parts || $[44] !== pressing || $[45] !== props || $[46] !== sheetOpen || $[47] !== user) {
278
- t11 = longPressable ? <><Pressable ref={pressable} accessible={false} className={merged} style={[layout, pressing ? HELD_STYLE : null]} onPressIn={() => setPressing(true)} onPressOut={() => setPressing(false)} onLongPress={longPress} delayLongPress={HOLD_DELAY_MS} accessibilityActions={[{
283
+ if ($[32] !== children || $[33] !== t10 || $[34] !== t9) {
284
+ t11 = <>{t9}{children}{t10}</>;
285
+ $[32] = children;
286
+ $[33] = t10;
287
+ $[34] = t9;
288
+ $[35] = t11;
289
+ } else {
290
+ t11 = $[35];
291
+ }
292
+ const parts = t11;
293
+ let t12;
294
+ if ($[36] !== actionSheetTitle || $[37] !== actions || $[38] !== closeMenu || $[39] !== conversation?.settleOverlay || $[40] !== from || $[41] !== hasActions || $[42] !== held || $[43] !== layout || $[44] !== longPress || $[45] !== longPressable || $[46] !== menu || $[47] !== merged || $[48] !== parts || $[49] !== press || $[50] !== props || $[51] !== sheetOpen || $[52] !== user) {
295
+ t12 = longPressable ? <><Pressable ref={pressable} accessible={false} className={merged} style={[layout, press.pressed ? HELD_STYLE : null]} onPressIn={press.onPressIn} onPressOut={press.onPressOut} onLongPress={longPress} delayLongPress={HOLD_DELAY_MS} accessibilityActions={[{
279
296
  name: "longpress",
280
297
  label: actionSheetTitle ?? MESSAGE_ACTIONS_TITLE
281
298
  }]} onAccessibilityAction={event => {
282
299
  if (event.nativeEvent.actionName === "longpress") {
283
300
  longPress();
284
301
  }
285
- }} {...props}>{parts}</Pressable>{menu ? <MessageContextMenu open={held !== null} onClose={() => setHeld(null)} anchor={held?.anchor ?? null} align={user ? "end" : "start"} preview={<MessageContext.Provider value={from}><View className={merged} style={[layout, {
302
+ }} {...props}>{parts}</Pressable>{menu ? <MessageContextMenu open={held !== null} onClose={closeMenu} onDismissed={conversation?.settleOverlay} anchor={held?.anchor ?? null} align={user ? "end" : "start"} preview={<MessageContext.Provider value={from}><View className={merged} style={[layout, {
286
303
  maxWidth: "100%",
287
304
  width: "100%"
288
305
  }]}>{parts}</View></MessageContext.Provider>} menu={held?.menu ?? {
289
306
  actions: []
290
307
  }} /> : hasActions ? <MessageActionSheet open={sheetOpen} onClose={() => setSheetOpen(false)} actions={actions} title={actionSheetTitle} /> : null}</> : <View className={merged} style={layout} {...props}>{parts}</View>;
291
- $[33] = actionSheetTitle;
292
- $[34] = actions;
293
- $[35] = from;
294
- $[36] = hasActions;
295
- $[37] = held;
296
- $[38] = layout;
297
- $[39] = longPress;
298
- $[40] = longPressable;
299
- $[41] = menu;
300
- $[42] = merged;
301
- $[43] = parts;
302
- $[44] = pressing;
303
- $[45] = props;
304
- $[46] = sheetOpen;
305
- $[47] = user;
306
- $[48] = t11;
307
- } else {
308
- t11 = $[48];
308
+ $[36] = actionSheetTitle;
309
+ $[37] = actions;
310
+ $[38] = closeMenu;
311
+ $[39] = conversation?.settleOverlay;
312
+ $[40] = from;
313
+ $[41] = hasActions;
314
+ $[42] = held;
315
+ $[43] = layout;
316
+ $[44] = longPress;
317
+ $[45] = longPressable;
318
+ $[46] = menu;
319
+ $[47] = merged;
320
+ $[48] = parts;
321
+ $[49] = press;
322
+ $[50] = props;
323
+ $[51] = sheetOpen;
324
+ $[52] = user;
325
+ $[53] = t12;
326
+ } else {
327
+ t12 = $[53];
309
328
  }
310
- let t12;
311
- if ($[49] !== from || $[50] !== t11) {
312
- t12 = <MessageContext.Provider value={from}>{t11}</MessageContext.Provider>;
313
- $[49] = from;
314
- $[50] = t11;
315
- $[51] = t12;
329
+ let t13;
330
+ if ($[54] !== from || $[55] !== t12) {
331
+ t13 = <MessageContext.Provider value={from}>{t12}</MessageContext.Provider>;
332
+ $[54] = from;
333
+ $[55] = t12;
334
+ $[56] = t13;
316
335
  } else {
317
- t12 = $[51];
336
+ t13 = $[56];
318
337
  }
319
- return t12;
338
+ return t13;
320
339
  }
321
340
 
322
341
  /**
@@ -8,6 +8,7 @@ import { tokens } from "../tokens";
8
8
  import { useScheme } from "../useScheme";
9
9
  import { Collapsible, CollapsibleChevron, CollapsibleContent, CollapsibleTrigger, useCollapsible } from "./collapsible";
10
10
  import { ResponseText } from "./response-text";
11
+ import { usePressed } from "../usePressed";
11
12
 
12
13
  /** The sources a reply used, folded (default closed). */
13
14
  export function Sources(t0) {
@@ -182,13 +183,14 @@ const ROW_HEIGHT = 36;
182
183
  * Pressed, it takes the web hover fill (`bg-surface-secondary`).
183
184
  */
184
185
  export function Source(t0) {
185
- const $ = _c(18);
186
+ const $ = _c(20);
186
187
  const {
187
188
  href,
188
189
  title,
189
190
  onPress,
190
191
  testID
191
192
  } = t0;
193
+ const press = usePressed();
192
194
  const scheme = useScheme();
193
195
  const largerText = useLargerText();
194
196
  const label = title ?? href;
@@ -208,53 +210,51 @@ export function Source(t0) {
208
210
  } else {
209
211
  t2 = $[3];
210
212
  }
211
- let t3;
212
- if ($[4] !== scheme) {
213
- t3 = t4 => {
214
- const {
215
- pressed
216
- } = t4;
217
- return {
218
- borderRadius: tokens.radius.md,
219
- backgroundColor: pressed ? tokens.color.surfaceSecondary[scheme] : "transparent"
220
- };
213
+ const t3 = press.pressed ? tokens.color.surfaceSecondary[scheme] : "transparent";
214
+ let t4;
215
+ if ($[4] !== t3) {
216
+ t4 = {
217
+ borderRadius: tokens.radius.md,
218
+ backgroundColor: t3
221
219
  };
222
- $[4] = scheme;
223
- $[5] = t3;
220
+ $[4] = t3;
221
+ $[5] = t4;
224
222
  } else {
225
- t3 = $[5];
223
+ t4 = $[5];
226
224
  }
227
- let t4;
225
+ let t5;
228
226
  if ($[6] !== label) {
229
- t4 = <ResponseText size="small" tone="muted" selectable={false} numberOfLines={1} className="shrink">{label}</ResponseText>;
227
+ t5 = <ResponseText size="small" tone="muted" selectable={false} numberOfLines={1} className="shrink">{label}</ResponseText>;
230
228
  $[6] = label;
231
- $[7] = t4;
229
+ $[7] = t5;
232
230
  } else {
233
- t4 = $[7];
231
+ t5 = $[7];
234
232
  }
235
- const t5 = largerText ? 18 : 14;
236
- const t6 = tokens.color.muted[scheme];
237
- let t7;
238
- if ($[8] !== t5 || $[9] !== t6) {
239
- t7 = <IconBook size={t5} color={t6} strokeWidth={1.5} />;
240
- $[8] = t5;
241
- $[9] = t6;
242
- $[10] = t7;
233
+ const t6 = largerText ? 18 : 14;
234
+ const t7 = tokens.color.muted[scheme];
235
+ let t8;
236
+ if ($[8] !== t6 || $[9] !== t7) {
237
+ t8 = <IconBook size={t6} color={t7} strokeWidth={1.5} />;
238
+ $[8] = t6;
239
+ $[9] = t7;
240
+ $[10] = t8;
243
241
  } else {
244
- t7 = $[10];
242
+ t8 = $[10];
245
243
  }
246
- let t8;
247
- if ($[11] !== label || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t7 || $[16] !== testID) {
248
- t8 = <Pressable testID={testID} accessibilityRole="link" accessibilityLabel={label} hitSlop={t1} onPress={t2} className="flex-row items-center justify-between gap-2 px-3 py-2" style={t3}>{t4}{t7}</Pressable>;
244
+ let t9;
245
+ if ($[11] !== label || $[12] !== press.onPressIn || $[13] !== press.onPressOut || $[14] !== t2 || $[15] !== t4 || $[16] !== t5 || $[17] !== t8 || $[18] !== testID) {
246
+ t9 = <Pressable testID={testID} accessibilityRole="link" accessibilityLabel={label} hitSlop={t1} onPress={t2} onPressIn={press.onPressIn} onPressOut={press.onPressOut} className="flex-row items-center justify-between gap-2 px-3 py-2" style={t4}>{t5}{t8}</Pressable>;
249
247
  $[11] = label;
250
- $[12] = t2;
251
- $[13] = t3;
252
- $[14] = t4;
253
- $[15] = t7;
254
- $[16] = testID;
248
+ $[12] = press.onPressIn;
249
+ $[13] = press.onPressOut;
250
+ $[14] = t2;
251
+ $[15] = t4;
252
+ $[16] = t5;
255
253
  $[17] = t8;
254
+ $[18] = testID;
255
+ $[19] = t9;
256
256
  } else {
257
- t8 = $[17];
257
+ t9 = $[19];
258
258
  }
259
- return t8;
259
+ return t9;
260
260
  }
@@ -7,6 +7,7 @@ import { useLargerText } from "../theme";
7
7
  import { tokens } from "../tokens";
8
8
  import { useScheme } from "../useScheme";
9
9
  import { chatTextSize } from "./chat-text";
10
+ import { usePressed } from "../usePressed";
10
11
  /**
11
12
  * Prompt suggestions. Horizontal is a `ScrollView` with no scroll bar (the web
12
13
  * row with its scroll arrows; a phone swipes instead).
@@ -77,7 +78,7 @@ const CHIP_HEIGHT = 32;
77
78
  * it takes the web hover (`bg-surface-tertiary text-foreground`).
78
79
  */
79
80
  export function Suggestion(t0) {
80
- const $ = _c(27);
81
+ const $ = _c(30);
81
82
  const {
82
83
  suggestion,
83
84
  onPress,
@@ -85,6 +86,7 @@ export function Suggestion(t0) {
85
86
  disabled,
86
87
  testID
87
88
  } = t0;
89
+ const press = usePressed();
88
90
  const scheme = useScheme();
89
91
  const largerText = useLargerText();
90
92
  let t1;
@@ -134,53 +136,53 @@ export function Suggestion(t0) {
134
136
  } else {
135
137
  t8 = $[10];
136
138
  }
137
- let t9;
138
- if ($[11] !== scheme) {
139
- t9 = t10 => {
140
- const {
141
- pressed
142
- } = t10;
143
- return {
144
- borderRadius: tokens.radius.pill,
145
- borderColor: tokens.color.border[scheme],
146
- backgroundColor: pressed ? palette.surfaceTertiary[scheme] : tokens.color.surfaceSecondary[scheme]
147
- };
139
+ const t9 = tokens.color.border[scheme];
140
+ const t10 = press.pressed ? palette.surfaceTertiary[scheme] : tokens.color.surfaceSecondary[scheme];
141
+ let t11;
142
+ if ($[11] !== t10 || $[12] !== t9) {
143
+ t11 = {
144
+ borderRadius: tokens.radius.pill,
145
+ borderColor: t9,
146
+ backgroundColor: t10
148
147
  };
149
- $[11] = scheme;
148
+ $[11] = t10;
150
149
  $[12] = t9;
150
+ $[13] = t11;
151
151
  } else {
152
- t9 = $[12];
152
+ t11 = $[13];
153
153
  }
154
- let t10;
155
- if ($[13] !== children || $[14] !== scheme || $[15] !== size || $[16] !== suggestion) {
156
- t10 = t11 => {
154
+ let t12;
155
+ if ($[14] !== children || $[15] !== scheme || $[16] !== size || $[17] !== suggestion) {
156
+ t12 = t13 => {
157
157
  const {
158
- pressed: pressed_0
159
- } = t11;
160
- return <Text className={cn(size, "font-instrument-sans")} style={[sizeStyle(size), textStyle(pressed_0 ? "foreground" : "muted", scheme)]}>{children ?? suggestion}</Text>;
158
+ pressed
159
+ } = t13;
160
+ return <Text className={cn(size, "font-instrument-sans")} style={[sizeStyle(size), textStyle(pressed ? "foreground" : "muted", scheme)]}>{children ?? suggestion}</Text>;
161
161
  };
162
- $[13] = children;
163
- $[14] = scheme;
164
- $[15] = size;
165
- $[16] = suggestion;
166
- $[17] = t10;
162
+ $[14] = children;
163
+ $[15] = scheme;
164
+ $[16] = size;
165
+ $[17] = suggestion;
166
+ $[18] = t12;
167
167
  } else {
168
- t10 = $[17];
168
+ t12 = $[18];
169
169
  }
170
- let t11;
171
- if ($[18] !== disabled || $[19] !== suggestion || $[20] !== t10 || $[21] !== t3 || $[22] !== t5 || $[23] !== t8 || $[24] !== t9 || $[25] !== testID) {
172
- t11 = <Pressable testID={testID} accessibilityRole="button" accessibilityLabel={suggestion} accessibilityState={t3} disabled={disabled} hitSlop={t4} onPress={t5} className={t8} style={t9}>{t10}</Pressable>;
173
- $[18] = disabled;
174
- $[19] = suggestion;
175
- $[20] = t10;
176
- $[21] = t3;
177
- $[22] = t5;
178
- $[23] = t8;
179
- $[24] = t9;
180
- $[25] = testID;
181
- $[26] = t11;
170
+ let t13;
171
+ if ($[19] !== disabled || $[20] !== press.onPressIn || $[21] !== press.onPressOut || $[22] !== suggestion || $[23] !== t11 || $[24] !== t12 || $[25] !== t3 || $[26] !== t5 || $[27] !== t8 || $[28] !== testID) {
172
+ t13 = <Pressable testID={testID} accessibilityRole="button" accessibilityLabel={suggestion} accessibilityState={t3} disabled={disabled} hitSlop={t4} onPress={t5} className={t8} onPressIn={press.onPressIn} onPressOut={press.onPressOut} style={t11}>{t12}</Pressable>;
173
+ $[19] = disabled;
174
+ $[20] = press.onPressIn;
175
+ $[21] = press.onPressOut;
176
+ $[22] = suggestion;
177
+ $[23] = t11;
178
+ $[24] = t12;
179
+ $[25] = t3;
180
+ $[26] = t5;
181
+ $[27] = t8;
182
+ $[28] = testID;
183
+ $[29] = t13;
182
184
  } else {
183
- t11 = $[26];
185
+ t13 = $[29];
184
186
  }
185
- return t11;
187
+ return t13;
186
188
  }
@@ -76,16 +76,18 @@ function StickyView(t0) {
76
76
  * end on either platform.
77
77
  */
78
78
  function ChatScrollView(t0) {
79
- const $ = _c(17);
79
+ const $ = _c(19);
80
80
  let bottomOffset;
81
81
  let onInsetChange;
82
82
  let onKeyboardMove;
83
83
  let props;
84
84
  let t1;
85
+ let t2;
85
86
  if ($[0] !== t0) {
86
87
  ({
87
88
  bottomOffset,
88
89
  inverted: t1,
90
+ freeze: t2,
89
91
  onInsetChange,
90
92
  onKeyboardMove,
91
93
  ...props
@@ -96,18 +98,21 @@ function ChatScrollView(t0) {
96
98
  $[3] = onKeyboardMove;
97
99
  $[4] = props;
98
100
  $[5] = t1;
101
+ $[6] = t2;
99
102
  } else {
100
103
  bottomOffset = $[1];
101
104
  onInsetChange = $[2];
102
105
  onKeyboardMove = $[3];
103
106
  props = $[4];
104
107
  t1 = $[5];
108
+ t2 = $[6];
105
109
  }
106
110
  const inverted = t1 === undefined ? false : t1;
107
- let t2;
111
+ const freeze = t2 === undefined ? false : t2;
108
112
  let t3;
109
- if ($[6] !== onKeyboardMove) {
110
- t2 = {
113
+ let t4;
114
+ if ($[7] !== onKeyboardMove) {
115
+ t3 = {
111
116
  onStart: () => {
112
117
  "worklet";
113
118
 
@@ -119,36 +124,37 @@ function ChatScrollView(t0) {
119
124
  runOnJS(onKeyboardMove)(false);
120
125
  }
121
126
  };
122
- t3 = [onKeyboardMove];
123
- $[6] = onKeyboardMove;
124
- $[7] = t2;
127
+ t4 = [onKeyboardMove];
128
+ $[7] = onKeyboardMove;
125
129
  $[8] = t3;
130
+ $[9] = t4;
126
131
  } else {
127
- t2 = $[7];
128
132
  t3 = $[8];
133
+ t4 = $[9];
129
134
  }
130
- useKeyboardHandler(t2, t3);
131
- let t4;
132
- if ($[9] !== inverted || $[10] !== onInsetChange) {
133
- t4 = insets => onInsetChange(inverted ? Platform.OS === "ios" ? insets.top : 0 : insets.bottom);
134
- $[9] = inverted;
135
- $[10] = onInsetChange;
136
- $[11] = t4;
135
+ useKeyboardHandler(t3, t4);
136
+ let t5;
137
+ if ($[10] !== inverted || $[11] !== onInsetChange) {
138
+ t5 = insets => onInsetChange(inverted ? Platform.OS === "ios" ? insets.top : 0 : insets.bottom);
139
+ $[10] = inverted;
140
+ $[11] = onInsetChange;
141
+ $[12] = t5;
137
142
  } else {
138
- t4 = $[11];
143
+ t5 = $[12];
139
144
  }
140
- let t5;
141
- if ($[12] !== bottomOffset || $[13] !== inverted || $[14] !== props || $[15] !== t4) {
142
- t5 = <KeyboardChatScrollView {...props} inverted={inverted} offset={bottomOffset} keyboardLiftBehavior="always" onContentInsetChange={t4} />;
143
- $[12] = bottomOffset;
144
- $[13] = inverted;
145
- $[14] = props;
146
- $[15] = t4;
147
- $[16] = t5;
145
+ let t6;
146
+ if ($[13] !== bottomOffset || $[14] !== freeze || $[15] !== inverted || $[16] !== props || $[17] !== t5) {
147
+ t6 = <KeyboardChatScrollView {...props} inverted={inverted} freeze={freeze} offset={bottomOffset} keyboardLiftBehavior="always" onContentInsetChange={t5} />;
148
+ $[13] = bottomOffset;
149
+ $[14] = freeze;
150
+ $[15] = inverted;
151
+ $[16] = props;
152
+ $[17] = t5;
153
+ $[18] = t6;
148
154
  } else {
149
- t5 = $[16];
155
+ t6 = $[18];
150
156
  }
151
- return t5;
157
+ return t6;
152
158
  }
153
159
 
154
160
  /**
@@ -0,0 +1,38 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useState } from "react";
3
+
4
+ /**
5
+ * Whether a `Pressable` is held down, as state, for a pressed look. With a
6
+ * `className`, NativeWind drops a `Pressable` style function (`({ pressed })
7
+ * => ...`), and with it the radius, border and fill it sets; so a pressable
8
+ * with classes reads `pressed` from here and passes a plain style. Spread
9
+ * `onPressIn` and `onPressOut` on the `Pressable`.
10
+ */
11
+ export function usePressed() {
12
+ const $ = _c(4);
13
+ const [pressed, setPressed] = useState(false);
14
+ let t0;
15
+ let t1;
16
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
17
+ t0 = () => setPressed(true);
18
+ t1 = () => setPressed(false);
19
+ $[0] = t0;
20
+ $[1] = t1;
21
+ } else {
22
+ t0 = $[0];
23
+ t1 = $[1];
24
+ }
25
+ let t2;
26
+ if ($[2] !== pressed) {
27
+ t2 = {
28
+ pressed,
29
+ onPressIn: t0,
30
+ onPressOut: t1
31
+ };
32
+ $[2] = pressed;
33
+ $[3] = t2;
34
+ } else {
35
+ t2 = $[3];
36
+ }
37
+ return t2;
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/native-ui",
3
- "version": "0.25.1",
3
+ "version": "0.25.3",
4
4
  "license": "MIT",
5
5
  "description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
6
6
  "type": "module",
@@ -310,8 +310,8 @@
310
310
  "check:exports": "node scripts/check-exports.mjs",
311
311
  "check:hermes": "node scripts/check-hermes-compat.mjs",
312
312
  "test": "vitest run",
313
- "typecheck": "tsc -p tsconfig.typecheck.json && pnpm run typecheck:consumer",
314
- "typecheck:consumer": "tsc -p tsconfig.consumer.json",
313
+ "typecheck": "tsrs --noEmit --fast -p tsconfig.typecheck.json && pnpm run typecheck:consumer",
314
+ "typecheck:consumer": "tsrs --noEmit --fast -p tsconfig.consumer.json",
315
315
  "build:baseline": "node scripts/build-dist.mjs --update"
316
316
  }
317
317
  }
@@ -15,6 +15,7 @@ import { useLargerText } from "./theme";
15
15
  import { useReduceMotion } from "./useReduceMotion";
16
16
  import { useScheme } from "./useScheme";
17
17
  import { FLOATING_PILL_RADIUS, tabBarHeight, tabBarSlotStyle } from "./floating";
18
+ import { usePressed } from "./usePressed";
18
19
 
19
20
  /**
20
21
  * Space between the bar edge and the tabs, on every side of the active pill,
@@ -158,6 +159,7 @@ function TabBarItem({
158
159
  testID,
159
160
  accessibilityLabel,
160
161
  }: TabBarItemProps) {
162
+ const press = usePressed();
161
163
  const onPress = () => {
162
164
  const event = navigation.emit({
163
165
  type: "tabPress",
@@ -177,8 +179,10 @@ function TabBarItem({
177
179
  accessibilityState={{ selected: focused }}
178
180
  accessibilityLabel={accessibilityLabel}
179
181
  onPress={onPress}
182
+ onPressIn={press.onPressIn}
183
+ onPressOut={press.onPressOut}
180
184
  className="min-h-12 min-w-12 flex-1 items-center justify-center gap-1"
181
- style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })}
185
+ style={{ opacity: press.pressed ? 0.7 : 1 }}
182
186
  >
183
187
  {renderIcon ? renderIcon({ focused, color, size: largerText ? 28 : 24 }) : null}
184
188
  <Text