@tamagui/core 3.0.0-beta.1420.1 → 3.0.0-beta.1432.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 +84 -40
- package/dist/test.native.cjs +84 -40
- package/package.json +12 -12
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13715
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13726
|
-
|
|
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,
|
package/dist/test.native.cjs
CHANGED
|
@@ -3798,8 +3798,18 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
3798
3798
|
pressOutTimer: null,
|
|
3799
3799
|
longPressTimer: null,
|
|
3800
3800
|
activateTime: 0,
|
|
3801
|
-
blockedByExternalOwnership: false
|
|
3801
|
+
blockedByExternalOwnership: false,
|
|
3802
|
+
pressInOutstanding: false
|
|
3802
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
|
+
}, []);
|
|
3803
3813
|
if (!enabled || !events) return;
|
|
3804
3814
|
var _events_delayPressIn;
|
|
3805
3815
|
var delayPressIn = Math.max(0, (_events_delayPressIn = events.delayPressIn) !== null && _events_delayPressIn !== void 0 ? _events_delayPressIn : 0);
|
|
@@ -3811,30 +3821,45 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
3811
3821
|
var minPressDuration = Math.max(0, (_events_minPressDuration = events.minPressDuration) !== null && _events_minPressDuration !== void 0 ? _events_minPressDuration : DEFAULT_MIN_PRESS_DURATION);
|
|
3812
3822
|
function activate(e) {
|
|
3813
3823
|
var _events_onPressIn;
|
|
3824
|
+
if (ref.current.pressInOutstanding) return;
|
|
3825
|
+
ref.current.pressInOutstanding = true;
|
|
3814
3826
|
ref.current.state = "active";
|
|
3815
3827
|
ref.current.activateTime = Date.now();
|
|
3816
3828
|
(_events_onPressIn = events.onPressIn) === null || _events_onPressIn === void 0 || _events_onPressIn.call(events, e);
|
|
3817
3829
|
}
|
|
3818
|
-
function
|
|
3819
|
-
var pressDuration = Date.now() - ref.current.activateTime;
|
|
3820
|
-
var remaining = Math.max(minPressDuration - pressDuration, delayPressOut);
|
|
3821
|
-
if (remaining > 0) ref.current.pressOutTimer = setTimeout(function() {
|
|
3822
|
-
var _events_onPressOut2;
|
|
3823
|
-
(_events_onPressOut2 = events.onPressOut) === null || _events_onPressOut2 === void 0 || _events_onPressOut2.call(events, e);
|
|
3824
|
-
}, remaining);
|
|
3825
|
-
else {
|
|
3826
|
-
var _events_onPressOut;
|
|
3827
|
-
(_events_onPressOut = events.onPressOut) === null || _events_onPressOut === void 0 || _events_onPressOut.call(events, e);
|
|
3828
|
-
}
|
|
3829
|
-
}
|
|
3830
|
-
function cleanup() {
|
|
3830
|
+
function clearStartTimers() {
|
|
3831
3831
|
if (ref.current.pressInTimer) clearTimeout(ref.current.pressInTimer);
|
|
3832
|
-
if (ref.current.pressOutTimer) clearTimeout(ref.current.pressOutTimer);
|
|
3833
3832
|
if (ref.current.longPressTimer) clearTimeout(ref.current.longPressTimer);
|
|
3834
3833
|
ref.current.pressInTimer = null;
|
|
3835
|
-
ref.current.pressOutTimer = null;
|
|
3836
3834
|
ref.current.longPressTimer = null;
|
|
3837
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
|
+
}
|
|
3838
3863
|
var userStartShouldSet = viewProps.onStartShouldSetResponder;
|
|
3839
3864
|
var userGrant = viewProps.onResponderGrant;
|
|
3840
3865
|
var userRelease = viewProps.onResponderRelease;
|
|
@@ -3846,7 +3871,8 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
3846
3871
|
return !events.disabled && !hasExternalPressOwnership();
|
|
3847
3872
|
};
|
|
3848
3873
|
viewProps.onResponderGrant = function(e) {
|
|
3849
|
-
|
|
3874
|
+
releasePressOut(e);
|
|
3875
|
+
clearStartTimers();
|
|
3850
3876
|
if (hasExternalPressOwnership()) {
|
|
3851
3877
|
ref.current.state = "idle";
|
|
3852
3878
|
ref.current.blockedByExternalOwnership = true;
|
|
@@ -3869,29 +3895,23 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
3869
3895
|
};
|
|
3870
3896
|
viewProps.onResponderRelease = function(e) {
|
|
3871
3897
|
if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
|
|
3872
|
-
|
|
3873
|
-
ref.current.blockedByExternalOwnership = false;
|
|
3874
|
-
ref.current.state = "idle";
|
|
3898
|
+
resetPress(e);
|
|
3875
3899
|
return;
|
|
3876
3900
|
}
|
|
3877
3901
|
userRelease === null || userRelease === void 0 || userRelease(e);
|
|
3878
3902
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
3879
|
-
|
|
3903
|
+
clearStartTimers();
|
|
3880
3904
|
if (ref.current.state === "pressing") activate(e);
|
|
3881
3905
|
if (!wasLongPressed) {
|
|
3882
3906
|
var _events_onPress;
|
|
3883
3907
|
(_events_onPress = events.onPress) === null || _events_onPress === void 0 || _events_onPress.call(events, e);
|
|
3884
3908
|
}
|
|
3885
3909
|
deactivate(e);
|
|
3886
|
-
ref.current.state = "idle";
|
|
3887
3910
|
ref.current.blockedByExternalOwnership = false;
|
|
3888
3911
|
};
|
|
3889
3912
|
viewProps.onResponderTerminate = function(e) {
|
|
3890
3913
|
userTerminate === null || userTerminate === void 0 || userTerminate(e);
|
|
3891
|
-
|
|
3892
|
-
if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
|
|
3893
|
-
ref.current.state = "idle";
|
|
3894
|
-
ref.current.blockedByExternalOwnership = false;
|
|
3914
|
+
resetPress(e);
|
|
3895
3915
|
};
|
|
3896
3916
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
3897
3917
|
if (userTerminationRequest) return userTerminationRequest(e);
|
|
@@ -3964,6 +3984,21 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
3964
3984
|
if (isUsingRNGH) {
|
|
3965
3985
|
var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
|
|
3966
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
|
+
};
|
|
3967
4002
|
useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
|
|
3968
4003
|
if (everEnabled) {
|
|
3969
4004
|
callbacksRef.current = hasPressEvents ? {
|
|
@@ -3973,32 +4008,29 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
3973
4008
|
onLongPress: events.onLongPress
|
|
3974
4009
|
} : {};
|
|
3975
4010
|
if (hasRealPressEvents && !isInsideNativeMenu) {
|
|
4011
|
+
endPress();
|
|
3976
4012
|
gestureRef.current = null;
|
|
3977
4013
|
return null;
|
|
3978
4014
|
}
|
|
3979
4015
|
if (!gestureRef.current) {
|
|
3980
4016
|
var { Gesture } = gh.state;
|
|
3981
4017
|
if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
|
|
3982
|
-
|
|
3983
|
-
(_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 || _callbacksRef_current_onPressIn.call(_callbacksRef_current, {});
|
|
4018
|
+
beginPress();
|
|
3984
4019
|
}).onTouchesUp(function() {
|
|
3985
|
-
|
|
3986
|
-
(_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, {});
|
|
3987
|
-
(_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);
|
|
3988
4021
|
}).onTouchesCancelled(function() {
|
|
3989
|
-
|
|
3990
|
-
|
|
4022
|
+
endPress();
|
|
4023
|
+
}).onFinalize(function() {
|
|
4024
|
+
endPress();
|
|
3991
4025
|
});
|
|
3992
4026
|
else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
|
|
3993
|
-
|
|
3994
|
-
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);
|
|
3995
4028
|
}).onTouchesUp(function(e) {
|
|
3996
|
-
|
|
3997
|
-
(_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 || _callbacksRef_current_onPress.call(_callbacksRef_current, e);
|
|
3998
|
-
(_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);
|
|
3999
4030
|
}).onTouchesCancelled(function(e) {
|
|
4000
|
-
|
|
4001
|
-
|
|
4031
|
+
return endPress(e);
|
|
4032
|
+
}).onFinalize(function() {
|
|
4033
|
+
return endPress();
|
|
4002
4034
|
});
|
|
4003
4035
|
}
|
|
4004
4036
|
return gestureRef.current;
|
|
@@ -8820,6 +8852,18 @@ ${banner}
|
|
|
8820
8852
|
onBlur === null || onBlur === void 0 || onBlur(e);
|
|
8821
8853
|
}
|
|
8822
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]);
|
|
8823
8867
|
if (events && !asChild) Object.assign(events, {
|
|
8824
8868
|
cancelable: !viewProps.rejectResponderTermination,
|
|
8825
8869
|
disabled,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1432.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.
|
|
141
|
-
"@tamagui/constants": "3.0.0-beta.
|
|
142
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
143
|
-
"@tamagui/react-native-media-driver": "3.0.0-beta.
|
|
144
|
-
"@tamagui/react-native-use-pressable": "3.0.0-beta.
|
|
145
|
-
"@tamagui/use-element-layout": "3.0.0-beta.
|
|
146
|
-
"@tamagui/use-event": "3.0.0-beta.
|
|
147
|
-
"@tamagui/web": "3.0.0-beta.
|
|
140
|
+
"@tamagui/compose-refs": "3.0.0-beta.1432.1",
|
|
141
|
+
"@tamagui/constants": "3.0.0-beta.1432.1",
|
|
142
|
+
"@tamagui/helpers": "3.0.0-beta.1432.1",
|
|
143
|
+
"@tamagui/react-native-media-driver": "3.0.0-beta.1432.1",
|
|
144
|
+
"@tamagui/react-native-use-pressable": "3.0.0-beta.1432.1",
|
|
145
|
+
"@tamagui/use-element-layout": "3.0.0-beta.1432.1",
|
|
146
|
+
"@tamagui/use-event": "3.0.0-beta.1432.1",
|
|
147
|
+
"@tamagui/web": "3.0.0-beta.1432.1"
|
|
148
148
|
},
|
|
149
149
|
"devDependencies": {
|
|
150
|
-
"@tamagui/build": "3.0.0-beta.
|
|
151
|
-
"@tamagui/native-bundle": "3.0.0-beta.
|
|
152
|
-
"@tamagui/react-native-web-lite": "3.0.0-beta.
|
|
150
|
+
"@tamagui/build": "3.0.0-beta.1432.1",
|
|
151
|
+
"@tamagui/native-bundle": "3.0.0-beta.1432.1",
|
|
152
|
+
"@tamagui/react-native-web-lite": "3.0.0-beta.1432.1",
|
|
153
153
|
"@testing-library/react": "^16.1.0",
|
|
154
154
|
"csstype": "^3.0.10",
|
|
155
155
|
"react": "19.2.3",
|