@poolse/react-native 2.20.0 → 2.20.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/dist/index.d.cts CHANGED
@@ -224,6 +224,12 @@ interface MessageBubbleProps {
224
224
  showSenderName?: boolean;
225
225
  /** Slot for an actions trigger — typically a chevron rendered by `<MessageRow>`. */
226
226
  actionsTrigger?: ReactNode;
227
+ /**
228
+ * Long-press, forwarded into the image tiles. The tiles are
229
+ * Pressables of their own and win the gesture, so a wrapper's
230
+ * onLongPress never fires over an image-only message without this.
231
+ */
232
+ onLongPress?: () => void;
227
233
  /** Render in-bubble attachments (images, file cards). Defaults to true. */
228
234
  showAttachments?: boolean;
229
235
  /**
@@ -241,7 +247,7 @@ interface MessageBubbleProps {
241
247
  * an invisible twin) instead of a full-width row of its own — which
242
248
  * is what makes "ok" a one-line bubble instead of a squat rectangle.
243
249
  */
244
- declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, actionsTrigger, showAttachments, markdown, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
250
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, actionsTrigger, showAttachments, markdown, onLongPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
245
251
 
246
252
  interface MessageRowProps {
247
253
  msg: Message;
@@ -639,6 +645,14 @@ interface ImageMosaicProps {
639
645
  * color between the image and the caption.
640
646
  */
641
647
  squareBottom?: boolean;
648
+ /**
649
+ * Long-press on any tile. The tiles are Pressables (tap opens the
650
+ * viewer), and a nested Pressable wins the gesture — so without
651
+ * this, holding an image-only message never reached the row's
652
+ * actions sheet. MessageRow threads its long-press down through
653
+ * here.
654
+ */
655
+ onLongPress?: () => void;
642
656
  }
643
657
  /**
644
658
  * WhatsApp-style multi-image grid for inside the message bubble.
@@ -652,7 +666,7 @@ interface ImageMosaicProps {
652
666
  * * n = 3 → 16:9 hero on top + row of 2 squares below.
653
667
  * * n ≥ 4 → 2×2 grid with "+N more" overlay on the 4th tile.
654
668
  */
655
- declare function ImageMosaic({ images, maxWidth, radius, squareBottom }: ImageMosaicProps): react_jsx_runtime.JSX.Element | null;
669
+ declare function ImageMosaic({ images, maxWidth, radius, squareBottom, onLongPress, }: ImageMosaicProps): react_jsx_runtime.JSX.Element | null;
656
670
 
657
671
  declare const ICONS: {
658
672
  readonly attachment: {
package/dist/index.d.ts CHANGED
@@ -224,6 +224,12 @@ interface MessageBubbleProps {
224
224
  showSenderName?: boolean;
225
225
  /** Slot for an actions trigger — typically a chevron rendered by `<MessageRow>`. */
226
226
  actionsTrigger?: ReactNode;
227
+ /**
228
+ * Long-press, forwarded into the image tiles. The tiles are
229
+ * Pressables of their own and win the gesture, so a wrapper's
230
+ * onLongPress never fires over an image-only message without this.
231
+ */
232
+ onLongPress?: () => void;
227
233
  /** Render in-bubble attachments (images, file cards). Defaults to true. */
228
234
  showAttachments?: boolean;
229
235
  /**
@@ -241,7 +247,7 @@ interface MessageBubbleProps {
241
247
  * an invisible twin) instead of a full-width row of its own — which
242
248
  * is what makes "ok" a one-line bubble instead of a squat rectangle.
243
249
  */
244
- declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, actionsTrigger, showAttachments, markdown, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
250
+ declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, actionsTrigger, showAttachments, markdown, onLongPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
245
251
 
246
252
  interface MessageRowProps {
247
253
  msg: Message;
@@ -639,6 +645,14 @@ interface ImageMosaicProps {
639
645
  * color between the image and the caption.
640
646
  */
641
647
  squareBottom?: boolean;
648
+ /**
649
+ * Long-press on any tile. The tiles are Pressables (tap opens the
650
+ * viewer), and a nested Pressable wins the gesture — so without
651
+ * this, holding an image-only message never reached the row's
652
+ * actions sheet. MessageRow threads its long-press down through
653
+ * here.
654
+ */
655
+ onLongPress?: () => void;
642
656
  }
643
657
  /**
644
658
  * WhatsApp-style multi-image grid for inside the message bubble.
@@ -652,7 +666,7 @@ interface ImageMosaicProps {
652
666
  * * n = 3 → 16:9 hero on top + row of 2 squares below.
653
667
  * * n ≥ 4 → 2×2 grid with "+N more" overlay on the 4th tile.
654
668
  */
655
- declare function ImageMosaic({ images, maxWidth, radius, squareBottom }: ImageMosaicProps): react_jsx_runtime.JSX.Element | null;
669
+ declare function ImageMosaic({ images, maxWidth, radius, squareBottom, onLongPress, }: ImageMosaicProps): react_jsx_runtime.JSX.Element | null;
656
670
 
657
671
  declare const ICONS: {
658
672
  readonly attachment: {
package/dist/index.js CHANGED
@@ -2412,7 +2412,13 @@ var styles13 = StyleSheet.create({
2412
2412
  fontSize: 11
2413
2413
  }
2414
2414
  });
2415
- function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2415
+ function ImageMosaic({
2416
+ images,
2417
+ maxWidth,
2418
+ radius,
2419
+ squareBottom = false,
2420
+ onLongPress
2421
+ }) {
2416
2422
  const theme = usePoolseTheme();
2417
2423
  const r = radius ?? theme.radii.md;
2418
2424
  const rBottom = squareBottom ? 5 : r;
@@ -2445,6 +2451,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2445
2451
  n === 1 ? /* @__PURE__ */ jsx(
2446
2452
  Tile,
2447
2453
  {
2454
+ onLongPress,
2448
2455
  attachment: visible[0],
2449
2456
  style: styles14.tileFull,
2450
2457
  onPress: () => setViewerIndex(0),
@@ -2455,6 +2462,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2455
2462
  /* @__PURE__ */ jsx(
2456
2463
  Tile,
2457
2464
  {
2465
+ onLongPress,
2458
2466
  attachment: visible[0],
2459
2467
  style: styles14.tileHalfSquare,
2460
2468
  onPress: () => setViewerIndex(0),
@@ -2464,6 +2472,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2464
2472
  /* @__PURE__ */ jsx(
2465
2473
  Tile,
2466
2474
  {
2475
+ onLongPress,
2467
2476
  attachment: visible[1],
2468
2477
  style: styles14.tileHalfSquare,
2469
2478
  onPress: () => setViewerIndex(1),
@@ -2475,6 +2484,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2475
2484
  /* @__PURE__ */ jsx(
2476
2485
  Tile,
2477
2486
  {
2487
+ onLongPress,
2478
2488
  attachment: visible[0],
2479
2489
  style: styles14.tileHero,
2480
2490
  onPress: () => setViewerIndex(0),
@@ -2485,6 +2495,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2485
2495
  /* @__PURE__ */ jsx(
2486
2496
  Tile,
2487
2497
  {
2498
+ onLongPress,
2488
2499
  attachment: visible[1],
2489
2500
  style: styles14.tileHalfSquare,
2490
2501
  onPress: () => setViewerIndex(1),
@@ -2494,6 +2505,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2494
2505
  /* @__PURE__ */ jsx(
2495
2506
  Tile,
2496
2507
  {
2508
+ onLongPress,
2497
2509
  attachment: visible[2],
2498
2510
  style: styles14.tileHalfSquare,
2499
2511
  onPress: () => setViewerIndex(2),
@@ -2507,6 +2519,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2507
2519
  /* @__PURE__ */ jsx(
2508
2520
  Tile,
2509
2521
  {
2522
+ onLongPress,
2510
2523
  attachment: visible[0],
2511
2524
  style: styles14.tileHalfSquare,
2512
2525
  onPress: () => setViewerIndex(0),
@@ -2516,6 +2529,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2516
2529
  /* @__PURE__ */ jsx(
2517
2530
  Tile,
2518
2531
  {
2532
+ onLongPress,
2519
2533
  attachment: visible[1],
2520
2534
  style: styles14.tileHalfSquare,
2521
2535
  onPress: () => setViewerIndex(1),
@@ -2527,6 +2541,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2527
2541
  /* @__PURE__ */ jsx(
2528
2542
  Tile,
2529
2543
  {
2544
+ onLongPress,
2530
2545
  attachment: visible[2],
2531
2546
  style: styles14.tileHalfSquare,
2532
2547
  onPress: () => setViewerIndex(2),
@@ -2536,6 +2551,7 @@ function ImageMosaic({ images, maxWidth, radius, squareBottom = false }) {
2536
2551
  /* @__PURE__ */ jsx(
2537
2552
  Tile,
2538
2553
  {
2554
+ onLongPress,
2539
2555
  attachment: visible[3],
2540
2556
  style: styles14.tileHalfSquare,
2541
2557
  onPress: () => setViewerIndex(3),
@@ -2569,11 +2585,12 @@ function Tile({
2569
2585
  attachment,
2570
2586
  style,
2571
2587
  overlay,
2572
- onPress
2588
+ onPress,
2589
+ onLongPress
2573
2590
  }) {
2574
2591
  const theme = usePoolseTheme();
2575
2592
  const { url } = useAttachmentUrl(attachment.id);
2576
- return /* @__PURE__ */ jsxs(Pressable, { onPress, style: [styles14.tileBase, style], children: [
2593
+ return /* @__PURE__ */ jsxs(Pressable, { onPress, onLongPress, style: [styles14.tileBase, style], children: [
2577
2594
  url ? /* @__PURE__ */ jsx(
2578
2595
  Image,
2579
2596
  {
@@ -2755,7 +2772,8 @@ function MessageBubble({
2755
2772
  showSenderName = false,
2756
2773
  actionsTrigger,
2757
2774
  showAttachments = true,
2758
- markdown = true
2775
+ markdown = true,
2776
+ onLongPress
2759
2777
  }) {
2760
2778
  const theme = usePoolseTheme();
2761
2779
  const { width: screenWidth } = useWindowDimensions();
@@ -2872,7 +2890,8 @@ function MessageBubble({
2872
2890
  images,
2873
2891
  maxWidth: mediaWidth,
2874
2892
  radius: Math.max(bubbleRadius - 3, 8),
2875
- squareBottom: !metaOverlay
2893
+ squareBottom: !metaOverlay,
2894
+ ...onLongPress ? { onLongPress } : {}
2876
2895
  }
2877
2896
  ),
2878
2897
  metaOverlay ? metaRow("overlay") : null
@@ -3442,7 +3461,10 @@ function MessageRow({
3442
3461
  maxBodyLength,
3443
3462
  showSenderName,
3444
3463
  showAttachments: attachments,
3445
- markdown
3464
+ markdown,
3465
+ onLongPress: () => {
3466
+ if (actions) setActionsOpen(true);
3467
+ }
3446
3468
  }
3447
3469
  )
3448
3470
  }