@tamagui/core 2.3.3-1782533722506 → 2.4.0-1783099846627
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 +97 -82
- package/dist/test.native.cjs +71 -58
- 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,29 @@ function cleanupNode(node) {
|
|
|
912
932
|
IntersectionState.delete(node);
|
|
913
933
|
if (globalIntersectionObserver) globalIntersectionObserver.unobserve(node);
|
|
914
934
|
}
|
|
935
|
+
function emitLayoutFromClientRects(node) {
|
|
936
|
+
var parentNode = node.parentElement;
|
|
937
|
+
if (!parentNode) return;
|
|
938
|
+
emitLayoutIfChanged(node, parentNode, node.getBoundingClientRect(), parentNode.getBoundingClientRect());
|
|
939
|
+
}
|
|
940
|
+
function emitLayoutFromObserver(_x2) {
|
|
941
|
+
return _emitLayoutFromObserver.apply(this, arguments);
|
|
942
|
+
}
|
|
943
|
+
function _emitLayoutFromObserver() {
|
|
944
|
+
_emitLayoutFromObserver = _asyncToGenerator(function* (node) {
|
|
945
|
+
if (!ENABLE || strategy !== "async") {
|
|
946
|
+
emitLayoutFromClientRects(node);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
var parentNode = node.parentElement;
|
|
950
|
+
if (!parentNode) return;
|
|
951
|
+
var [nodeRect, parentRect] = yield Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(parentNode)]);
|
|
952
|
+
if (!nodeRect || !parentRect) return;
|
|
953
|
+
if (!Nodes.has(node) || node.parentElement !== parentNode) return;
|
|
954
|
+
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
955
|
+
});
|
|
956
|
+
return _emitLayoutFromObserver.apply(this, arguments);
|
|
957
|
+
}
|
|
915
958
|
function useElementLayout$1(ref, onLayout) {
|
|
916
959
|
var _ref_current;
|
|
917
960
|
var disableKey = (0, react.useContext)(DisableLayoutContextKey);
|
|
@@ -929,35 +972,17 @@ function useElementLayout$1(ref, onLayout) {
|
|
|
929
972
|
if (prevNode) cleanupNode(prevNode);
|
|
930
973
|
PrevHostNode.set(ref, nextNode);
|
|
931
974
|
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));
|
|
975
|
+
LayoutHandlers.set(nextNode, onLayout);
|
|
976
|
+
observeLayoutNode(nextNode, disableKey);
|
|
977
|
+
emitLayoutFromObserver(nextNode);
|
|
947
978
|
});
|
|
948
979
|
useIsomorphicLayoutEffect(function() {
|
|
949
980
|
var _ref_current2;
|
|
950
981
|
if (!onLayout) return;
|
|
951
982
|
var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
|
|
952
983
|
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));
|
|
984
|
+
LayoutHandlers.set(node2, onLayout);
|
|
985
|
+
observeLayoutNode(node2, disableKey);
|
|
961
986
|
return function() {
|
|
962
987
|
cleanupNode(node2);
|
|
963
988
|
var swappedNode = PrevHostNode.get(ref);
|
|
@@ -1033,8 +1058,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1033
1058
|
}
|
|
1034
1059
|
function _updateLayoutIfChanged() {
|
|
1035
1060
|
_updateLayoutIfChanged = _asyncToGenerator(function* (node) {
|
|
1036
|
-
|
|
1037
|
-
if (typeof onLayout !== "function") return;
|
|
1061
|
+
if (typeof LayoutHandlers.get(node) !== "function") return;
|
|
1038
1062
|
var parentNode = node.parentElement;
|
|
1039
1063
|
if (!parentNode) return;
|
|
1040
1064
|
var nodeRect;
|
|
@@ -1047,19 +1071,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1047
1071
|
nodeRect = node.getBoundingClientRect();
|
|
1048
1072
|
parentRect = parentNode.getBoundingClientRect();
|
|
1049
1073
|
}
|
|
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
|
-
}
|
|
1074
|
+
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
1063
1075
|
});
|
|
1064
1076
|
return _updateLayoutIfChanged.apply(this, arguments);
|
|
1065
1077
|
}
|
|
@@ -1210,7 +1222,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1210
1222
|
}
|
|
1211
1223
|
return null;
|
|
1212
1224
|
});
|
|
1213
|
-
return function measureNode(
|
|
1225
|
+
return function measureNode(_x3, _x4) {
|
|
1214
1226
|
return _ref.apply(this, arguments);
|
|
1215
1227
|
};
|
|
1216
1228
|
}();
|
|
@@ -1220,7 +1232,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1220
1232
|
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
1221
1233
|
return out;
|
|
1222
1234
|
});
|
|
1223
|
-
return function measure(
|
|
1235
|
+
return function measure(_x5, _x6) {
|
|
1224
1236
|
return _ref2.apply(this, arguments);
|
|
1225
1237
|
};
|
|
1226
1238
|
}();
|
|
@@ -1230,7 +1242,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1230
1242
|
if (out) callback === null || callback === void 0 || callback(out.pageX, out.pageY, out.width, out.height);
|
|
1231
1243
|
return out;
|
|
1232
1244
|
});
|
|
1233
|
-
return function measureInWindow(
|
|
1245
|
+
return function measureInWindow(_x7, _x8) {
|
|
1234
1246
|
return _ref3.apply(this, arguments);
|
|
1235
1247
|
};
|
|
1236
1248
|
}();
|
|
@@ -1245,7 +1257,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1245
1257
|
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
1246
1258
|
return out;
|
|
1247
1259
|
});
|
|
1248
|
-
return function measureLayout(
|
|
1260
|
+
return function measureLayout(_x9, _x10, _x11) {
|
|
1249
1261
|
return _ref4.apply(this, arguments);
|
|
1250
1262
|
};
|
|
1251
1263
|
}();
|
|
@@ -13609,6 +13621,10 @@ function resetPressOwner() {
|
|
|
13609
13621
|
function resetStaleOwner(now, debugName) {
|
|
13610
13622
|
if (now - pressState.timestamp > 2e3) resetPressOwner();
|
|
13611
13623
|
}
|
|
13624
|
+
function hasExternalPressOwnership() {
|
|
13625
|
+
resetStaleOwner(Date.now());
|
|
13626
|
+
return pressState.ownerSource === "external";
|
|
13627
|
+
}
|
|
13612
13628
|
function getGestureHandler() {
|
|
13613
13629
|
return {
|
|
13614
13630
|
get isEnabled() {
|
|
@@ -13739,7 +13755,7 @@ function getGestureHandler() {
|
|
|
13739
13755
|
}
|
|
13740
13756
|
};
|
|
13741
13757
|
}
|
|
13742
|
-
var state, GESTURE_ENABLED_FREEZE_KEY$1, pressGestureDebugId, PRESS_MOVE_CANCEL_DISTANCE, PRESS_MOVE_CANCEL_DISTANCE_SQ, pressState;
|
|
13758
|
+
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
13759
|
var init_gestureState_native = __esmMin((() => {
|
|
13744
13760
|
init_globalState_native();
|
|
13745
13761
|
state = createGlobalState(`gesture`, {
|
|
@@ -13753,7 +13769,8 @@ var init_gestureState_native = __esmMin((() => {
|
|
|
13753
13769
|
pressGestureDebugId = 0;
|
|
13754
13770
|
PRESS_MOVE_CANCEL_DISTANCE = 12;
|
|
13755
13771
|
PRESS_MOVE_CANCEL_DISTANCE_SQ = PRESS_MOVE_CANCEL_DISTANCE * PRESS_MOVE_CANCEL_DISTANCE;
|
|
13756
|
-
|
|
13772
|
+
PRESS_STATE_KEY = "__tamagui_press_state__";
|
|
13773
|
+
pressState = (_$1 = (_globalThis = globalThis)[_PRESS_STATE_KEY = PRESS_STATE_KEY]) !== null && _$1 !== void 0 ? _$1 : _globalThis[_PRESS_STATE_KEY] = {
|
|
13757
13774
|
owner: null,
|
|
13758
13775
|
ownerId: null,
|
|
13759
13776
|
ownerSource: null,
|
|
@@ -13802,7 +13819,8 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13802
13819
|
pressInTimer: null,
|
|
13803
13820
|
pressOutTimer: null,
|
|
13804
13821
|
longPressTimer: null,
|
|
13805
|
-
activateTime: 0
|
|
13822
|
+
activateTime: 0,
|
|
13823
|
+
blockedByExternalOwnership: false
|
|
13806
13824
|
};
|
|
13807
13825
|
if (!enabled || !events) return;
|
|
13808
13826
|
var _events_delayPressIn;
|
|
@@ -13846,11 +13864,18 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13846
13864
|
var userTerminationRequest = viewProps.onResponderTerminationRequest;
|
|
13847
13865
|
var userMove = viewProps.onResponderMove;
|
|
13848
13866
|
viewProps.onStartShouldSetResponder = function(e) {
|
|
13849
|
-
|
|
13867
|
+
if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;
|
|
13868
|
+
return !events.disabled && !hasExternalPressOwnership();
|
|
13850
13869
|
};
|
|
13851
13870
|
viewProps.onResponderGrant = function(e) {
|
|
13852
|
-
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
13853
13871
|
cleanup();
|
|
13872
|
+
if (hasExternalPressOwnership()) {
|
|
13873
|
+
ref.current.state = "idle";
|
|
13874
|
+
ref.current.blockedByExternalOwnership = true;
|
|
13875
|
+
return;
|
|
13876
|
+
}
|
|
13877
|
+
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
13878
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13854
13879
|
ref.current.state = "pressing";
|
|
13855
13880
|
if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
|
|
13856
13881
|
return activate(e);
|
|
@@ -13865,6 +13890,12 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13865
13890
|
}, delayLongPress + delayPressIn);
|
|
13866
13891
|
};
|
|
13867
13892
|
viewProps.onResponderRelease = function(e) {
|
|
13893
|
+
if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
|
|
13894
|
+
cleanup();
|
|
13895
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13896
|
+
ref.current.state = "idle";
|
|
13897
|
+
return;
|
|
13898
|
+
}
|
|
13868
13899
|
userRelease === null || userRelease === void 0 || userRelease(e);
|
|
13869
13900
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
13870
13901
|
cleanup();
|
|
@@ -13875,12 +13906,14 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13875
13906
|
}
|
|
13876
13907
|
deactivate(e);
|
|
13877
13908
|
ref.current.state = "idle";
|
|
13909
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13878
13910
|
};
|
|
13879
13911
|
viewProps.onResponderTerminate = function(e) {
|
|
13880
13912
|
userTerminate === null || userTerminate === void 0 || userTerminate(e);
|
|
13881
13913
|
cleanup();
|
|
13882
13914
|
if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
|
|
13883
13915
|
ref.current.state = "idle";
|
|
13916
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13884
13917
|
};
|
|
13885
13918
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
13886
13919
|
if (userTerminationRequest) return userTerminationRequest(e);
|
|
@@ -13894,6 +13927,7 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13894
13927
|
}
|
|
13895
13928
|
var DEFAULT_LONG_PRESS_DELAY, DEFAULT_MIN_PRESS_DURATION;
|
|
13896
13929
|
var init_mainThreadPressEvents_native = __esmMin((() => {
|
|
13930
|
+
init_index_native$3();
|
|
13897
13931
|
DEFAULT_LONG_PRESS_DELAY = 500;
|
|
13898
13932
|
DEFAULT_MIN_PRESS_DURATION = 130;
|
|
13899
13933
|
}));
|
|
@@ -13943,7 +13977,7 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13943
13977
|
if (isUsingRNGH) {
|
|
13944
13978
|
var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
|
|
13945
13979
|
var gestureRef = (0, react.useRef)(null);
|
|
13946
|
-
useMainThreadPressEvents(events, viewProps,
|
|
13980
|
+
useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
|
|
13947
13981
|
if (everEnabled) {
|
|
13948
13982
|
callbacksRef.current = hasPressEvents ? {
|
|
13949
13983
|
onPressIn: events.onPressIn,
|
|
@@ -13951,6 +13985,10 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13951
13985
|
onPress: events.onPress,
|
|
13952
13986
|
onLongPress: events.onLongPress
|
|
13953
13987
|
} : {};
|
|
13988
|
+
if (hasRealPressEvents && !isInsideNativeMenu) {
|
|
13989
|
+
gestureRef.current = null;
|
|
13990
|
+
return null;
|
|
13991
|
+
}
|
|
13954
13992
|
if (!gestureRef.current) {
|
|
13955
13993
|
var { Gesture } = gh.state;
|
|
13956
13994
|
if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
|
|
@@ -13964,27 +14002,6 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13964
14002
|
var _callbacksRef_current_onPressOut, _callbacksRef_current;
|
|
13965
14003
|
(_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});
|
|
13966
14004
|
});
|
|
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
14005
|
else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
|
|
13989
14006
|
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
13990
14007
|
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 +14021,20 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
14004
14021
|
useMainThreadPressEvents(events, viewProps, hasPressEvents, debugName);
|
|
14005
14022
|
return null;
|
|
14006
14023
|
}
|
|
14007
|
-
function wrapWithGestureDetector(content, gesture,
|
|
14024
|
+
function wrapWithGestureDetector(content, gesture, _stateRef, isHOC, isCompositeComponent, hasRealPressEvents) {
|
|
14008
14025
|
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);
|
|
14026
|
+
var { GestureDetector } = getGestureHandler().state;
|
|
14027
|
+
if (!GestureDetector || !gesture) return content;
|
|
14028
|
+
if (!hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture }, content);
|
|
14015
14029
|
if (isFabric) {
|
|
14016
14030
|
var claimed = react.default.cloneElement(content, { onStartShouldSetResponder: responderClaim });
|
|
14017
|
-
return react.default.createElement(GestureDetector, { gesture
|
|
14031
|
+
return react.default.createElement(GestureDetector, { gesture }, claimed);
|
|
14018
14032
|
}
|
|
14019
14033
|
return react.default.createElement(View$2, {
|
|
14020
14034
|
collapsable: false,
|
|
14021
14035
|
style: responderWrapperStyle,
|
|
14022
14036
|
onStartShouldSetResponder: responderClaim
|
|
14023
|
-
}, react.default.createElement(GestureDetector, { gesture
|
|
14037
|
+
}, react.default.createElement(GestureDetector, { gesture }, content));
|
|
14024
14038
|
}
|
|
14025
14039
|
var isFabric, isAndroidCache, getIsAndroid, isNativeDesktopCache, getIsNativeDesktop, responderClaim, responderWrapperStyle;
|
|
14026
14040
|
var init_eventHandling_native = __esmMin((() => {
|
|
@@ -17036,7 +17050,8 @@ function createComponent(staticConfig) {
|
|
|
17036
17050
|
var propsInWithHref = propsIn;
|
|
17037
17051
|
var _props_testID, _ref, _ref1, _ref2, _ref3;
|
|
17038
17052
|
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
|
|
17053
|
+
var hasRealPressEvents = !!(onPress || onPressIn || onPressOut || onLongPress);
|
|
17054
|
+
var pressGesture = useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName, hasRealPressEvents);
|
|
17040
17055
|
if (asChild) {
|
|
17041
17056
|
elementType = Slot;
|
|
17042
17057
|
Object.assign(viewProps, {
|
|
@@ -17061,7 +17076,7 @@ function createComponent(staticConfig) {
|
|
|
17061
17076
|
content = /* @__PURE__ */ react.default.createElement(elementType, viewProps, content || children);
|
|
17062
17077
|
}
|
|
17063
17078
|
}
|
|
17064
|
-
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string");
|
|
17079
|
+
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string", hasRealPressEvents);
|
|
17065
17080
|
var ResetPresence = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.ResetPresence;
|
|
17066
17081
|
var needsReset = Boolean(!asChild && splitStyles && !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
|
|
17067
17082
|
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
|
|
@@ -5109,10 +5113,11 @@ function createComponent(staticConfig) {
|
|
|
5109
5113
|
BaseView = baseViews.View;
|
|
5110
5114
|
}
|
|
5111
5115
|
}
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
+
var testRenderCount = propsIn["data-test-renders"];
|
|
5117
|
+
if (testRenderCount && (typeof testRenderCount === "undefined" ? "undefined" : _type_of$1(testRenderCount)) === "object" && !Object.isFrozen(testRenderCount)) {
|
|
5118
|
+
var _testRenderCount_current;
|
|
5119
|
+
testRenderCount.current = (_testRenderCount_current = testRenderCount.current) !== null && _testRenderCount_current !== void 0 ? _testRenderCount_current : 0;
|
|
5120
|
+
testRenderCount.current += 1;
|
|
5116
5121
|
}
|
|
5117
5122
|
var { context, isReactNative } = staticConfig;
|
|
5118
5123
|
var debugProp = propsIn["debug"];
|
|
@@ -5554,7 +5559,8 @@ function createComponent(staticConfig) {
|
|
|
5554
5559
|
var propsInWithHref = propsIn;
|
|
5555
5560
|
var _props_testID, _ref, _ref1, _ref2, _ref3;
|
|
5556
5561
|
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
|
|
5562
|
+
var hasRealPressEvents = !!(onPress || onPressIn || onPressOut || onLongPress);
|
|
5563
|
+
var pressGesture = useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName, hasRealPressEvents);
|
|
5558
5564
|
if (asChild) {
|
|
5559
5565
|
elementType = Slot;
|
|
5560
5566
|
Object.assign(viewProps, {
|
|
@@ -5579,7 +5585,7 @@ function createComponent(staticConfig) {
|
|
|
5579
5585
|
content = /* @__PURE__ */ react.default.createElement(elementType, viewProps, content || children);
|
|
5580
5586
|
}
|
|
5581
5587
|
}
|
|
5582
|
-
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string");
|
|
5588
|
+
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string", hasRealPressEvents);
|
|
5583
5589
|
var ResetPresence = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.ResetPresence;
|
|
5584
5590
|
var needsReset = Boolean(!asChild && splitStyles && !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
|
|
5585
5591
|
var hasEverReset = stateRef.current.hasEverResetPresence;
|
|
@@ -7152,8 +7158,7 @@ if (ENABLE) {
|
|
|
7152
7158
|
}
|
|
7153
7159
|
function _updateLayoutIfChanged() {
|
|
7154
7160
|
_updateLayoutIfChanged = _asyncToGenerator(function* (node) {
|
|
7155
|
-
|
|
7156
|
-
if (typeof onLayout !== "function") return;
|
|
7161
|
+
if (typeof LayoutHandlers.get(node) !== "function") return;
|
|
7157
7162
|
var parentNode = node.parentElement;
|
|
7158
7163
|
if (!parentNode) return;
|
|
7159
7164
|
var nodeRect;
|
|
@@ -7166,19 +7171,7 @@ if (ENABLE) {
|
|
|
7166
7171
|
nodeRect = node.getBoundingClientRect();
|
|
7167
7172
|
parentRect = parentNode.getBoundingClientRect();
|
|
7168
7173
|
}
|
|
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
|
-
}
|
|
7174
|
+
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
7182
7175
|
});
|
|
7183
7176
|
return _updateLayoutIfChanged.apply(this, arguments);
|
|
7184
7177
|
}
|
|
@@ -7309,15 +7302,35 @@ var getRelativeDimensions = function(a, b, aNode) {
|
|
|
7309
7302
|
pageY: a.top
|
|
7310
7303
|
};
|
|
7311
7304
|
};
|
|
7312
|
-
function
|
|
7305
|
+
function emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {
|
|
7306
|
+
var onLayout = LayoutHandlers.get(node);
|
|
7307
|
+
if (typeof onLayout !== "function") return;
|
|
7308
|
+
var cachedRect = NodeRectCache.get(node);
|
|
7309
|
+
var cachedParentRect = NodeRectCache.get(parentNode);
|
|
7310
|
+
var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
|
|
7311
|
+
var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
|
|
7312
|
+
if (!nodeChanged && !parentChanged) return;
|
|
7313
|
+
NodeRectCache.set(node, nodeRect);
|
|
7314
|
+
NodeRectCache.set(parentNode, parentRect);
|
|
7315
|
+
var event = getElementLayoutEvent(nodeRect, parentRect, node);
|
|
7316
|
+
if (avoidUpdates) queuedUpdates.set(node, function() {
|
|
7317
|
+
return onLayout(event);
|
|
7318
|
+
});
|
|
7319
|
+
else onLayout(event);
|
|
7320
|
+
}
|
|
7321
|
+
function observeLayoutNode(node, disableKey) {
|
|
7313
7322
|
Nodes.add(node);
|
|
7314
|
-
LayoutHandlers.set(node, onChange);
|
|
7315
7323
|
if (disableKey) LayoutDisableKey.set(node, disableKey);
|
|
7324
|
+
else LayoutDisableKey.delete(node);
|
|
7316
7325
|
startGlobalObservers();
|
|
7317
7326
|
if (globalIntersectionObserver) {
|
|
7318
7327
|
globalIntersectionObserver.observe(node);
|
|
7319
7328
|
IntersectionState.set(node, true);
|
|
7320
7329
|
}
|
|
7330
|
+
}
|
|
7331
|
+
function registerLayoutNode(node, onChange, disableKey) {
|
|
7332
|
+
LayoutHandlers.set(node, onChange);
|
|
7333
|
+
observeLayoutNode(node, disableKey);
|
|
7321
7334
|
return function() {
|
|
7322
7335
|
return cleanupNode(node);
|
|
7323
7336
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-1783099846627",
|
|
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.
|
|
83
|
-
"@tamagui/react-native-media-driver": "2.
|
|
84
|
-
"@tamagui/react-native-use-pressable": "2.
|
|
85
|
-
"@tamagui/use-element-layout": "2.
|
|
86
|
-
"@tamagui/use-event": "2.
|
|
87
|
-
"@tamagui/web": "2.
|
|
82
|
+
"@tamagui/helpers": "2.4.0-1783099846627",
|
|
83
|
+
"@tamagui/react-native-media-driver": "2.4.0-1783099846627",
|
|
84
|
+
"@tamagui/react-native-use-pressable": "2.4.0-1783099846627",
|
|
85
|
+
"@tamagui/use-element-layout": "2.4.0-1783099846627",
|
|
86
|
+
"@tamagui/use-event": "2.4.0-1783099846627",
|
|
87
|
+
"@tamagui/web": "2.4.0-1783099846627"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@tamagui/build": "2.
|
|
91
|
-
"@tamagui/native-bundle": "2.
|
|
92
|
-
"@tamagui/react-native-web-lite": "2.
|
|
90
|
+
"@tamagui/build": "2.4.0-1783099846627",
|
|
91
|
+
"@tamagui/native-bundle": "2.4.0-1783099846627",
|
|
92
|
+
"@tamagui/react-native-web-lite": "2.4.0-1783099846627",
|
|
93
93
|
"@testing-library/react": "^16.1.0",
|
|
94
94
|
"csstype": "^3.0.10",
|
|
95
95
|
"react": ">=19",
|