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.
@@ -12874,7 +12874,7 @@ var require_index_native19 = __commonJS({
12874
12874
  rAF(layoutOnAnimationFrame);
12875
12875
  }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body, lastFrameAt = Date.now();
12876
12876
  async function updateLayoutIfChanged(node, frameId) {
12877
- if (!(supportsCheckVisibility && !node.checkVisibility()) && IntersectionState.get(node) !== !1) {
12877
+ if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
12878
12878
  var onLayout = LayoutHandlers.get(node);
12879
12879
  if (typeof onLayout == "function") {
12880
12880
  var parentNode = node.parentElement;
@@ -17225,11 +17225,15 @@ var require_RemoveScroll_native = __commonJS({
17225
17225
  __export2(RemoveScroll_native_exports, {
17226
17226
  RemoveScroll: function() {
17227
17227
  return RemoveScroll;
17228
+ },
17229
+ getAllowedScrollableNode: function() {
17230
+ return getAllowedScrollableNode;
17228
17231
  }
17229
17232
  });
17230
17233
  module2.exports = __toCommonJS2(RemoveScroll_native_exports);
17231
17234
  var RemoveScroll = function(props) {
17232
17235
  return props.children;
17236
+ }, getAllowedScrollableNode = function() {
17233
17237
  };
17234
17238
  }
17235
17239
  });
@@ -17502,11 +17506,11 @@ var require_useSheetOpenState_native = __commonJS({
17502
17506
  var { isHidden, controller } = (0, import_useSheetController.useSheetController)(), onOpenChangeInternal = function(val) {
17503
17507
  var _controller_onOpenChange, _props_onOpenChange;
17504
17508
  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);
17505
- }, _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)({
17509
+ }, _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)({
17506
17510
  prop: propVal,
17507
17511
  defaultProp: (_props_defaultOpen = props.defaultOpen) !== null && _props_defaultOpen !== void 0 ? _props_defaultOpen : !1,
17508
17512
  onChange: onOpenChangeInternal,
17509
- strategy: "prop-wins"
17513
+ strategy: "most-recent-wins"
17510
17514
  });
17511
17515
  return {
17512
17516
  open,
@@ -17593,7 +17597,7 @@ var require_useSheetProviderProps_native = __commonJS({
17593
17597
  prop: props.position,
17594
17598
  defaultProp: props.defaultPosition || (state.open ? 0 : -1),
17595
17599
  onChange: props.onPositionChange,
17596
- strategy: "prop-wins"
17600
+ strategy: "most-recent-wins"
17597
17601
  }), position = state.open === !1 ? -1 : position_, { open } = state, setPosition = import_react3.default.useCallback(function(next) {
17598
17602
  props.dismissOnSnapToBottom && next === snapPoints.length - 1 ? state.setOpen(!1) : setPositionImmediate(next);
17599
17603
  }, [
@@ -17613,7 +17617,7 @@ var require_useSheetProviderProps_native = __commonJS({
17613
17617
  var { animationDriver } = (0, import_core12.useConfiguration)();
17614
17618
  if (!animationDriver) throw new Error("Must set animations in tamagui.config.ts");
17615
17619
  var scrollBridge = (0, import_use_constant.useConstant)(function() {
17616
- return {
17620
+ var parentDragListeners = /* @__PURE__ */ new Set(), bridge = {
17617
17621
  enabled: !1,
17618
17622
  y: 0,
17619
17623
  paneY: 0,
@@ -17623,8 +17627,20 @@ var require_useSheetProviderProps_native = __commonJS({
17623
17627
  },
17624
17628
  release: function() {
17625
17629
  },
17626
- scrollLock: !1
17630
+ scrollLock: !1,
17631
+ isParentDragging: !1,
17632
+ onParentDragging: function(cb) {
17633
+ return parentDragListeners.add(cb), function() {
17634
+ parentDragListeners.delete(cb);
17635
+ };
17636
+ },
17637
+ setParentDragging: function(val) {
17638
+ val !== bridge.isParentDragging && (bridge.isParentDragging = val, parentDragListeners.forEach(function(cb) {
17639
+ return cb(val);
17640
+ }));
17641
+ }
17627
17642
  };
17643
+ return bridge;
17628
17644
  }), _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 = {
17629
17645
  screenSize,
17630
17646
  maxSnapPoint,
@@ -17729,7 +17745,6 @@ var require_nativeSheet_native = __commonJS({
17729
17745
  }
17730
17746
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, {
17731
17747
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_SheetContext.SheetProvider, {
17732
- scrollEnabled: !0,
17733
17748
  setHasScrollView: emptyFn,
17734
17749
  ...providerProps,
17735
17750
  onlyShowFrame: !0,
@@ -18022,15 +18037,13 @@ var require_SheetImplementationCustom_native = __commonJS({
18022
18037
  isAbleToPosition,
18023
18038
  position
18024
18039
  ]);
18025
- 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) {
18026
- scrollEnabled.current = val;
18027
- }, []), panResponder = import_react3.default.useMemo(function() {
18040
+ 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() {
18028
18041
  if (disableDrag || !frameSize || isShowingInnerSheet) return;
18029
18042
  var minY = positions[0];
18030
18043
  scrollBridge.paneMinY = minY;
18031
18044
  var startY = at.current;
18032
18045
  function setPanning(val) {
18033
- 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 = "");
18046
+ 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 = "");
18034
18047
  }
18035
18048
  var release = function(param) {
18036
18049
  var { vy, dragAt } = param;
@@ -18040,7 +18053,7 @@ var require_SheetImplementationCustom_native = __commonJS({
18040
18053
  var position2 = positions[i], curDist = end > position2 ? end - position2 : position2 - end;
18041
18054
  curDist < dist && (dist = curDist, closestPoint = i);
18042
18055
  }
18043
- setPosition(closestPoint), animateTo(closestPoint), setScrollEnabled(closestPoint === 0);
18056
+ setPosition(closestPoint), animateTo(closestPoint);
18044
18057
  }
18045
18058
  }, finish = function(_e, state2) {
18046
18059
  release({
@@ -18053,11 +18066,12 @@ var require_SheetImplementationCustom_native = __commonJS({
18053
18066
  if (e.target === providerProps.handleRef.current) return !0;
18054
18067
  if (scrollBridge.scrollLock) return !1;
18055
18068
  var isScrolled = scrollBridge.y !== 0, isDraggingUp = dy < 0, isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
18056
- return isScrolled ? (previouslyScrolling = !0, !1) : isNearTop && hasScrollView.current && isDraggingUp ? !1 : Math.abs(dy) > 10;
18069
+ return isScrolled ? (previouslyScrolling = !0, !1) : isNearTop && hasScrollView.current && isDraggingUp ? !1 : Math.abs(dy) > 5;
18057
18070
  }
18058
- return getShouldSet();
18071
+ var granted = getShouldSet();
18072
+ return granted && scrollBridge.setParentDragging(!0), granted;
18059
18073
  }, grant = function() {
18060
- setScrollEnabled(!1), setPanning(!0), stopSpring(), startY = at.current;
18074
+ setPanning(!0), stopSpring(), startY = at.current;
18061
18075
  }, isExternalDrag = !1;
18062
18076
  return scrollBridge.drag = function(dy) {
18063
18077
  isExternalDrag || (isExternalDrag = !0, grant());
@@ -18069,8 +18083,8 @@ var require_SheetImplementationCustom_native = __commonJS({
18069
18083
  onMoveShouldSetPanResponder: onMoveShouldSet,
18070
18084
  onPanResponderGrant: grant,
18071
18085
  onPanResponderMove: function(_e, param) {
18072
- var { dy } = param, toFull = dy + startY, to = (0, import_helpers.resisted)(toFull, minY);
18073
- animatedNumber.setValue(to, {
18086
+ var { dy } = param, toFull = dy + startY, to = (0, import_helpers.resisted)(toFull, minY), isAtTop = to <= minY;
18087
+ isAtTop ? scrollBridge.setParentDragging(!1) : scrollBridge.setParentDragging(!0), animatedNumber.setValue(to, {
18074
18088
  type: "direct"
18075
18089
  });
18076
18090
  },
@@ -18144,7 +18158,6 @@ var require_SheetImplementationCustom_native = __commonJS({
18144
18158
  value: nextParentContext,
18145
18159
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_SheetContext.SheetProvider, {
18146
18160
  ...providerProps,
18147
- scrollEnabled: scrollEnabled.current,
18148
18161
  setHasScrollView,
18149
18162
  children: [
18150
18163
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_animate_presence.AnimatePresence, {
@@ -18401,7 +18414,7 @@ var require_SheetScrollView_native = __commonJS({
18401
18414
  });
18402
18415
  module2.exports = __toCommonJS2(SheetScrollView_exports);
18403
18416
  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) {
18404
- 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)({
18417
+ 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)({
18405
18418
  prop: scrollEnabledProp,
18406
18419
  defaultProp: !0
18407
18420
  }), scrollRef = import_react3.default.useRef(null), setScrollEnabled = function(next) {
@@ -18415,7 +18428,7 @@ var require_SheetScrollView_native = __commonJS({
18415
18428
  dys: [],
18416
18429
  // store a few recent dys to get velocity on release
18417
18430
  isScrolling: !1,
18418
- isDragging: !1
18431
+ isDraggingScrollArea: !1
18419
18432
  });
18420
18433
  (0, import_react3.useEffect)(function() {
18421
18434
  return setHasScrollView(!0), function() {
@@ -18423,8 +18436,8 @@ var require_SheetScrollView_native = __commonJS({
18423
18436
  };
18424
18437
  }, []);
18425
18438
  var release = function() {
18426
- if (state.current.isDragging) {
18427
- state.current.isDragging = !1, scrollBridge.scrollStartY = -1, scrollBridge.scrollLock = !1, state.current.isScrolling = !1, setScrollEnabled(!0);
18439
+ if (state.current.isDraggingScrollArea) {
18440
+ state.current.isDraggingScrollArea = !1, scrollBridge.scrollStartY = -1, scrollBridge.scrollLock = !1, state.current.isScrolling = !1, setScrollEnabled(!0);
18428
18441
  var vy = 0;
18429
18442
  if (state.current.dys.length) {
18430
18443
  var recentDys = state.current.dys.slice(-10), dist = recentDys.length ? recentDys.reduce(function(a, b) {
@@ -18437,8 +18450,31 @@ var require_SheetScrollView_native = __commonJS({
18437
18450
  vy
18438
18451
  });
18439
18452
  }
18440
- }, scrollable = scrollEnabled ?? scrollEnabled_;
18441
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_scroll_view.ScrollView, {
18453
+ }, scrollable = scrollEnabled;
18454
+ return (0, import_react3.useEffect)(function() {
18455
+ if (!(typeof window > "u") && scrollRef.current) {
18456
+ var controller = new AbortController(), node = scrollRef.current.getScrollableNode();
18457
+ node.addEventListener(
18458
+ "touchmove",
18459
+ function(e) {
18460
+ scrollBridge.isParentDragging && node.scrollTo({
18461
+ top: scrollBridge.y,
18462
+ behavior: "instant"
18463
+ });
18464
+ },
18465
+ // can't preventdefault its not cancellable
18466
+ {
18467
+ signal: controller.signal,
18468
+ passive: !1
18469
+ }
18470
+ );
18471
+ var disposeBridgeListen = scrollBridge.onParentDragging(function(val) {
18472
+ });
18473
+ return function() {
18474
+ disposeBridgeListen(), controller.abort();
18475
+ };
18476
+ }
18477
+ }, []), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_scroll_view.ScrollView, {
18442
18478
  ref: (0, import_compose_refs.composeRefs)(scrollRef, ref),
18443
18479
  flex: 1,
18444
18480
  scrollEventThrottle: 8,
@@ -18459,7 +18495,7 @@ var require_SheetScrollView_native = __commonJS({
18459
18495
  // renderScrollComponent={Sheet.ScrollView}
18460
18496
  // ```
18461
18497
  onStartShouldSetResponder: function() {
18462
- return scrollBridge.scrollStartY = -1, state.current.isDragging = !0, scrollable;
18498
+ return scrollBridge.scrollStartY = -1, state.current.isDraggingScrollArea = !0, scrollable;
18463
18499
  },
18464
18500
  // setting to false while onResponderMove is disabled
18465
18501
  onMoveShouldSetResponder: function(e) {
@@ -18471,15 +18507,15 @@ var require_SheetScrollView_native = __commonJS({
18471
18507
  onResponderMove: function(e) {
18472
18508
  if (import_core12.isWeb) {
18473
18509
  var { pageY } = e.nativeEvent;
18474
- if (state.current.isScrolling) return;
18475
- scrollBridge.scrollStartY === -1 && (scrollBridge.scrollStartY = pageY, state.current.lastPageY = pageY);
18510
+ state.current.isScrolling || scrollBridge.scrollStartY === -1 && (scrollBridge.scrollStartY = pageY, state.current.lastPageY = pageY);
18476
18511
  var dragAt = pageY - scrollBridge.scrollStartY, dy = pageY - state.current.lastPageY;
18477
18512
  state.current.lastPageY = pageY;
18478
18513
  var isDraggingUp = dy < 0, isPaneAtTop = scrollBridge.paneY <= scrollBridge.paneMinY, shouldScrollLock = (dy === 0 || isDraggingUp) && isPaneAtTop;
18479
- if (shouldScrollLock) {
18514
+ if (shouldScrollLock && !state.current.isScrolling) {
18480
18515
  state.current.isScrolling = !0, scrollBridge.scrollLock = !0, setScrollEnabled(!0);
18481
18516
  return;
18482
18517
  }
18518
+ if (scrollBridge.y >= 0) return;
18483
18519
  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));
18484
18520
  }
18485
18521
  },