@tamagui/core 3.0.0-beta.1419.1 → 3.0.0-beta.1422.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/native.cjs CHANGED
@@ -13523,8 +13523,18 @@ function useMainThreadPressEvents(events, viewProps) {
13523
13523
  pressOutTimer: null,
13524
13524
  longPressTimer: null,
13525
13525
  activateTime: 0,
13526
- blockedByExternalOwnership: false
13526
+ blockedByExternalOwnership: false,
13527
+ pressInOutstanding: false
13527
13528
  };
13529
+ (0, react.useEffect)(function() {
13530
+ return function() {
13531
+ clearStartTimers();
13532
+ if (ref.current.pressOutTimer) {
13533
+ clearTimeout(ref.current.pressOutTimer);
13534
+ ref.current.pressOutTimer = null;
13535
+ }
13536
+ };
13537
+ }, []);
13528
13538
  if (!enabled || !events) return;
13529
13539
  var _events_delayPressIn;
13530
13540
  var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);
@@ -13536,30 +13546,45 @@ function useMainThreadPressEvents(events, viewProps) {
13536
13546
  var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);
13537
13547
  function activate(e) {
13538
13548
  var _events_onPressIn;
13549
+ if (ref.current.pressInOutstanding) return;
13550
+ ref.current.pressInOutstanding = true;
13539
13551
  ref.current.state = "active";
13540
13552
  ref.current.activateTime = Date.now();
13541
13553
  (_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 || _events_onPressIn.call(events, e);
13542
13554
  }
13543
- function deactivate(e) {
13544
- var pressDuration = Date.now() - ref.current.activateTime;
13545
- var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
13546
- if (remaining > 0) ref.current.pressOutTimer = setTimeout(function() {
13547
- var _events_onPressOut2;
13548
- (_events_onPressOut2 = events.onPressOut) === null || _events_onPressOut2 === void 0 || _events_onPressOut2.call(events, e);
13549
- }, remaining);
13550
- else {
13551
- var _events_onPressOut;
13552
- (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 || _events_onPressOut.call(events, e);
13553
- }
13554
- }
13555
- function cleanup() {
13555
+ function clearStartTimers() {
13556
13556
  if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);
13557
- if (ref.current.pressOutTimer) clearTimeout(ref.current.pressOutTimer);
13558
13557
  if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);
13559
13558
  ref.current.pressInTimer = null;
13560
- ref.current.pressOutTimer = null;
13561
13559
  ref.current.longPressTimer = null;
13562
13560
  }
13561
+ function releasePressOut(e) {
13562
+ var _events_onPressOut;
13563
+ if (ref.current.pressOutTimer) {
13564
+ clearTimeout(ref.current.pressOutTimer);
13565
+ ref.current.pressOutTimer = null;
13566
+ }
13567
+ if (!ref.current.pressInOutstanding) return;
13568
+ ref.current.pressInOutstanding = false;
13569
+ ref.current.state = "idle";
13570
+ (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 || _events_onPressOut.call(events, e);
13571
+ }
13572
+ function deactivate(e) {
13573
+ if (!ref.current.pressInOutstanding) return;
13574
+ var pressDuration = Date.now() - ref.current.activateTime;
13575
+ var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
13576
+ if (remaining > 0) {
13577
+ if (!ref.current.pressOutTimer) ref.current.pressOutTimer = setTimeout(function() {
13578
+ ref.current.pressOutTimer = null;
13579
+ releasePressOut(e);
13580
+ }, remaining);
13581
+ } else releasePressOut(e);
13582
+ }
13583
+ function resetPress(e) {
13584
+ releasePressOut(e);
13585
+ clearStartTimers();
13586
+ ref.current.blockedByExternalOwnership = false;
13587
+ }
13563
13588
  var userStartShouldSet = viewProps.onStartShouldSetResponder;
13564
13589
  var userGrant = viewProps.onResponderGrant;
13565
13590
  var userRelease = viewProps.onResponderRelease;
@@ -13571,7 +13596,8 @@ function useMainThreadPressEvents(events, viewProps) {
13571
13596
  return !events.disabled && !hasExternalPressOwnership();
13572
13597
  };
13573
13598
  viewProps.onResponderGrant = function(e) {
13574
- cleanup();
13599
+ releasePressOut(e);
13600
+ clearStartTimers();
13575
13601
  if (hasExternalPressOwnership()) {
13576
13602
  ref.current.state = "idle";
13577
13603
  ref.current.blockedByExternalOwnership = true;
@@ -13594,29 +13620,23 @@ function useMainThreadPressEvents(events, viewProps) {
13594
13620
  };
13595
13621
  viewProps.onResponderRelease = function(e) {
13596
13622
  if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
13597
- cleanup();
13598
- ref.current.blockedByExternalOwnership = false;
13599
- ref.current.state = "idle";
13623
+ resetPress(e);
13600
13624
  return;
13601
13625
  }
13602
13626
  userRelease === null || userRelease === void 0 || userRelease(e);
13603
13627
  var wasLongPressed = ref.current.state === "longPressed";
13604
- cleanup();
13628
+ clearStartTimers();
13605
13629
  if (ref.current.state === "pressing") activate(e);
13606
13630
  if (!wasLongPressed) {
13607
13631
  var _events_onPress;
13608
13632
  (_events_onPress = events.onPress) === null || _events_onPress === void 0 || _events_onPress.call(events, e);
13609
13633
  }
13610
13634
  deactivate(e);
13611
- ref.current.state = "idle";
13612
13635
  ref.current.blockedByExternalOwnership = false;
13613
13636
  };
13614
13637
  viewProps.onResponderTerminate = function(e) {
13615
13638
  userTerminate === null || userTerminate === void 0 || userTerminate(e);
13616
- cleanup();
13617
- if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
13618
- ref.current.state = "idle";
13619
- ref.current.blockedByExternalOwnership = false;
13639
+ resetPress(e);
13620
13640
  };
13621
13641
  viewProps.onResponderTerminationRequest = function(e) {
13622
13642
  if (userTerminationRequest) return userTerminationRequest(e);
@@ -13689,6 +13709,21 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
13689
13709
  if (isUsingRNGH) {
13690
13710
  var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
13691
13711
  var gestureRef = (0, react.useRef)(null);
13712
+ var pressActiveRef = (0, react.useRef)(false);
13713
+ var beginPress = function(e) {
13714
+ var _callbacksRef_current_onPressIn, _callbacksRef_current;
13715
+ if (pressActiveRef.current) return;
13716
+ pressActiveRef.current = true;
13717
+ (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 || _callbacksRef_current_onPressIn.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
13718
+ };
13719
+ var endPress = function(e) {
13720
+ var firePress = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
13721
+ var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
13722
+ if (!pressActiveRef.current) return;
13723
+ pressActiveRef.current = false;
13724
+ if (firePress) (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
13725
+ (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e !== null && e !== void 0 ? e : {});
13726
+ };
13692
13727
  useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
13693
13728
  if (everEnabled) {
13694
13729
  callbacksRef.current = hasPressEvents ? {
@@ -13698,32 +13733,29 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
13698
13733
  onLongPress: events.onLongPress
13699
13734
  } : {};
13700
13735
  if (hasRealPressEvents && !isInsideNativeMenu) {
13736
+ endPress();
13701
13737
  gestureRef.current = null;
13702
13738
  return null;
13703
13739
  }
13704
13740
  if (!gestureRef.current) {
13705
13741
  var { Gesture } = gh.state;
13706
13742
  if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
13707
- var _callbacksRef_current_onPressIn, _callbacksRef_current;
13708
- (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 || _callbacksRef_current_onPressIn.call(_callbacksRef_current, {});
13743
+ beginPress();
13709
13744
  }).onTouchesUp(function() {
13710
- var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
13711
- (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, {});
13712
- (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current1, {});
13745
+ endPress(void 0, true);
13713
13746
  }).onTouchesCancelled(function() {
13714
- var _callbacksRef_current_onPressOut, _callbacksRef_current;
13715
- (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});
13747
+ endPress();
13748
+ }).onFinalize(function() {
13749
+ endPress();
13716
13750
  });
13717
13751
  else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
13718
- var _callbacksRef_current_onPressIn, _callbacksRef_current;
13719
- return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
13752
+ return beginPress(e);
13720
13753
  }).onTouchesUp(function(e) {
13721
- var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
13722
- (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, e);
13723
- (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e);
13754
+ endPress(e, true);
13724
13755
  }).onTouchesCancelled(function(e) {
13725
- var _callbacksRef_current_onPressOut, _callbacksRef_current;
13726
- return (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current, e);
13756
+ return endPress(e);
13757
+ }).onFinalize(function() {
13758
+ return endPress();
13727
13759
  });
13728
13760
  }
13729
13761
  return gestureRef.current;
@@ -17730,6 +17762,18 @@ function createComponent(staticConfig) {
17730
17762
  onBlur === null || onBlur === void 0 || onBlur(e);
17731
17763
  }
17732
17764
  }) : null;
17765
+ useIsomorphicLayoutEffect(function() {
17766
+ var hadPressPlumbing = stateRef.current.hadAttachPress;
17767
+ stateRef.current.hadAttachPress = attachPress;
17768
+ if (hadPressPlumbing && !attachPress && !(pseudoGroups === null || pseudoGroups === void 0 ? void 0 : pseudoGroups.size)) {
17769
+ var _stateRef_current_setStateShallow;
17770
+ var clearPress = (_stateRef_current_setStateShallow = stateRef.current.setStateShallow) !== null && _stateRef_current_setStateShallow !== void 0 ? _stateRef_current_setStateShallow : stateRef.current.baseSetStateShallow;
17771
+ clearPress === null || clearPress === void 0 || clearPress({
17772
+ press: false,
17773
+ pressIn: false
17774
+ });
17775
+ }
17776
+ }, [attachPress, pseudoGroups]);
17733
17777
  if (events && !asChild) Object.assign(events, {
17734
17778
  cancelable: !viewProps.rejectResponderTermination,
17735
17779
  disabled,
@@ -1886,8 +1886,9 @@ function createStylePiece(definition) {
1886
1886
  }
1887
1887
  function style(definition) {
1888
1888
  if (globalThis.process.env.NODE_ENV === "development") {
1889
+ var _internals_A_getOwner, _internals_A;
1889
1890
  var internals = react.default.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
1890
- if (internals === null || internals === void 0 ? void 0 : internals.H) warnOnce("[tamagui] style() was called during render. Define style pieces at module scope so their rules compile once.");
1891
+ if (internals === null || internals === void 0 ? void 0 : (_internals_A = internals.A) === null || _internals_A === void 0 ? void 0 : (_internals_A_getOwner = _internals_A.getOwner) === null || _internals_A_getOwner === void 0 ? void 0 : _internals_A_getOwner.call(_internals_A)) warnOnce("[tamagui] style() was called during render. Define style pieces at module scope so their rules compile once.");
1891
1892
  }
1892
1893
  return createStylePiece(definition);
1893
1894
  }
@@ -3797,8 +3798,18 @@ function useMainThreadPressEvents(events, viewProps) {
3797
3798
  pressOutTimer: null,
3798
3799
  longPressTimer: null,
3799
3800
  activateTime: 0,
3800
- blockedByExternalOwnership: false
3801
+ blockedByExternalOwnership: false,
3802
+ pressInOutstanding: false
3801
3803
  };
3804
+ (0, react.useEffect)(function() {
3805
+ return function() {
3806
+ clearStartTimers();
3807
+ if (ref.current.pressOutTimer) {
3808
+ clearTimeout(ref.current.pressOutTimer);
3809
+ ref.current.pressOutTimer = null;
3810
+ }
3811
+ };
3812
+ }, []);
3802
3813
  if (!enabled || !events) return;
3803
3814
  var _events_delayPressIn;
3804
3815
  var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);
@@ -3810,30 +3821,45 @@ function useMainThreadPressEvents(events, viewProps) {
3810
3821
  var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);
3811
3822
  function activate(e) {
3812
3823
  var _events_onPressIn;
3824
+ if (ref.current.pressInOutstanding) return;
3825
+ ref.current.pressInOutstanding = true;
3813
3826
  ref.current.state = "active";
3814
3827
  ref.current.activateTime = Date.now();
3815
3828
  (_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 || _events_onPressIn.call(events, e);
3816
3829
  }
3817
- function deactivate(e) {
3818
- var pressDuration = Date.now() - ref.current.activateTime;
3819
- var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
3820
- if (remaining > 0) ref.current.pressOutTimer = setTimeout(function() {
3821
- var _events_onPressOut2;
3822
- (_events_onPressOut2 = events.onPressOut) === null || _events_onPressOut2 === void 0 || _events_onPressOut2.call(events, e);
3823
- }, remaining);
3824
- else {
3825
- var _events_onPressOut;
3826
- (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 || _events_onPressOut.call(events, e);
3827
- }
3828
- }
3829
- function cleanup() {
3830
+ function clearStartTimers() {
3830
3831
  if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);
3831
- if (ref.current.pressOutTimer) clearTimeout(ref.current.pressOutTimer);
3832
3832
  if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);
3833
3833
  ref.current.pressInTimer = null;
3834
- ref.current.pressOutTimer = null;
3835
3834
  ref.current.longPressTimer = null;
3836
3835
  }
3836
+ function releasePressOut(e) {
3837
+ var _events_onPressOut;
3838
+ if (ref.current.pressOutTimer) {
3839
+ clearTimeout(ref.current.pressOutTimer);
3840
+ ref.current.pressOutTimer = null;
3841
+ }
3842
+ if (!ref.current.pressInOutstanding) return;
3843
+ ref.current.pressInOutstanding = false;
3844
+ ref.current.state = "idle";
3845
+ (_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 || _events_onPressOut.call(events, e);
3846
+ }
3847
+ function deactivate(e) {
3848
+ if (!ref.current.pressInOutstanding) return;
3849
+ var pressDuration = Date.now() - ref.current.activateTime;
3850
+ var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
3851
+ if (remaining > 0) {
3852
+ if (!ref.current.pressOutTimer) ref.current.pressOutTimer = setTimeout(function() {
3853
+ ref.current.pressOutTimer = null;
3854
+ releasePressOut(e);
3855
+ }, remaining);
3856
+ } else releasePressOut(e);
3857
+ }
3858
+ function resetPress(e) {
3859
+ releasePressOut(e);
3860
+ clearStartTimers();
3861
+ ref.current.blockedByExternalOwnership = false;
3862
+ }
3837
3863
  var userStartShouldSet = viewProps.onStartShouldSetResponder;
3838
3864
  var userGrant = viewProps.onResponderGrant;
3839
3865
  var userRelease = viewProps.onResponderRelease;
@@ -3845,7 +3871,8 @@ function useMainThreadPressEvents(events, viewProps) {
3845
3871
  return !events.disabled && !hasExternalPressOwnership();
3846
3872
  };
3847
3873
  viewProps.onResponderGrant = function(e) {
3848
- cleanup();
3874
+ releasePressOut(e);
3875
+ clearStartTimers();
3849
3876
  if (hasExternalPressOwnership()) {
3850
3877
  ref.current.state = "idle";
3851
3878
  ref.current.blockedByExternalOwnership = true;
@@ -3868,29 +3895,23 @@ function useMainThreadPressEvents(events, viewProps) {
3868
3895
  };
3869
3896
  viewProps.onResponderRelease = function(e) {
3870
3897
  if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
3871
- cleanup();
3872
- ref.current.blockedByExternalOwnership = false;
3873
- ref.current.state = "idle";
3898
+ resetPress(e);
3874
3899
  return;
3875
3900
  }
3876
3901
  userRelease === null || userRelease === void 0 || userRelease(e);
3877
3902
  var wasLongPressed = ref.current.state === "longPressed";
3878
- cleanup();
3903
+ clearStartTimers();
3879
3904
  if (ref.current.state === "pressing") activate(e);
3880
3905
  if (!wasLongPressed) {
3881
3906
  var _events_onPress;
3882
3907
  (_events_onPress = events.onPress) === null || _events_onPress === void 0 || _events_onPress.call(events, e);
3883
3908
  }
3884
3909
  deactivate(e);
3885
- ref.current.state = "idle";
3886
3910
  ref.current.blockedByExternalOwnership = false;
3887
3911
  };
3888
3912
  viewProps.onResponderTerminate = function(e) {
3889
3913
  userTerminate === null || userTerminate === void 0 || userTerminate(e);
3890
- cleanup();
3891
- if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
3892
- ref.current.state = "idle";
3893
- ref.current.blockedByExternalOwnership = false;
3914
+ resetPress(e);
3894
3915
  };
3895
3916
  viewProps.onResponderTerminationRequest = function(e) {
3896
3917
  if (userTerminationRequest) return userTerminationRequest(e);
@@ -3963,6 +3984,21 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
3963
3984
  if (isUsingRNGH) {
3964
3985
  var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
3965
3986
  var gestureRef = (0, react.useRef)(null);
3987
+ var pressActiveRef = (0, react.useRef)(false);
3988
+ var beginPress = function(e) {
3989
+ var _callbacksRef_current_onPressIn, _callbacksRef_current;
3990
+ if (pressActiveRef.current) return;
3991
+ pressActiveRef.current = true;
3992
+ (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 || _callbacksRef_current_onPressIn.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
3993
+ };
3994
+ var endPress = function(e) {
3995
+ var firePress = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
3996
+ var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
3997
+ if (!pressActiveRef.current) return;
3998
+ pressActiveRef.current = false;
3999
+ if (firePress) (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, e !== null && e !== void 0 ? e : {});
4000
+ (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e !== null && e !== void 0 ? e : {});
4001
+ };
3966
4002
  useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
3967
4003
  if (everEnabled) {
3968
4004
  callbacksRef.current = hasPressEvents ? {
@@ -3972,32 +4008,29 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
3972
4008
  onLongPress: events.onLongPress
3973
4009
  } : {};
3974
4010
  if (hasRealPressEvents && !isInsideNativeMenu) {
4011
+ endPress();
3975
4012
  gestureRef.current = null;
3976
4013
  return null;
3977
4014
  }
3978
4015
  if (!gestureRef.current) {
3979
4016
  var { Gesture } = gh.state;
3980
4017
  if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
3981
- var _callbacksRef_current_onPressIn, _callbacksRef_current;
3982
- (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 || _callbacksRef_current_onPressIn.call(_callbacksRef_current, {});
4018
+ beginPress();
3983
4019
  }).onTouchesUp(function() {
3984
- var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
3985
- (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, {});
3986
- (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current1, {});
4020
+ endPress(void 0, true);
3987
4021
  }).onTouchesCancelled(function() {
3988
- var _callbacksRef_current_onPressOut, _callbacksRef_current;
3989
- (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});
4022
+ endPress();
4023
+ }).onFinalize(function() {
4024
+ endPress();
3990
4025
  });
3991
4026
  else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
3992
- var _callbacksRef_current_onPressIn, _callbacksRef_current;
3993
- return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
4027
+ return beginPress(e);
3994
4028
  }).onTouchesUp(function(e) {
3995
- var _callbacksRef_current_onPress, _callbacksRef_current, _callbacksRef_current_onPressOut, _callbacksRef_current1;
3996
- (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, e);
3997
- (_callbacksRef_current_onPressOut = (_callbacksRef_current1 = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current1, e);
4029
+ endPress(e, true);
3998
4030
  }).onTouchesCancelled(function(e) {
3999
- var _callbacksRef_current_onPressOut, _callbacksRef_current;
4000
- return (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current, e);
4031
+ return endPress(e);
4032
+ }).onFinalize(function() {
4033
+ return endPress();
4001
4034
  });
4002
4035
  }
4003
4036
  return gestureRef.current;
@@ -8819,6 +8852,18 @@ ${banner}
8819
8852
  onBlur === null || onBlur === void 0 || onBlur(e);
8820
8853
  }
8821
8854
  }) : null;
8855
+ useIsomorphicLayoutEffect(function() {
8856
+ var hadPressPlumbing = stateRef.current.hadAttachPress;
8857
+ stateRef.current.hadAttachPress = attachPress;
8858
+ if (hadPressPlumbing && !attachPress && !(pseudoGroups === null || pseudoGroups === void 0 ? void 0 : pseudoGroups.size)) {
8859
+ var _stateRef_current_setStateShallow;
8860
+ var clearPress = (_stateRef_current_setStateShallow = stateRef.current.setStateShallow) !== null && _stateRef_current_setStateShallow !== void 0 ? _stateRef_current_setStateShallow : stateRef.current.baseSetStateShallow;
8861
+ clearPress === null || clearPress === void 0 || clearPress({
8862
+ press: false,
8863
+ pressIn: false
8864
+ });
8865
+ }
8866
+ }, [attachPress, pseudoGroups]);
8822
8867
  if (events && !asChild) Object.assign(events, {
8823
8868
  cancelable: !viewProps.rejectResponderTermination,
8824
8869
  disabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "3.0.0-beta.1419.1",
3
+ "version": "3.0.0-beta.1422.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -137,19 +137,19 @@
137
137
  "clean:build": "tamagui-build clean:build"
138
138
  },
139
139
  "dependencies": {
140
- "@tamagui/compose-refs": "3.0.0-beta.1419.1",
141
- "@tamagui/constants": "3.0.0-beta.1419.1",
142
- "@tamagui/helpers": "3.0.0-beta.1419.1",
143
- "@tamagui/react-native-media-driver": "3.0.0-beta.1419.1",
144
- "@tamagui/react-native-use-pressable": "3.0.0-beta.1419.1",
145
- "@tamagui/use-element-layout": "3.0.0-beta.1419.1",
146
- "@tamagui/use-event": "3.0.0-beta.1419.1",
147
- "@tamagui/web": "3.0.0-beta.1419.1"
140
+ "@tamagui/compose-refs": "3.0.0-beta.1422.1",
141
+ "@tamagui/constants": "3.0.0-beta.1422.1",
142
+ "@tamagui/helpers": "3.0.0-beta.1422.1",
143
+ "@tamagui/react-native-media-driver": "3.0.0-beta.1422.1",
144
+ "@tamagui/react-native-use-pressable": "3.0.0-beta.1422.1",
145
+ "@tamagui/use-element-layout": "3.0.0-beta.1422.1",
146
+ "@tamagui/use-event": "3.0.0-beta.1422.1",
147
+ "@tamagui/web": "3.0.0-beta.1422.1"
148
148
  },
149
149
  "devDependencies": {
150
- "@tamagui/build": "3.0.0-beta.1419.1",
151
- "@tamagui/native-bundle": "3.0.0-beta.1419.1",
152
- "@tamagui/react-native-web-lite": "3.0.0-beta.1419.1",
150
+ "@tamagui/build": "3.0.0-beta.1422.1",
151
+ "@tamagui/native-bundle": "3.0.0-beta.1422.1",
152
+ "@tamagui/react-native-web-lite": "3.0.0-beta.1422.1",
153
153
  "@testing-library/react": "^16.1.0",
154
154
  "csstype": "^3.0.10",
155
155
  "react": "19.2.3",