@momo-kits/foundation 0.164.1-beta.5 → 0.164.1-beta.6

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.
@@ -437,11 +437,34 @@ const useSwipeBackHaptic = () => {
437
437
  const commitThreshold =
438
438
  (layouts?.screen?.width ?? 0) * SWIPE_BACK_HAPTIC_COMMIT_RATIO;
439
439
 
440
+ /**
441
+ * TEMPORARY DIAGNOSTIC (DS-760) — remove once the swipe-back no-pop is understood.
442
+ *
443
+ * The test device cannot run Xcode, so this borrows the one channel proven to reach it.
444
+ * On release past the commit threshold react-navigation should pop; if this screen is
445
+ * still mounted shortly after, the pop was requested and then swallowed — `Card` clears
446
+ * its 32ms `pendingGestureCallback` from `animate()`, and `componentDidUpdate` re-enters
447
+ * `animate()` for any re-render in that window.
448
+ *
449
+ * A `heavy` tick after release therefore means "gesture completed, pop lost". Silence
450
+ * means the gesture never reached the threshold, or was cancelled before END.
451
+ */
452
+ let lastTravel = 0;
453
+ let pendingPopProbe: ReturnType<typeof setTimeout> | undefined;
454
+
440
455
  const swipingListener = swiping.addListener(({ value }) => {
456
+ const wasSwiping = isSwiping;
441
457
  isSwiping = value === 1;
442
- if (!isSwiping) {
443
- hasFired.current = false;
458
+ if (isSwiping) {
459
+ return;
460
+ }
461
+ hasFired.current = false;
462
+ if (wasSwiping && commitThreshold > 0 && lastTravel >= commitThreshold) {
463
+ pendingPopProbe = setTimeout(() => {
464
+ navigator?.maxApi?.triggerEventVibration?.('heavy');
465
+ }, 500);
444
466
  }
467
+ lastTravel = 0;
445
468
  });
446
469
 
447
470
  const gestureListener = gesture.addListener(({ value: translation }) => {
@@ -449,7 +472,9 @@ const useSwipeBackHaptic = () => {
449
472
  return;
450
473
  }
451
474
 
452
- if (translation * direction < commitThreshold) {
475
+ lastTravel = translation * direction;
476
+
477
+ if (lastTravel < commitThreshold) {
453
478
  hasFired.current = false;
454
479
  return;
455
480
  }
@@ -461,6 +486,10 @@ const useSwipeBackHaptic = () => {
461
486
  });
462
487
 
463
488
  return () => {
489
+ // unmount cancels the probe: the screen popped, which is the success case
490
+ if (pendingPopProbe !== undefined) {
491
+ clearTimeout(pendingPopProbe);
492
+ }
464
493
  gesture.removeListener(gestureListener);
465
494
  swiping.removeListener(swipingListener);
466
495
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.164.1-beta.5",
3
+ "version": "0.164.1-beta.6",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},