@tamagui/core 2.4.0 → 2.4.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/.turbo/turbo-build.log +2 -2
- package/dist/native.cjs +117 -91
- package/dist/test.native.cjs +107 -71
- package/package.json +10 -10
package/.turbo/turbo-build.log
CHANGED
package/dist/native.cjs
CHANGED
|
@@ -891,15 +891,35 @@ function startGlobalObservers() {
|
|
|
891
891
|
function rectsEqual(a, b) {
|
|
892
892
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {
|
|
895
|
+
var onLayout = LayoutHandlers.get(node);
|
|
896
|
+
if (typeof onLayout !== "function") return;
|
|
897
|
+
var cachedRect = NodeRectCache.get(node);
|
|
898
|
+
var cachedParentRect = NodeRectCache.get(parentNode);
|
|
899
|
+
var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
|
|
900
|
+
var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
|
|
901
|
+
if (!nodeChanged && !parentChanged) return;
|
|
902
|
+
NodeRectCache.set(node, nodeRect);
|
|
903
|
+
NodeRectCache.set(parentNode, parentRect);
|
|
904
|
+
var event = getElementLayoutEvent(nodeRect, parentRect, node);
|
|
905
|
+
if (avoidUpdates) queuedUpdates.set(node, function() {
|
|
906
|
+
return onLayout(event);
|
|
907
|
+
});
|
|
908
|
+
else onLayout(event);
|
|
909
|
+
}
|
|
910
|
+
function observeLayoutNode(node, disableKey) {
|
|
895
911
|
Nodes.add(node);
|
|
896
|
-
LayoutHandlers.set(node, onChange);
|
|
897
912
|
if (disableKey) LayoutDisableKey.set(node, disableKey);
|
|
913
|
+
else LayoutDisableKey.delete(node);
|
|
898
914
|
startGlobalObservers();
|
|
899
915
|
if (globalIntersectionObserver) {
|
|
900
916
|
globalIntersectionObserver.observe(node);
|
|
901
917
|
IntersectionState.set(node, true);
|
|
902
918
|
}
|
|
919
|
+
}
|
|
920
|
+
function registerLayoutNode(node, onChange, disableKey) {
|
|
921
|
+
LayoutHandlers.set(node, onChange);
|
|
922
|
+
observeLayoutNode(node, disableKey);
|
|
903
923
|
return function() {
|
|
904
924
|
return cleanupNode(node);
|
|
905
925
|
};
|
|
@@ -912,6 +932,17 @@ function cleanupNode(node) {
|
|
|
912
932
|
IntersectionState.delete(node);
|
|
913
933
|
if (globalIntersectionObserver) globalIntersectionObserver.unobserve(node);
|
|
914
934
|
}
|
|
935
|
+
function emitLayoutSync(node) {
|
|
936
|
+
var onLayout = LayoutHandlers.get(node);
|
|
937
|
+
if (typeof onLayout !== "function") return;
|
|
938
|
+
var parentNode = node.parentElement;
|
|
939
|
+
if (!parentNode) return;
|
|
940
|
+
var nodeRect = node.getBoundingClientRect();
|
|
941
|
+
var parentRect = parentNode.getBoundingClientRect();
|
|
942
|
+
NodeRectCache.set(node, nodeRect);
|
|
943
|
+
NodeRectCache.set(parentNode, parentRect);
|
|
944
|
+
onLayout(getElementLayoutEvent(nodeRect, parentRect, node));
|
|
945
|
+
}
|
|
915
946
|
function useElementLayout$1(ref, onLayout) {
|
|
916
947
|
var _ref_current;
|
|
917
948
|
var disableKey = (0, react.useContext)(DisableLayoutContextKey);
|
|
@@ -929,35 +960,17 @@ function useElementLayout$1(ref, onLayout) {
|
|
|
929
960
|
if (prevNode) cleanupNode(prevNode);
|
|
930
961
|
PrevHostNode.set(ref, nextNode);
|
|
931
962
|
if (!nextNode) return;
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
globalIntersectionObserver.observe(nextNode);
|
|
936
|
-
IntersectionState.set(nextNode, true);
|
|
937
|
-
}
|
|
938
|
-
var handler = LayoutHandlers.get(nextNode);
|
|
939
|
-
if (typeof handler !== "function") return;
|
|
940
|
-
var parentNode = nextNode.parentElement;
|
|
941
|
-
if (!parentNode) return;
|
|
942
|
-
var nodeRect = nextNode.getBoundingClientRect();
|
|
943
|
-
var parentRect = parentNode.getBoundingClientRect();
|
|
944
|
-
NodeRectCache.set(nextNode, nodeRect);
|
|
945
|
-
NodeRectCache.set(parentNode, parentRect);
|
|
946
|
-
handler(getElementLayoutEvent(nodeRect, parentRect, nextNode));
|
|
963
|
+
LayoutHandlers.set(nextNode, onLayout);
|
|
964
|
+
observeLayoutNode(nextNode, disableKey);
|
|
965
|
+
emitLayoutSync(nextNode);
|
|
947
966
|
});
|
|
948
967
|
useIsomorphicLayoutEffect(function() {
|
|
949
968
|
var _ref_current2;
|
|
950
969
|
if (!onLayout) return;
|
|
951
970
|
var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
|
|
952
971
|
if (!node2) return;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
if (globalIntersectionObserver) {
|
|
956
|
-
globalIntersectionObserver.observe(node2);
|
|
957
|
-
IntersectionState.set(node2, true);
|
|
958
|
-
}
|
|
959
|
-
var parentNode = node2.parentNode;
|
|
960
|
-
if (parentNode) onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect(), node2));
|
|
972
|
+
LayoutHandlers.set(node2, onLayout);
|
|
973
|
+
observeLayoutNode(node2, disableKey);
|
|
961
974
|
return function() {
|
|
962
975
|
cleanupNode(node2);
|
|
963
976
|
var swappedNode = PrevHostNode.get(ref);
|
|
@@ -1033,8 +1046,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1033
1046
|
}
|
|
1034
1047
|
function _updateLayoutIfChanged() {
|
|
1035
1048
|
_updateLayoutIfChanged = _asyncToGenerator(function* (node) {
|
|
1036
|
-
|
|
1037
|
-
if (typeof onLayout !== "function") return;
|
|
1049
|
+
if (typeof LayoutHandlers.get(node) !== "function") return;
|
|
1038
1050
|
var parentNode = node.parentElement;
|
|
1039
1051
|
if (!parentNode) return;
|
|
1040
1052
|
var nodeRect;
|
|
@@ -1047,19 +1059,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1047
1059
|
nodeRect = node.getBoundingClientRect();
|
|
1048
1060
|
parentRect = parentNode.getBoundingClientRect();
|
|
1049
1061
|
}
|
|
1050
|
-
|
|
1051
|
-
var cachedParentRect = NodeRectCache.get(parentNode);
|
|
1052
|
-
var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
|
|
1053
|
-
var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
|
|
1054
|
-
if (nodeChanged || parentChanged) {
|
|
1055
|
-
NodeRectCache.set(node, nodeRect);
|
|
1056
|
-
NodeRectCache.set(parentNode, parentRect);
|
|
1057
|
-
var event = getElementLayoutEvent(nodeRect, parentRect, node);
|
|
1058
|
-
if (avoidUpdates) queuedUpdates.set(node, function() {
|
|
1059
|
-
return onLayout(event);
|
|
1060
|
-
});
|
|
1061
|
-
else onLayout(event);
|
|
1062
|
-
}
|
|
1062
|
+
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
1063
1063
|
});
|
|
1064
1064
|
return _updateLayoutIfChanged.apply(this, arguments);
|
|
1065
1065
|
}
|
|
@@ -13609,6 +13609,10 @@ function resetPressOwner() {
|
|
|
13609
13609
|
function resetStaleOwner(now, debugName) {
|
|
13610
13610
|
if (now - pressState.timestamp > 2e3) resetPressOwner();
|
|
13611
13611
|
}
|
|
13612
|
+
function hasExternalPressOwnership() {
|
|
13613
|
+
resetStaleOwner(Date.now());
|
|
13614
|
+
return pressState.ownerSource === "external";
|
|
13615
|
+
}
|
|
13612
13616
|
function getGestureHandler() {
|
|
13613
13617
|
return {
|
|
13614
13618
|
get isEnabled() {
|
|
@@ -13739,7 +13743,7 @@ function getGestureHandler() {
|
|
|
13739
13743
|
}
|
|
13740
13744
|
};
|
|
13741
13745
|
}
|
|
13742
|
-
var state, GESTURE_ENABLED_FREEZE_KEY$1, pressGestureDebugId, PRESS_MOVE_CANCEL_DISTANCE, PRESS_MOVE_CANCEL_DISTANCE_SQ, pressState;
|
|
13746
|
+
var _globalThis, _PRESS_STATE_KEY, state, GESTURE_ENABLED_FREEZE_KEY$1, pressGestureDebugId, PRESS_MOVE_CANCEL_DISTANCE, PRESS_MOVE_CANCEL_DISTANCE_SQ, PRESS_STATE_KEY, _$1, pressState;
|
|
13743
13747
|
var init_gestureState_native = __esmMin((() => {
|
|
13744
13748
|
init_globalState_native();
|
|
13745
13749
|
state = createGlobalState(`gesture`, {
|
|
@@ -13753,7 +13757,8 @@ var init_gestureState_native = __esmMin((() => {
|
|
|
13753
13757
|
pressGestureDebugId = 0;
|
|
13754
13758
|
PRESS_MOVE_CANCEL_DISTANCE = 12;
|
|
13755
13759
|
PRESS_MOVE_CANCEL_DISTANCE_SQ = PRESS_MOVE_CANCEL_DISTANCE * PRESS_MOVE_CANCEL_DISTANCE;
|
|
13756
|
-
|
|
13760
|
+
PRESS_STATE_KEY = "__tamagui_press_state__";
|
|
13761
|
+
pressState = (_$1 = (_globalThis = globalThis)[_PRESS_STATE_KEY = PRESS_STATE_KEY]) !== null && _$1 !== void 0 ? _$1 : _globalThis[_PRESS_STATE_KEY] = {
|
|
13757
13762
|
owner: null,
|
|
13758
13763
|
ownerId: null,
|
|
13759
13764
|
ownerSource: null,
|
|
@@ -13802,7 +13807,8 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13802
13807
|
pressInTimer: null,
|
|
13803
13808
|
pressOutTimer: null,
|
|
13804
13809
|
longPressTimer: null,
|
|
13805
|
-
activateTime: 0
|
|
13810
|
+
activateTime: 0,
|
|
13811
|
+
blockedByExternalOwnership: false
|
|
13806
13812
|
};
|
|
13807
13813
|
if (!enabled || !events) return;
|
|
13808
13814
|
var _events_delayPressIn;
|
|
@@ -13846,11 +13852,18 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13846
13852
|
var userTerminationRequest = viewProps.onResponderTerminationRequest;
|
|
13847
13853
|
var userMove = viewProps.onResponderMove;
|
|
13848
13854
|
viewProps.onStartShouldSetResponder = function(e) {
|
|
13849
|
-
|
|
13855
|
+
if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;
|
|
13856
|
+
return !events.disabled && !hasExternalPressOwnership();
|
|
13850
13857
|
};
|
|
13851
13858
|
viewProps.onResponderGrant = function(e) {
|
|
13852
|
-
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
13853
13859
|
cleanup();
|
|
13860
|
+
if (hasExternalPressOwnership()) {
|
|
13861
|
+
ref.current.state = "idle";
|
|
13862
|
+
ref.current.blockedByExternalOwnership = true;
|
|
13863
|
+
return;
|
|
13864
|
+
}
|
|
13865
|
+
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
13866
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13854
13867
|
ref.current.state = "pressing";
|
|
13855
13868
|
if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
|
|
13856
13869
|
return activate(e);
|
|
@@ -13865,6 +13878,12 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13865
13878
|
}, delayLongPress + delayPressIn);
|
|
13866
13879
|
};
|
|
13867
13880
|
viewProps.onResponderRelease = function(e) {
|
|
13881
|
+
if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
|
|
13882
|
+
cleanup();
|
|
13883
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13884
|
+
ref.current.state = "idle";
|
|
13885
|
+
return;
|
|
13886
|
+
}
|
|
13868
13887
|
userRelease === null || userRelease === void 0 || userRelease(e);
|
|
13869
13888
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
13870
13889
|
cleanup();
|
|
@@ -13875,12 +13894,14 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13875
13894
|
}
|
|
13876
13895
|
deactivate(e);
|
|
13877
13896
|
ref.current.state = "idle";
|
|
13897
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13878
13898
|
};
|
|
13879
13899
|
viewProps.onResponderTerminate = function(e) {
|
|
13880
13900
|
userTerminate === null || userTerminate === void 0 || userTerminate(e);
|
|
13881
13901
|
cleanup();
|
|
13882
13902
|
if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
|
|
13883
13903
|
ref.current.state = "idle";
|
|
13904
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13884
13905
|
};
|
|
13885
13906
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
13886
13907
|
if (userTerminationRequest) return userTerminationRequest(e);
|
|
@@ -13894,6 +13915,7 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13894
13915
|
}
|
|
13895
13916
|
var DEFAULT_LONG_PRESS_DELAY, DEFAULT_MIN_PRESS_DURATION;
|
|
13896
13917
|
var init_mainThreadPressEvents_native = __esmMin((() => {
|
|
13918
|
+
init_index_native$3();
|
|
13897
13919
|
DEFAULT_LONG_PRESS_DELAY = 500;
|
|
13898
13920
|
DEFAULT_MIN_PRESS_DURATION = 130;
|
|
13899
13921
|
}));
|
|
@@ -13943,7 +13965,7 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13943
13965
|
if (isUsingRNGH) {
|
|
13944
13966
|
var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
|
|
13945
13967
|
var gestureRef = (0, react.useRef)(null);
|
|
13946
|
-
useMainThreadPressEvents(events, viewProps,
|
|
13968
|
+
useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
|
|
13947
13969
|
if (everEnabled) {
|
|
13948
13970
|
callbacksRef.current = hasPressEvents ? {
|
|
13949
13971
|
onPressIn: events.onPressIn,
|
|
@@ -13951,6 +13973,10 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13951
13973
|
onPress: events.onPress,
|
|
13952
13974
|
onLongPress: events.onLongPress
|
|
13953
13975
|
} : {};
|
|
13976
|
+
if (hasRealPressEvents && !isInsideNativeMenu) {
|
|
13977
|
+
gestureRef.current = null;
|
|
13978
|
+
return null;
|
|
13979
|
+
}
|
|
13954
13980
|
if (!gestureRef.current) {
|
|
13955
13981
|
var { Gesture } = gh.state;
|
|
13956
13982
|
if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
|
|
@@ -13964,27 +13990,6 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13964
13990
|
var _callbacksRef_current_onPressOut, _callbacksRef_current;
|
|
13965
13991
|
(_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});
|
|
13966
13992
|
});
|
|
13967
|
-
else if (hasRealPressEvents || stateRef.current.hasRealPressEvents) gestureRef.current = gh.createPressGesture({
|
|
13968
|
-
debugName,
|
|
13969
|
-
onPressIn: function(e) {
|
|
13970
|
-
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
13971
|
-
return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
|
|
13972
|
-
},
|
|
13973
|
-
onPressOut: function(e) {
|
|
13974
|
-
var _callbacksRef_current_onPressOut, _callbacksRef_current;
|
|
13975
|
-
return (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current, e);
|
|
13976
|
-
},
|
|
13977
|
-
onPress: function(e) {
|
|
13978
|
-
var _callbacksRef_current_onPress, _callbacksRef_current;
|
|
13979
|
-
return (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e);
|
|
13980
|
-
},
|
|
13981
|
-
onLongPress: function(e) {
|
|
13982
|
-
var _callbacksRef_current_onLongPress, _callbacksRef_current;
|
|
13983
|
-
return (_callbacksRef_current_onLongPress = (_callbacksRef_current = callbacksRef.current).onLongPress) === null || _callbacksRef_current_onLongPress === void 0 ? void 0 : _callbacksRef_current_onLongPress.call(_callbacksRef_current, e);
|
|
13984
|
-
},
|
|
13985
|
-
delayLongPress: events === null || events === void 0 ? void 0 : events.delayLongPress,
|
|
13986
|
-
hitSlop: viewProps.hitSlop
|
|
13987
|
-
});
|
|
13988
13993
|
else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
|
|
13989
13994
|
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
13990
13995
|
return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
|
|
@@ -14004,23 +14009,20 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
14004
14009
|
useMainThreadPressEvents(events, viewProps, hasPressEvents, debugName);
|
|
14005
14010
|
return null;
|
|
14006
14011
|
}
|
|
14007
|
-
function wrapWithGestureDetector(content, gesture,
|
|
14012
|
+
function wrapWithGestureDetector(content, gesture, _stateRef, isHOC, isCompositeComponent, hasRealPressEvents) {
|
|
14008
14013
|
if (isHOC || isCompositeComponent) return content;
|
|
14009
|
-
var { GestureDetector
|
|
14010
|
-
|
|
14011
|
-
if (!GestureDetector
|
|
14012
|
-
var gestureToUse = gesture || (Gesture === null || Gesture === void 0 ? void 0 : Gesture.Manual());
|
|
14013
|
-
if (!gestureToUse) return content;
|
|
14014
|
-
if (!stateRef.current.hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture: gestureToUse }, content);
|
|
14014
|
+
var { GestureDetector } = getGestureHandler().state;
|
|
14015
|
+
if (!GestureDetector || !gesture) return content;
|
|
14016
|
+
if (!hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture }, content);
|
|
14015
14017
|
if (isFabric) {
|
|
14016
14018
|
var claimed = react.default.cloneElement(content, { onStartShouldSetResponder: responderClaim });
|
|
14017
|
-
return react.default.createElement(GestureDetector, { gesture
|
|
14019
|
+
return react.default.createElement(GestureDetector, { gesture }, claimed);
|
|
14018
14020
|
}
|
|
14019
14021
|
return react.default.createElement(View$2, {
|
|
14020
14022
|
collapsable: false,
|
|
14021
14023
|
style: responderWrapperStyle,
|
|
14022
14024
|
onStartShouldSetResponder: responderClaim
|
|
14023
|
-
}, react.default.createElement(GestureDetector, { gesture
|
|
14025
|
+
}, react.default.createElement(GestureDetector, { gesture }, content));
|
|
14024
14026
|
}
|
|
14025
14027
|
var isFabric, isAndroidCache, getIsAndroid, isNativeDesktopCache, getIsNativeDesktop, responderClaim, responderWrapperStyle;
|
|
14026
14028
|
var init_eventHandling_native = __esmMin((() => {
|
|
@@ -15079,6 +15081,29 @@ var init_propMapper_native = __esmMin((() => {
|
|
|
15079
15081
|
}
|
|
15080
15082
|
var { conf, styleProps, staticConfig } = styleState;
|
|
15081
15083
|
var { variants } = staticConfig;
|
|
15084
|
+
if (value === "unset") {
|
|
15085
|
+
var expandedKey = !styleProps.disableExpandShorthands && conf.shorthands[key] || key;
|
|
15086
|
+
var expanded = styleProps.noExpand ? null : expandStyle(expandedKey, value, conf.settings.styleCompat || "web");
|
|
15087
|
+
if (styleState.style) if (expanded) {
|
|
15088
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
15089
|
+
try {
|
|
15090
|
+
for (var _iterator = expanded[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
15091
|
+
var [nkey] = _step.value;
|
|
15092
|
+
delete styleState.style[nkey];
|
|
15093
|
+
}
|
|
15094
|
+
} catch (err) {
|
|
15095
|
+
_didIteratorError = true;
|
|
15096
|
+
_iteratorError = err;
|
|
15097
|
+
} finally {
|
|
15098
|
+
try {
|
|
15099
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
15100
|
+
} finally {
|
|
15101
|
+
if (_didIteratorError) throw _iteratorError;
|
|
15102
|
+
}
|
|
15103
|
+
}
|
|
15104
|
+
} else delete styleState.style[expandedKey];
|
|
15105
|
+
return;
|
|
15106
|
+
}
|
|
15082
15107
|
if (!styleProps.noExpand) {
|
|
15083
15108
|
if (variants && key in variants) {
|
|
15084
15109
|
var variantValue = resolveVariants(key, value, styleProps, styleState, "");
|
|
@@ -15108,20 +15133,20 @@ var init_propMapper_native = __esmMin((() => {
|
|
|
15108
15133
|
var parsed = parseNativeStyle(key, value);
|
|
15109
15134
|
if (parsed) {
|
|
15110
15135
|
if (key === "textShadow" && Array.isArray(parsed) && Array.isArray(parsed[0])) {
|
|
15111
|
-
var
|
|
15136
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
15112
15137
|
try {
|
|
15113
|
-
for (var
|
|
15114
|
-
var [
|
|
15115
|
-
map(
|
|
15138
|
+
for (var _iterator1 = parsed[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
15139
|
+
var [nkey1, nvalue] = _step1.value;
|
|
15140
|
+
map(nkey1, nvalue, originalValue);
|
|
15116
15141
|
}
|
|
15117
15142
|
} catch (err) {
|
|
15118
|
-
|
|
15119
|
-
|
|
15143
|
+
_didIteratorError1 = true;
|
|
15144
|
+
_iteratorError1 = err;
|
|
15120
15145
|
} finally {
|
|
15121
15146
|
try {
|
|
15122
|
-
if (!
|
|
15147
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
|
|
15123
15148
|
} finally {
|
|
15124
|
-
if (
|
|
15149
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
15125
15150
|
}
|
|
15126
15151
|
}
|
|
15127
15152
|
return;
|
|
@@ -15132,12 +15157,12 @@ var init_propMapper_native = __esmMin((() => {
|
|
|
15132
15157
|
if (value != null) {
|
|
15133
15158
|
var fontToken = getLastFontFamilyToken();
|
|
15134
15159
|
if (key === "fontFamily" && fontToken) styleState.fontFamily = fontToken;
|
|
15135
|
-
var
|
|
15136
|
-
if (
|
|
15137
|
-
var max =
|
|
15160
|
+
var expanded1 = styleProps.noExpand ? null : expandStyle(key, value, conf.settings.styleCompat || "web");
|
|
15161
|
+
if (expanded1) {
|
|
15162
|
+
var max = expanded1.length;
|
|
15138
15163
|
for (var i = 0; i < max; i++) {
|
|
15139
|
-
var [
|
|
15140
|
-
map(
|
|
15164
|
+
var [nkey2, nvalue1, noriginalValue] = expanded1[i];
|
|
15165
|
+
map(nkey2, nvalue1, noriginalValue !== null && noriginalValue !== void 0 ? noriginalValue : originalValue);
|
|
15141
15166
|
}
|
|
15142
15167
|
} else map(key, value, originalValue);
|
|
15143
15168
|
}
|
|
@@ -17036,7 +17061,8 @@ function createComponent(staticConfig) {
|
|
|
17036
17061
|
var propsInWithHref = propsIn;
|
|
17037
17062
|
var _props_testID, _ref, _ref1, _ref2, _ref3;
|
|
17038
17063
|
var pressDebugName = [componentName, (_ref3 = (_ref2 = (_ref1 = (_ref = (_props_testID = props.testID) !== null && _props_testID !== void 0 ? _props_testID : propsIn.testID) !== null && _ref !== void 0 ? _ref : props.accessibilityLabel) !== null && _ref1 !== void 0 ? _ref1 : propsIn.accessibilityLabel) !== null && _ref2 !== void 0 ? _ref2 : typeof propsWithHref.href === "string" ? propsWithHref.href : null) !== null && _ref3 !== void 0 ? _ref3 : typeof propsInWithHref.href === "string" ? propsInWithHref.href : null].filter(Boolean).join(":") || null;
|
|
17039
|
-
var
|
|
17064
|
+
var hasRealPressEvents = !!(onPress || onPressIn || onPressOut || onLongPress);
|
|
17065
|
+
var pressGesture = useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName, hasRealPressEvents);
|
|
17040
17066
|
if (asChild) {
|
|
17041
17067
|
elementType = Slot;
|
|
17042
17068
|
Object.assign(viewProps, {
|
|
@@ -17061,7 +17087,7 @@ function createComponent(staticConfig) {
|
|
|
17061
17087
|
content = /* @__PURE__ */ react.default.createElement(elementType, viewProps, content || children);
|
|
17062
17088
|
}
|
|
17063
17089
|
}
|
|
17064
|
-
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string");
|
|
17090
|
+
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string", hasRealPressEvents);
|
|
17065
17091
|
var ResetPresence = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.ResetPresence;
|
|
17066
17092
|
var needsReset = Boolean(!asChild && splitStyles && !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
|
|
17067
17093
|
var hasEverReset = stateRef.current.hasEverResetPresence;
|
package/dist/test.native.cjs
CHANGED
|
@@ -1999,6 +1999,8 @@ function createGlobalState(key, defaultValue) {
|
|
|
1999
1999
|
}
|
|
2000
2000
|
//#endregion
|
|
2001
2001
|
//#region ../native/dist/esm/gestureState.native.js
|
|
2002
|
+
var _globalThis;
|
|
2003
|
+
var _PRESS_STATE_KEY;
|
|
2002
2004
|
var state = createGlobalState(`gesture`, {
|
|
2003
2005
|
enabled: false,
|
|
2004
2006
|
Gesture: null,
|
|
@@ -2031,13 +2033,15 @@ function canChangeGestureHandlerEnabled(nextEnabled, source) {
|
|
|
2031
2033
|
var pressGestureDebugId = 0;
|
|
2032
2034
|
var PRESS_MOVE_CANCEL_DISTANCE = 12;
|
|
2033
2035
|
var PRESS_MOVE_CANCEL_DISTANCE_SQ = PRESS_MOVE_CANCEL_DISTANCE * PRESS_MOVE_CANCEL_DISTANCE;
|
|
2036
|
+
var PRESS_STATE_KEY = "__tamagui_press_state__";
|
|
2034
2037
|
function getEventPointerId(e) {
|
|
2035
2038
|
var _e_pointer, _e_event, _e_event_pointer, _e_event1, _e_nativeEvent, _e_nativeEvent1, _e_event_nativeEvent, _e_event2, _e_event_nativeEvent1, _e_event3;
|
|
2036
2039
|
var _e_pointerId, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
|
|
2037
2040
|
var pointerId = (_ref6 = (_ref5 = (_ref4 = (_ref3 = (_ref2 = (_ref1 = (_ref = (_e_pointerId = e === null || e === void 0 ? void 0 : e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : e === null || e === void 0 ? void 0 : (_e_pointer = e.pointer) === null || _e_pointer === void 0 ? void 0 : _e_pointer.id) !== null && _ref !== void 0 ? _ref : e === null || e === void 0 ? void 0 : (_e_event = e.event) === null || _e_event === void 0 ? void 0 : _e_event.pointerId) !== null && _ref1 !== void 0 ? _ref1 : e === null || e === void 0 ? void 0 : (_e_event1 = e.event) === null || _e_event1 === void 0 ? void 0 : (_e_event_pointer = _e_event1.pointer) === null || _e_event_pointer === void 0 ? void 0 : _e_event_pointer.id) !== null && _ref2 !== void 0 ? _ref2 : e === null || e === void 0 ? void 0 : (_e_nativeEvent = e.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.pointerId) !== null && _ref3 !== void 0 ? _ref3 : e === null || e === void 0 ? void 0 : (_e_nativeEvent1 = e.nativeEvent) === null || _e_nativeEvent1 === void 0 ? void 0 : _e_nativeEvent1.id) !== null && _ref4 !== void 0 ? _ref4 : e === null || e === void 0 ? void 0 : (_e_event2 = e.event) === null || _e_event2 === void 0 ? void 0 : (_e_event_nativeEvent = _e_event2.nativeEvent) === null || _e_event_nativeEvent === void 0 ? void 0 : _e_event_nativeEvent.pointerId) !== null && _ref5 !== void 0 ? _ref5 : e === null || e === void 0 ? void 0 : (_e_event3 = e.event) === null || _e_event3 === void 0 ? void 0 : (_e_event_nativeEvent1 = _e_event3.nativeEvent) === null || _e_event_nativeEvent1 === void 0 ? void 0 : _e_event_nativeEvent1.id) !== null && _ref6 !== void 0 ? _ref6 : null;
|
|
2038
2041
|
return pointerId == null || Number.isNaN(pointerId) ? null : Number(pointerId);
|
|
2039
2042
|
}
|
|
2040
|
-
var
|
|
2043
|
+
var _$1;
|
|
2044
|
+
var pressState = (_$1 = (_globalThis = globalThis)[_PRESS_STATE_KEY = PRESS_STATE_KEY]) !== null && _$1 !== void 0 ? _$1 : _globalThis[_PRESS_STATE_KEY] = {
|
|
2041
2045
|
owner: null,
|
|
2042
2046
|
ownerId: null,
|
|
2043
2047
|
ownerSource: null,
|
|
@@ -2054,6 +2058,10 @@ function resetPressOwner() {
|
|
|
2054
2058
|
function resetStaleOwner(now, debugName) {
|
|
2055
2059
|
if (now - pressState.timestamp > 2e3) resetPressOwner();
|
|
2056
2060
|
}
|
|
2061
|
+
function hasExternalPressOwnership() {
|
|
2062
|
+
resetStaleOwner(Date.now());
|
|
2063
|
+
return pressState.ownerSource === "external";
|
|
2064
|
+
}
|
|
2057
2065
|
function getGestureHandler() {
|
|
2058
2066
|
return {
|
|
2059
2067
|
get isEnabled() {
|
|
@@ -2214,7 +2222,8 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
2214
2222
|
pressInTimer: null,
|
|
2215
2223
|
pressOutTimer: null,
|
|
2216
2224
|
longPressTimer: null,
|
|
2217
|
-
activateTime: 0
|
|
2225
|
+
activateTime: 0,
|
|
2226
|
+
blockedByExternalOwnership: false
|
|
2218
2227
|
};
|
|
2219
2228
|
if (!enabled || !events) return;
|
|
2220
2229
|
var _events_delayPressIn;
|
|
@@ -2258,11 +2267,18 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
2258
2267
|
var userTerminationRequest = viewProps.onResponderTerminationRequest;
|
|
2259
2268
|
var userMove = viewProps.onResponderMove;
|
|
2260
2269
|
viewProps.onStartShouldSetResponder = function(e) {
|
|
2261
|
-
|
|
2270
|
+
if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;
|
|
2271
|
+
return !events.disabled && !hasExternalPressOwnership();
|
|
2262
2272
|
};
|
|
2263
2273
|
viewProps.onResponderGrant = function(e) {
|
|
2264
|
-
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
2265
2274
|
cleanup();
|
|
2275
|
+
if (hasExternalPressOwnership()) {
|
|
2276
|
+
ref.current.state = "idle";
|
|
2277
|
+
ref.current.blockedByExternalOwnership = true;
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
2281
|
+
ref.current.blockedByExternalOwnership = false;
|
|
2266
2282
|
ref.current.state = "pressing";
|
|
2267
2283
|
if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
|
|
2268
2284
|
return activate(e);
|
|
@@ -2277,6 +2293,12 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
2277
2293
|
}, delayLongPress + delayPressIn);
|
|
2278
2294
|
};
|
|
2279
2295
|
viewProps.onResponderRelease = function(e) {
|
|
2296
|
+
if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
|
|
2297
|
+
cleanup();
|
|
2298
|
+
ref.current.blockedByExternalOwnership = false;
|
|
2299
|
+
ref.current.state = "idle";
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2280
2302
|
userRelease === null || userRelease === void 0 || userRelease(e);
|
|
2281
2303
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
2282
2304
|
cleanup();
|
|
@@ -2287,12 +2309,14 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
2287
2309
|
}
|
|
2288
2310
|
deactivate(e);
|
|
2289
2311
|
ref.current.state = "idle";
|
|
2312
|
+
ref.current.blockedByExternalOwnership = false;
|
|
2290
2313
|
};
|
|
2291
2314
|
viewProps.onResponderTerminate = function(e) {
|
|
2292
2315
|
userTerminate === null || userTerminate === void 0 || userTerminate(e);
|
|
2293
2316
|
cleanup();
|
|
2294
2317
|
if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
|
|
2295
2318
|
ref.current.state = "idle";
|
|
2319
|
+
ref.current.blockedByExternalOwnership = false;
|
|
2296
2320
|
};
|
|
2297
2321
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
2298
2322
|
if (userTerminationRequest) return userTerminationRequest(e);
|
|
@@ -2365,7 +2389,7 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
2365
2389
|
if (isUsingRNGH) {
|
|
2366
2390
|
var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
|
|
2367
2391
|
var gestureRef = (0, react.useRef)(null);
|
|
2368
|
-
useMainThreadPressEvents(events, viewProps,
|
|
2392
|
+
useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
|
|
2369
2393
|
if (everEnabled) {
|
|
2370
2394
|
callbacksRef.current = hasPressEvents ? {
|
|
2371
2395
|
onPressIn: events.onPressIn,
|
|
@@ -2373,6 +2397,10 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
2373
2397
|
onPress: events.onPress,
|
|
2374
2398
|
onLongPress: events.onLongPress
|
|
2375
2399
|
} : {};
|
|
2400
|
+
if (hasRealPressEvents && !isInsideNativeMenu) {
|
|
2401
|
+
gestureRef.current = null;
|
|
2402
|
+
return null;
|
|
2403
|
+
}
|
|
2376
2404
|
if (!gestureRef.current) {
|
|
2377
2405
|
var { Gesture } = gh.state;
|
|
2378
2406
|
if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
|
|
@@ -2386,27 +2414,6 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
2386
2414
|
var _callbacksRef_current_onPressOut, _callbacksRef_current;
|
|
2387
2415
|
(_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});
|
|
2388
2416
|
});
|
|
2389
|
-
else if (hasRealPressEvents || stateRef.current.hasRealPressEvents) gestureRef.current = gh.createPressGesture({
|
|
2390
|
-
debugName,
|
|
2391
|
-
onPressIn: function(e) {
|
|
2392
|
-
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
2393
|
-
return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
|
|
2394
|
-
},
|
|
2395
|
-
onPressOut: function(e) {
|
|
2396
|
-
var _callbacksRef_current_onPressOut, _callbacksRef_current;
|
|
2397
|
-
return (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current, e);
|
|
2398
|
-
},
|
|
2399
|
-
onPress: function(e) {
|
|
2400
|
-
var _callbacksRef_current_onPress, _callbacksRef_current;
|
|
2401
|
-
return (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e);
|
|
2402
|
-
},
|
|
2403
|
-
onLongPress: function(e) {
|
|
2404
|
-
var _callbacksRef_current_onLongPress, _callbacksRef_current;
|
|
2405
|
-
return (_callbacksRef_current_onLongPress = (_callbacksRef_current = callbacksRef.current).onLongPress) === null || _callbacksRef_current_onLongPress === void 0 ? void 0 : _callbacksRef_current_onLongPress.call(_callbacksRef_current, e);
|
|
2406
|
-
},
|
|
2407
|
-
delayLongPress: events === null || events === void 0 ? void 0 : events.delayLongPress,
|
|
2408
|
-
hitSlop: viewProps.hitSlop
|
|
2409
|
-
});
|
|
2410
2417
|
else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
|
|
2411
2418
|
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
2412
2419
|
return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
|
|
@@ -2426,23 +2433,20 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
2426
2433
|
useMainThreadPressEvents(events, viewProps, hasPressEvents, debugName);
|
|
2427
2434
|
return null;
|
|
2428
2435
|
}
|
|
2429
|
-
function wrapWithGestureDetector(content, gesture,
|
|
2436
|
+
function wrapWithGestureDetector(content, gesture, _stateRef, isHOC, isCompositeComponent, hasRealPressEvents) {
|
|
2430
2437
|
if (isHOC || isCompositeComponent) return content;
|
|
2431
|
-
var { GestureDetector
|
|
2432
|
-
|
|
2433
|
-
if (!GestureDetector
|
|
2434
|
-
var gestureToUse = gesture || (Gesture === null || Gesture === void 0 ? void 0 : Gesture.Manual());
|
|
2435
|
-
if (!gestureToUse) return content;
|
|
2436
|
-
if (!stateRef.current.hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture: gestureToUse }, content);
|
|
2438
|
+
var { GestureDetector } = getGestureHandler().state;
|
|
2439
|
+
if (!GestureDetector || !gesture) return content;
|
|
2440
|
+
if (!hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture }, content);
|
|
2437
2441
|
if (isFabric) {
|
|
2438
2442
|
var claimed = react.default.cloneElement(content, { onStartShouldSetResponder: responderClaim });
|
|
2439
|
-
return react.default.createElement(GestureDetector, { gesture
|
|
2443
|
+
return react.default.createElement(GestureDetector, { gesture }, claimed);
|
|
2440
2444
|
}
|
|
2441
2445
|
return react.default.createElement(react_native.View, {
|
|
2442
2446
|
collapsable: false,
|
|
2443
2447
|
style: responderWrapperStyle,
|
|
2444
2448
|
onStartShouldSetResponder: responderClaim
|
|
2445
|
-
}, react.default.createElement(GestureDetector, { gesture
|
|
2449
|
+
}, react.default.createElement(GestureDetector, { gesture }, content));
|
|
2446
2450
|
}
|
|
2447
2451
|
//#endregion
|
|
2448
2452
|
//#region ../web/dist/esm/helpers/getDefaultProps.native.js
|
|
@@ -3584,6 +3588,29 @@ var propMapper = function(key, value, styleState, disabled, map) {
|
|
|
3584
3588
|
}
|
|
3585
3589
|
var { conf, styleProps, staticConfig } = styleState;
|
|
3586
3590
|
var { variants } = staticConfig;
|
|
3591
|
+
if (value === "unset") {
|
|
3592
|
+
var expandedKey = !styleProps.disableExpandShorthands && conf.shorthands[key] || key;
|
|
3593
|
+
var expanded = styleProps.noExpand ? null : expandStyle(expandedKey, value, conf.settings.styleCompat || "web");
|
|
3594
|
+
if (styleState.style) if (expanded) {
|
|
3595
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
3596
|
+
try {
|
|
3597
|
+
for (var _iterator = expanded[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
3598
|
+
var [nkey] = _step.value;
|
|
3599
|
+
delete styleState.style[nkey];
|
|
3600
|
+
}
|
|
3601
|
+
} catch (err) {
|
|
3602
|
+
_didIteratorError = true;
|
|
3603
|
+
_iteratorError = err;
|
|
3604
|
+
} finally {
|
|
3605
|
+
try {
|
|
3606
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
3607
|
+
} finally {
|
|
3608
|
+
if (_didIteratorError) throw _iteratorError;
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
} else delete styleState.style[expandedKey];
|
|
3612
|
+
return;
|
|
3613
|
+
}
|
|
3587
3614
|
if (!styleProps.noExpand) {
|
|
3588
3615
|
if (variants && key in variants) {
|
|
3589
3616
|
var variantValue = resolveVariants(key, value, styleProps, styleState, "");
|
|
@@ -3613,20 +3640,20 @@ var propMapper = function(key, value, styleState, disabled, map) {
|
|
|
3613
3640
|
var parsed = parseNativeStyle(key, value);
|
|
3614
3641
|
if (parsed) {
|
|
3615
3642
|
if (key === "textShadow" && Array.isArray(parsed) && Array.isArray(parsed[0])) {
|
|
3616
|
-
var
|
|
3643
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
|
|
3617
3644
|
try {
|
|
3618
|
-
for (var
|
|
3619
|
-
var [
|
|
3620
|
-
map(
|
|
3645
|
+
for (var _iterator1 = parsed[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
3646
|
+
var [nkey1, nvalue] = _step1.value;
|
|
3647
|
+
map(nkey1, nvalue, originalValue);
|
|
3621
3648
|
}
|
|
3622
3649
|
} catch (err) {
|
|
3623
|
-
|
|
3624
|
-
|
|
3650
|
+
_didIteratorError1 = true;
|
|
3651
|
+
_iteratorError1 = err;
|
|
3625
3652
|
} finally {
|
|
3626
3653
|
try {
|
|
3627
|
-
if (!
|
|
3654
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
|
|
3628
3655
|
} finally {
|
|
3629
|
-
if (
|
|
3656
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
3630
3657
|
}
|
|
3631
3658
|
}
|
|
3632
3659
|
return;
|
|
@@ -3637,12 +3664,12 @@ var propMapper = function(key, value, styleState, disabled, map) {
|
|
|
3637
3664
|
if (value != null) {
|
|
3638
3665
|
var fontToken = getLastFontFamilyToken();
|
|
3639
3666
|
if (key === "fontFamily" && fontToken) styleState.fontFamily = fontToken;
|
|
3640
|
-
var
|
|
3641
|
-
if (
|
|
3642
|
-
var max =
|
|
3667
|
+
var expanded1 = styleProps.noExpand ? null : expandStyle(key, value, conf.settings.styleCompat || "web");
|
|
3668
|
+
if (expanded1) {
|
|
3669
|
+
var max = expanded1.length;
|
|
3643
3670
|
for (var i = 0; i < max; i++) {
|
|
3644
|
-
var [
|
|
3645
|
-
map(
|
|
3671
|
+
var [nkey2, nvalue1, noriginalValue] = expanded1[i];
|
|
3672
|
+
map(nkey2, nvalue1, noriginalValue !== null && noriginalValue !== void 0 ? noriginalValue : originalValue);
|
|
3646
3673
|
}
|
|
3647
3674
|
} else map(key, value, originalValue);
|
|
3648
3675
|
}
|
|
@@ -5109,10 +5136,11 @@ function createComponent(staticConfig) {
|
|
|
5109
5136
|
BaseView = baseViews.View;
|
|
5110
5137
|
}
|
|
5111
5138
|
}
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5139
|
+
var testRenderCount = propsIn["data-test-renders"];
|
|
5140
|
+
if (testRenderCount && (typeof testRenderCount === "undefined" ? "undefined" : _type_of$1(testRenderCount)) === "object" && !Object.isFrozen(testRenderCount)) {
|
|
5141
|
+
var _testRenderCount_current;
|
|
5142
|
+
testRenderCount.current = (_testRenderCount_current = testRenderCount.current) !== null && _testRenderCount_current !== void 0 ? _testRenderCount_current : 0;
|
|
5143
|
+
testRenderCount.current += 1;
|
|
5116
5144
|
}
|
|
5117
5145
|
var { context, isReactNative } = staticConfig;
|
|
5118
5146
|
var debugProp = propsIn["debug"];
|
|
@@ -5554,7 +5582,8 @@ function createComponent(staticConfig) {
|
|
|
5554
5582
|
var propsInWithHref = propsIn;
|
|
5555
5583
|
var _props_testID, _ref, _ref1, _ref2, _ref3;
|
|
5556
5584
|
var pressDebugName = [componentName, (_ref3 = (_ref2 = (_ref1 = (_ref = (_props_testID = props.testID) !== null && _props_testID !== void 0 ? _props_testID : propsIn.testID) !== null && _ref !== void 0 ? _ref : props.accessibilityLabel) !== null && _ref1 !== void 0 ? _ref1 : propsIn.accessibilityLabel) !== null && _ref2 !== void 0 ? _ref2 : typeof propsWithHref.href === "string" ? propsWithHref.href : null) !== null && _ref3 !== void 0 ? _ref3 : typeof propsInWithHref.href === "string" ? propsInWithHref.href : null].filter(Boolean).join(":") || null;
|
|
5557
|
-
var
|
|
5585
|
+
var hasRealPressEvents = !!(onPress || onPressIn || onPressOut || onLongPress);
|
|
5586
|
+
var pressGesture = useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName, hasRealPressEvents);
|
|
5558
5587
|
if (asChild) {
|
|
5559
5588
|
elementType = Slot;
|
|
5560
5589
|
Object.assign(viewProps, {
|
|
@@ -5579,7 +5608,7 @@ function createComponent(staticConfig) {
|
|
|
5579
5608
|
content = /* @__PURE__ */ react.default.createElement(elementType, viewProps, content || children);
|
|
5580
5609
|
}
|
|
5581
5610
|
}
|
|
5582
|
-
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string");
|
|
5611
|
+
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string", hasRealPressEvents);
|
|
5583
5612
|
var ResetPresence = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.ResetPresence;
|
|
5584
5613
|
var needsReset = Boolean(!asChild && splitStyles && !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
|
|
5585
5614
|
var hasEverReset = stateRef.current.hasEverResetPresence;
|
|
@@ -7152,8 +7181,7 @@ if (ENABLE) {
|
|
|
7152
7181
|
}
|
|
7153
7182
|
function _updateLayoutIfChanged() {
|
|
7154
7183
|
_updateLayoutIfChanged = _asyncToGenerator(function* (node) {
|
|
7155
|
-
|
|
7156
|
-
if (typeof onLayout !== "function") return;
|
|
7184
|
+
if (typeof LayoutHandlers.get(node) !== "function") return;
|
|
7157
7185
|
var parentNode = node.parentElement;
|
|
7158
7186
|
if (!parentNode) return;
|
|
7159
7187
|
var nodeRect;
|
|
@@ -7166,19 +7194,7 @@ if (ENABLE) {
|
|
|
7166
7194
|
nodeRect = node.getBoundingClientRect();
|
|
7167
7195
|
parentRect = parentNode.getBoundingClientRect();
|
|
7168
7196
|
}
|
|
7169
|
-
|
|
7170
|
-
var cachedParentRect = NodeRectCache.get(parentNode);
|
|
7171
|
-
var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
|
|
7172
|
-
var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
|
|
7173
|
-
if (nodeChanged || parentChanged) {
|
|
7174
|
-
NodeRectCache.set(node, nodeRect);
|
|
7175
|
-
NodeRectCache.set(parentNode, parentRect);
|
|
7176
|
-
var event = getElementLayoutEvent(nodeRect, parentRect, node);
|
|
7177
|
-
if (avoidUpdates) queuedUpdates.set(node, function() {
|
|
7178
|
-
return onLayout(event);
|
|
7179
|
-
});
|
|
7180
|
-
else onLayout(event);
|
|
7181
|
-
}
|
|
7197
|
+
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
7182
7198
|
});
|
|
7183
7199
|
return _updateLayoutIfChanged.apply(this, arguments);
|
|
7184
7200
|
}
|
|
@@ -7309,15 +7325,35 @@ var getRelativeDimensions = function(a, b, aNode) {
|
|
|
7309
7325
|
pageY: a.top
|
|
7310
7326
|
};
|
|
7311
7327
|
};
|
|
7312
|
-
function
|
|
7328
|
+
function emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {
|
|
7329
|
+
var onLayout = LayoutHandlers.get(node);
|
|
7330
|
+
if (typeof onLayout !== "function") return;
|
|
7331
|
+
var cachedRect = NodeRectCache.get(node);
|
|
7332
|
+
var cachedParentRect = NodeRectCache.get(parentNode);
|
|
7333
|
+
var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
|
|
7334
|
+
var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
|
|
7335
|
+
if (!nodeChanged && !parentChanged) return;
|
|
7336
|
+
NodeRectCache.set(node, nodeRect);
|
|
7337
|
+
NodeRectCache.set(parentNode, parentRect);
|
|
7338
|
+
var event = getElementLayoutEvent(nodeRect, parentRect, node);
|
|
7339
|
+
if (avoidUpdates) queuedUpdates.set(node, function() {
|
|
7340
|
+
return onLayout(event);
|
|
7341
|
+
});
|
|
7342
|
+
else onLayout(event);
|
|
7343
|
+
}
|
|
7344
|
+
function observeLayoutNode(node, disableKey) {
|
|
7313
7345
|
Nodes.add(node);
|
|
7314
|
-
LayoutHandlers.set(node, onChange);
|
|
7315
7346
|
if (disableKey) LayoutDisableKey.set(node, disableKey);
|
|
7347
|
+
else LayoutDisableKey.delete(node);
|
|
7316
7348
|
startGlobalObservers();
|
|
7317
7349
|
if (globalIntersectionObserver) {
|
|
7318
7350
|
globalIntersectionObserver.observe(node);
|
|
7319
7351
|
IntersectionState.set(node, true);
|
|
7320
7352
|
}
|
|
7353
|
+
}
|
|
7354
|
+
function registerLayoutNode(node, onChange, disableKey) {
|
|
7355
|
+
LayoutHandlers.set(node, onChange);
|
|
7356
|
+
observeLayoutNode(node, disableKey);
|
|
7321
7357
|
return function() {
|
|
7322
7358
|
return cleanupNode(node);
|
|
7323
7359
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -79,17 +79,17 @@
|
|
|
79
79
|
"clean:build": "tamagui-build clean:build"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@tamagui/helpers": "2.4.
|
|
83
|
-
"@tamagui/react-native-media-driver": "2.4.
|
|
84
|
-
"@tamagui/react-native-use-pressable": "2.4.
|
|
85
|
-
"@tamagui/use-element-layout": "2.4.
|
|
86
|
-
"@tamagui/use-event": "2.4.
|
|
87
|
-
"@tamagui/web": "2.4.
|
|
82
|
+
"@tamagui/helpers": "2.4.1",
|
|
83
|
+
"@tamagui/react-native-media-driver": "2.4.1",
|
|
84
|
+
"@tamagui/react-native-use-pressable": "2.4.1",
|
|
85
|
+
"@tamagui/use-element-layout": "2.4.1",
|
|
86
|
+
"@tamagui/use-event": "2.4.1",
|
|
87
|
+
"@tamagui/web": "2.4.1"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@tamagui/build": "2.4.
|
|
91
|
-
"@tamagui/native-bundle": "2.4.
|
|
92
|
-
"@tamagui/react-native-web-lite": "2.4.
|
|
90
|
+
"@tamagui/build": "2.4.1",
|
|
91
|
+
"@tamagui/native-bundle": "2.4.1",
|
|
92
|
+
"@tamagui/react-native-web-lite": "2.4.1",
|
|
93
93
|
"@testing-library/react": "^16.1.0",
|
|
94
94
|
"csstype": "^3.0.10",
|
|
95
95
|
"react": ">=19",
|