tamagui 1.130.2 → 1.130.3

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.js CHANGED
@@ -13446,7 +13446,7 @@ var require_index_native19 = __commonJS({
13446
13446
  rAF(layoutOnAnimationFrame);
13447
13447
  }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body, lastFrameAt = Date.now();
13448
13448
  async function updateLayoutIfChanged(node, frameId) {
13449
- if (!(supportsCheckVisibility && !node.checkVisibility()) && IntersectionState.get(node) !== !1) {
13449
+ if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
13450
13450
  var onLayout = LayoutHandlers.get(node);
13451
13451
  if (typeof onLayout == "function") {
13452
13452
  var parentNode = node.parentElement;
@@ -17811,11 +17811,15 @@ var require_RemoveScroll_native = __commonJS({
17811
17811
  __export2(RemoveScroll_native_exports, {
17812
17812
  RemoveScroll: function() {
17813
17813
  return RemoveScroll;
17814
+ },
17815
+ getAllowedScrollableNode: function() {
17816
+ return getAllowedScrollableNode;
17814
17817
  }
17815
17818
  });
17816
17819
  module2.exports = __toCommonJS2(RemoveScroll_native_exports);
17817
17820
  var RemoveScroll = function(props) {
17818
17821
  return props.children;
17822
+ }, getAllowedScrollableNode = function() {
17819
17823
  };
17820
17824
  }
17821
17825
  });
@@ -18088,11 +18092,11 @@ var require_useSheetOpenState_native = __commonJS({
18088
18092
  var { isHidden, controller } = (0, import_useSheetController.useSheetController)(), onOpenChangeInternal = function(val) {
18089
18093
  var _controller_onOpenChange, _props_onOpenChange;
18090
18094
  controller == null || (_controller_onOpenChange = controller.onOpenChange) === null || _controller_onOpenChange === void 0 || _controller_onOpenChange.call(controller, val), (_props_onOpenChange = props.onOpenChange) === null || _props_onOpenChange === void 0 || _props_onOpenChange.call(props, val);
18091
- }, _controller_open, propVal = (_controller_open = controller == null ? void 0 : controller.open) !== null && _controller_open !== void 0 ? _controller_open : props.open, _props_defaultOpen, [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
18095
+ }, _controller_open, _props_open, propVal = props.preferAdaptParentOpenState ? (_controller_open = controller == null ? void 0 : controller.open) !== null && _controller_open !== void 0 ? _controller_open : props.open : (_props_open = props.open) !== null && _props_open !== void 0 ? _props_open : controller == null ? void 0 : controller.open, _props_defaultOpen, [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
18092
18096
  prop: propVal,
18093
18097
  defaultProp: (_props_defaultOpen = props.defaultOpen) !== null && _props_defaultOpen !== void 0 ? _props_defaultOpen : !1,
18094
18098
  onChange: onOpenChangeInternal,
18095
- strategy: "prop-wins"
18099
+ strategy: "most-recent-wins"
18096
18100
  });
18097
18101
  return {
18098
18102
  open,
@@ -18179,7 +18183,7 @@ var require_useSheetProviderProps_native = __commonJS({
18179
18183
  prop: props.position,
18180
18184
  defaultProp: props.defaultPosition || (state.open ? 0 : -1),
18181
18185
  onChange: props.onPositionChange,
18182
- strategy: "prop-wins"
18186
+ strategy: "most-recent-wins"
18183
18187
  }), position = state.open === !1 ? -1 : position_, { open } = state, setPosition = import_react3.default.useCallback(function(next) {
18184
18188
  props.dismissOnSnapToBottom && next === snapPoints.length - 1 ? state.setOpen(!1) : setPositionImmediate(next);
18185
18189
  }, [
@@ -18213,7 +18217,7 @@ var require_useSheetProviderProps_native = __commonJS({
18213
18217
  var { animationDriver } = (0, import_core12.useConfiguration)();
18214
18218
  if (!animationDriver) throw new Error(process.env.NODE_ENV === "production" ? "\u274C 008" : "Must set animations in tamagui.config.ts");
18215
18219
  var scrollBridge = (0, import_use_constant.useConstant)(function() {
18216
- return {
18220
+ var parentDragListeners = /* @__PURE__ */ new Set(), bridge = {
18217
18221
  enabled: !1,
18218
18222
  y: 0,
18219
18223
  paneY: 0,
@@ -18223,8 +18227,20 @@ var require_useSheetProviderProps_native = __commonJS({
18223
18227
  },
18224
18228
  release: function() {
18225
18229
  },
18226
- scrollLock: !1
18230
+ scrollLock: !1,
18231
+ isParentDragging: !1,
18232
+ onParentDragging: function(cb) {
18233
+ return parentDragListeners.add(cb), function() {
18234
+ parentDragListeners.delete(cb);
18235
+ };
18236
+ },
18237
+ setParentDragging: function(val) {
18238
+ val !== bridge.isParentDragging && (bridge.isParentDragging = val, parentDragListeners.forEach(function(cb) {
18239
+ return cb(val);
18240
+ }));
18241
+ }
18227
18242
  };
18243
+ return bridge;
18228
18244
  }), _props_forceRemoveScrollEnabled, removeScrollEnabled = (_props_forceRemoveScrollEnabled = props.forceRemoveScrollEnabled) !== null && _props_forceRemoveScrollEnabled !== void 0 ? _props_forceRemoveScrollEnabled : open && props.modal, maxSnapPoint = snapPoints[0], screenSize = snapPointsMode === "percent" ? frameSize / ((typeof maxSnapPoint == "number" ? maxSnapPoint : 100) / 100) : maxContentSize, _props_dismissOnOverlayPress, _props_dismissOnSnapToBottom, providerProps = {
18229
18245
  screenSize,
18230
18246
  maxSnapPoint,
@@ -18329,7 +18345,6 @@ var require_nativeSheet_native = __commonJS({
18329
18345
  }
18330
18346
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, {
18331
18347
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_SheetContext.SheetProvider, {
18332
- scrollEnabled: !0,
18333
18348
  setHasScrollView: emptyFn,
18334
18349
  ...providerProps,
18335
18350
  onlyShowFrame: !0,
@@ -18622,15 +18637,13 @@ var require_SheetImplementationCustom_native = __commonJS({
18622
18637
  isAbleToPosition,
18623
18638
  position
18624
18639
  ]);
18625
- var _props_disableDrag, disableDrag = (_props_disableDrag = props.disableDrag) !== null && _props_disableDrag !== void 0 ? _props_disableDrag : controller == null ? void 0 : controller.disableDrag, themeName = (0, import_core12.useThemeName)(), [isDragging, setIsDragging] = import_react3.default.useState(!1), scrollEnabled = (0, import_react3.useRef)(!0), setScrollEnabled = import_react3.default.useCallback(function(val) {
18626
- scrollEnabled.current = val;
18627
- }, []), panResponder = import_react3.default.useMemo(function() {
18640
+ var _props_disableDrag, disableDrag = (_props_disableDrag = props.disableDrag) !== null && _props_disableDrag !== void 0 ? _props_disableDrag : controller == null ? void 0 : controller.disableDrag, themeName = (0, import_core12.useThemeName)(), [isDragging, setIsDragging] = import_react3.default.useState(!1), panResponder = import_react3.default.useMemo(function() {
18628
18641
  if (disableDrag || !frameSize || isShowingInnerSheet) return;
18629
18642
  var minY = positions[0];
18630
18643
  scrollBridge.paneMinY = minY;
18631
18644
  var startY = at.current;
18632
18645
  function setPanning(val) {
18633
- setIsDragging(val), import_constants4.isClient && (sheetHiddenStyleSheet || (sheetHiddenStyleSheet = document.createElement("style"), typeof document.head < "u" && document.head.appendChild(sheetHiddenStyleSheet)), val ? sheetHiddenStyleSheet.innerText = ":root * { user-select: none !important; -webkit-user-select: none !important; }" : sheetHiddenStyleSheet.innerText = "");
18646
+ setIsDragging(val), scrollBridge.setParentDragging(!1), import_constants4.isClient && (sheetHiddenStyleSheet || (sheetHiddenStyleSheet = document.createElement("style"), typeof document.head < "u" && document.head.appendChild(sheetHiddenStyleSheet)), val ? sheetHiddenStyleSheet.innerText = ":root * { user-select: none !important; -webkit-user-select: none !important; }" : sheetHiddenStyleSheet.innerText = "");
18634
18647
  }
18635
18648
  var release = function(param) {
18636
18649
  var { vy, dragAt } = param;
@@ -18640,7 +18653,7 @@ var require_SheetImplementationCustom_native = __commonJS({
18640
18653
  var position2 = positions[i], curDist = end > position2 ? end - position2 : position2 - end;
18641
18654
  curDist < dist && (dist = curDist, closestPoint = i);
18642
18655
  }
18643
- setPosition(closestPoint), animateTo(closestPoint), setScrollEnabled(closestPoint === 0);
18656
+ setPosition(closestPoint), animateTo(closestPoint);
18644
18657
  }
18645
18658
  }, finish = function(_e, state2) {
18646
18659
  release({
@@ -18653,11 +18666,12 @@ var require_SheetImplementationCustom_native = __commonJS({
18653
18666
  if (e.target === providerProps.handleRef.current) return !0;
18654
18667
  if (scrollBridge.scrollLock) return !1;
18655
18668
  var isScrolled = scrollBridge.y !== 0, isDraggingUp = dy < 0, isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
18656
- return isScrolled ? (previouslyScrolling = !0, !1) : isNearTop && hasScrollView.current && isDraggingUp ? !1 : Math.abs(dy) > 10;
18669
+ return isScrolled ? (previouslyScrolling = !0, !1) : isNearTop && hasScrollView.current && isDraggingUp ? !1 : Math.abs(dy) > 5;
18657
18670
  }
18658
- return getShouldSet();
18671
+ var granted = getShouldSet();
18672
+ return granted && scrollBridge.setParentDragging(!0), granted;
18659
18673
  }, grant = function() {
18660
- setScrollEnabled(!1), setPanning(!0), stopSpring(), startY = at.current;
18674
+ setPanning(!0), stopSpring(), startY = at.current;
18661
18675
  }, isExternalDrag = !1;
18662
18676
  return scrollBridge.drag = function(dy) {
18663
18677
  isExternalDrag || (isExternalDrag = !0, grant());
@@ -18669,8 +18683,8 @@ var require_SheetImplementationCustom_native = __commonJS({
18669
18683
  onMoveShouldSetPanResponder: onMoveShouldSet,
18670
18684
  onPanResponderGrant: grant,
18671
18685
  onPanResponderMove: function(_e, param) {
18672
- var { dy } = param, toFull = dy + startY, to = (0, import_helpers.resisted)(toFull, minY);
18673
- animatedNumber.setValue(to, {
18686
+ var { dy } = param, toFull = dy + startY, to = (0, import_helpers.resisted)(toFull, minY), isAtTop = to <= minY;
18687
+ isAtTop ? scrollBridge.setParentDragging(!1) : scrollBridge.setParentDragging(!0), animatedNumber.setValue(to, {
18674
18688
  type: "direct"
18675
18689
  });
18676
18690
  },
@@ -18744,7 +18758,6 @@ var require_SheetImplementationCustom_native = __commonJS({
18744
18758
  value: nextParentContext,
18745
18759
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_SheetContext.SheetProvider, {
18746
18760
  ...providerProps,
18747
- scrollEnabled: scrollEnabled.current,
18748
18761
  setHasScrollView,
18749
18762
  children: [
18750
18763
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_animate_presence.AnimatePresence, {
@@ -19001,7 +19014,7 @@ var require_SheetScrollView_native = __commonJS({
19001
19014
  });
19002
19015
  module2.exports = __toCommonJS2(SheetScrollView_exports);
19003
19016
  var import_jsx_runtime6 = require("react/jsx-runtime"), import_compose_refs = require_index_native11(), import_core12 = require_index_native20(), import_scroll_view = require_index_native37(), import_use_controllable_state = require_index_native10(), import_react3 = __toESM2(require("react")), import_SheetContext = require_SheetContext_native(), SHEET_SCROLL_VIEW_NAME = "SheetScrollView", SheetScrollView = /* @__PURE__ */ import_react3.default.forwardRef(function(param, ref) {
19004
- var { __scopeSheet, children, onScroll, scrollEnabled: scrollEnabledProp, ...props } = param, context = (0, import_SheetContext.useSheetContext)(SHEET_SCROLL_VIEW_NAME, __scopeSheet), { scrollBridge, scrollEnabled: scrollEnabled_, setHasScrollView } = context, [scrollEnabled, setScrollEnabled_] = (0, import_use_controllable_state.useControllableState)({
19017
+ var { __scopeSheet, children, onScroll, scrollEnabled: scrollEnabledProp, ...props } = param, context = (0, import_SheetContext.useSheetContext)(SHEET_SCROLL_VIEW_NAME, __scopeSheet), { scrollBridge, setHasScrollView } = context, [scrollEnabled, setScrollEnabled_] = (0, import_use_controllable_state.useControllableState)({
19005
19018
  prop: scrollEnabledProp,
19006
19019
  defaultProp: !0
19007
19020
  }), scrollRef = import_react3.default.useRef(null), setScrollEnabled = function(next) {
@@ -19015,7 +19028,7 @@ var require_SheetScrollView_native = __commonJS({
19015
19028
  dys: [],
19016
19029
  // store a few recent dys to get velocity on release
19017
19030
  isScrolling: !1,
19018
- isDragging: !1
19031
+ isDraggingScrollArea: !1
19019
19032
  });
19020
19033
  (0, import_react3.useEffect)(function() {
19021
19034
  return setHasScrollView(!0), function() {
@@ -19023,8 +19036,8 @@ var require_SheetScrollView_native = __commonJS({
19023
19036
  };
19024
19037
  }, []);
19025
19038
  var release = function() {
19026
- if (state.current.isDragging) {
19027
- state.current.isDragging = !1, scrollBridge.scrollStartY = -1, scrollBridge.scrollLock = !1, state.current.isScrolling = !1, setScrollEnabled(!0);
19039
+ if (state.current.isDraggingScrollArea) {
19040
+ state.current.isDraggingScrollArea = !1, scrollBridge.scrollStartY = -1, scrollBridge.scrollLock = !1, state.current.isScrolling = !1, setScrollEnabled(!0);
19028
19041
  var vy = 0;
19029
19042
  if (state.current.dys.length) {
19030
19043
  var recentDys = state.current.dys.slice(-10), dist = recentDys.length ? recentDys.reduce(function(a, b) {
@@ -19037,8 +19050,31 @@ var require_SheetScrollView_native = __commonJS({
19037
19050
  vy
19038
19051
  });
19039
19052
  }
19040
- }, scrollable = scrollEnabled ?? scrollEnabled_;
19041
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_scroll_view.ScrollView, {
19053
+ }, scrollable = scrollEnabled;
19054
+ return (0, import_react3.useEffect)(function() {
19055
+ if (!(typeof window > "u") && scrollRef.current) {
19056
+ var controller = new AbortController(), node = scrollRef.current.getScrollableNode();
19057
+ node.addEventListener(
19058
+ "touchmove",
19059
+ function(e) {
19060
+ scrollBridge.isParentDragging && node.scrollTo({
19061
+ top: scrollBridge.y,
19062
+ behavior: "instant"
19063
+ });
19064
+ },
19065
+ // can't preventdefault its not cancellable
19066
+ {
19067
+ signal: controller.signal,
19068
+ passive: !1
19069
+ }
19070
+ );
19071
+ var disposeBridgeListen = scrollBridge.onParentDragging(function(val) {
19072
+ });
19073
+ return function() {
19074
+ disposeBridgeListen(), controller.abort();
19075
+ };
19076
+ }
19077
+ }, []), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_scroll_view.ScrollView, {
19042
19078
  ref: (0, import_compose_refs.composeRefs)(scrollRef, ref),
19043
19079
  flex: 1,
19044
19080
  scrollEventThrottle: 8,
@@ -19059,7 +19095,7 @@ var require_SheetScrollView_native = __commonJS({
19059
19095
  // renderScrollComponent={Sheet.ScrollView}
19060
19096
  // ```
19061
19097
  onStartShouldSetResponder: function() {
19062
- return scrollBridge.scrollStartY = -1, state.current.isDragging = !0, scrollable;
19098
+ return scrollBridge.scrollStartY = -1, state.current.isDraggingScrollArea = !0, scrollable;
19063
19099
  },
19064
19100
  // setting to false while onResponderMove is disabled
19065
19101
  onMoveShouldSetResponder: function(e) {
@@ -19071,15 +19107,15 @@ var require_SheetScrollView_native = __commonJS({
19071
19107
  onResponderMove: function(e) {
19072
19108
  if (import_core12.isWeb) {
19073
19109
  var { pageY } = e.nativeEvent;
19074
- if (state.current.isScrolling) return;
19075
- scrollBridge.scrollStartY === -1 && (scrollBridge.scrollStartY = pageY, state.current.lastPageY = pageY);
19110
+ state.current.isScrolling || scrollBridge.scrollStartY === -1 && (scrollBridge.scrollStartY = pageY, state.current.lastPageY = pageY);
19076
19111
  var dragAt = pageY - scrollBridge.scrollStartY, dy = pageY - state.current.lastPageY;
19077
19112
  state.current.lastPageY = pageY;
19078
19113
  var isDraggingUp = dy < 0, isPaneAtTop = scrollBridge.paneY <= scrollBridge.paneMinY, shouldScrollLock = (dy === 0 || isDraggingUp) && isPaneAtTop;
19079
- if (shouldScrollLock) {
19114
+ if (shouldScrollLock && !state.current.isScrolling) {
19080
19115
  state.current.isScrolling = !0, scrollBridge.scrollLock = !0, setScrollEnabled(!0);
19081
19116
  return;
19082
19117
  }
19118
+ if (scrollBridge.y >= 0) return;
19083
19119
  setScrollEnabled(!1), scrollBridge.drag(dragAt), state.current.dragAt = dragAt, state.current.dys.push(dy), state.current.dys.length > 100 && (state.current.dys = state.current.dys.slice(-10));
19084
19120
  }
19085
19121
  },