tamagui 1.119.3 → 1.120.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/native.js CHANGED
@@ -15655,7 +15655,7 @@ var require_useStackedZIndex_native = __commonJS({
15655
15655
  });
15656
15656
  module2.exports = __toCommonJS2(useStackedZIndex_exports);
15657
15657
  var import_react3 = require("react"), CurrentPortalZIndices = {}, useStackedZIndex = function(props) {
15658
- var { stackZIndex, zIndex: zIndexProp = 1e3 } = props, zIndex = function() {
15658
+ var { stackZIndex, zIndex: zIndexProp = 1e3 } = props, id = (0, import_react3.useId)(), zIndex = (0, import_react3.useMemo)(function() {
15659
15659
  if (stackZIndex) {
15660
15660
  var highest = Object.values(CurrentPortalZIndices).reduce(function(acc, cur) {
15661
15661
  return Math.max(acc, cur);
@@ -15663,13 +15663,15 @@ var require_useStackedZIndex_native = __commonJS({
15663
15663
  return Math.max(stackZIndex, highest + 1);
15664
15664
  }
15665
15665
  if (zIndexProp) return zIndexProp;
15666
- }(), id = (0, import_react3.useId)();
15666
+ }, [
15667
+ stackZIndex
15668
+ ]);
15667
15669
  return (0, import_react3.useEffect)(function() {
15668
- if (typeof zIndex == "number") return CurrentPortalZIndices[id] = zIndex, function() {
15670
+ if (typeof stackZIndex == "number") return CurrentPortalZIndices[id] = stackZIndex, function() {
15669
15671
  delete CurrentPortalZIndices[id];
15670
15672
  };
15671
15673
  }, [
15672
- zIndex
15674
+ stackZIndex
15673
15675
  ]), zIndex;
15674
15676
  };
15675
15677
  }
@@ -16021,7 +16023,16 @@ var require_Portal_native = __commonJS({
16021
16023
  });
16022
16024
  module2.exports = __toCommonJS2(Portal_native_exports);
16023
16025
  var import_jsx_runtime6 = require("react/jsx-runtime"), import_stacks3 = require_index_native21(), React4 = __toESM2(require("react")), import_react_native4 = require("react-native"), import_constants4 = require_constants_native3(), import_useStackedZIndex = require_useStackedZIndex_native(), import_GorhomPortalItem = require_GorhomPortalItem_native(), createPortal = function() {
16024
- return import_constants4.IS_FABRIC ? require("react-native/Libraries/Renderer/shims/ReactFabric").createPortal : require("react-native/Libraries/Renderer/shims/ReactNative").createPortal;
16026
+ if (import_constants4.IS_FABRIC) try {
16027
+ return require("react-native/Libraries/Renderer/shims/ReactFabric").createPortal;
16028
+ } catch (err) {
16029
+ return console.info("Note: error importing portal, defaulting to non-native portals", err), null;
16030
+ }
16031
+ try {
16032
+ return require("react-native/Libraries/Renderer/shims/ReactNative").createPortal;
16033
+ } catch (err) {
16034
+ return console.info("Note: error importing portal, defaulting to non-native portals", err), null;
16035
+ }
16025
16036
  }(), Portal = function(propsIn) {
16026
16037
  var { stackZIndex, ...props } = propsIn, rootTag = React4.useContext(import_react_native4.RootTagContext), zIndex = (0, import_useStackedZIndex.useStackedZIndex)(propsIn), contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, {
16027
16038
  pointerEvents: "box-none",
@@ -16031,7 +16042,7 @@ var require_Portal_native = __commonJS({
16031
16042
  ...props,
16032
16043
  zIndex
16033
16044
  });
16034
- return !import_constants4.USE_NATIVE_PORTAL || !rootTag ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_GorhomPortalItem.GorhomPortalItem, {
16045
+ return !createPortal || !import_constants4.USE_NATIVE_PORTAL || !rootTag ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_GorhomPortalItem.GorhomPortalItem, {
16035
16046
  hostName: "root",
16036
16047
  children: contents
16037
16048
  }) : createPortal(contents, rootTag);
@@ -17651,7 +17662,7 @@ var require_SheetImplementationCustom_native = __commonJS({
17651
17662
  };
17652
17663
  }, [
17653
17664
  zIndex
17654
- ]), animatedNumber = useAnimatedNumber(hiddenSize), at = import_react3.default.useRef(hiddenSize);
17665
+ ]), isMounted = (0, import_core12.useDidFinishSSR)(), startPosition = isMounted && screenSize ? screenSize : hiddenSize, animatedNumber = useAnimatedNumber(startPosition), at = import_react3.default.useRef(startPosition), hasntMeasured = at.current === hiddenSize, [disableAnimation, setDisableAnimation] = (0, import_react3.useState)(hasntMeasured);
17655
17666
  useAnimatedNumberReaction({
17656
17667
  value: animatedNumber,
17657
17668
  hostRef: sheetRef
@@ -17663,40 +17674,31 @@ var require_SheetImplementationCustom_native = __commonJS({
17663
17674
  function stopSpring() {
17664
17675
  animatedNumber.stop(), scrollBridge.onFinishAnimate && (scrollBridge.onFinishAnimate(), scrollBridge.onFinishAnimate = void 0);
17665
17676
  }
17666
- var hasntMeasured = at.current === hiddenSize, animateTo = (0, import_core12.useEvent)(function(position2) {
17677
+ var animateTo = (0, import_core12.useEvent)(function(position2) {
17667
17678
  if (frameSize !== 0) {
17668
17679
  var toValue = isHidden || position2 === -1 ? screenSize : positions[position2];
17669
- if (at.current !== toValue) {
17670
- if (at.current = toValue, stopSpring(), hasntMeasured || isHidden) {
17671
- animatedNumber.setValue(screenSize, {
17672
- type: "timing",
17673
- duration: 0
17674
- }, function() {
17675
- isHidden || (toValue = positions[position2], at.current = toValue, animatedNumber.setValue(toValue, {
17676
- type: "spring",
17677
- ...animationConfig
17678
- }));
17679
- });
17680
- return;
17681
- }
17682
- animatedNumber.setValue(toValue, {
17683
- type: "spring",
17684
- ...animationConfig
17685
- });
17686
- }
17680
+ at.current !== toValue && (at.current = toValue, stopSpring(), animatedNumber.setValue(toValue, {
17681
+ type: "spring",
17682
+ ...animationConfig
17683
+ }));
17687
17684
  }
17688
17685
  });
17689
17686
  (0, import_constants4.useIsomorphicLayoutEffect)(function() {
17690
- screenSize && hasntMeasured && animatedNumber.setValue(screenSize, {
17691
- type: "timing",
17692
- duration: 0
17693
- });
17687
+ if (hasntMeasured && screenSize) {
17688
+ at.current = screenSize, animatedNumber.setValue(screenSize, {
17689
+ type: "timing",
17690
+ duration: 0
17691
+ }, function() {
17692
+ setTimeout(function() {
17693
+ setDisableAnimation(!1);
17694
+ }, 10);
17695
+ });
17696
+ return;
17697
+ }
17698
+ disableAnimation || !frameSize || !screenSize || isHidden || hasntMeasured && !open || animateTo(position);
17694
17699
  }, [
17695
17700
  hasntMeasured,
17696
- screenSize
17697
- ]), (0, import_constants4.useIsomorphicLayoutEffect)(function() {
17698
- !frameSize || !screenSize || isHidden || hasntMeasured && !open || animateTo(position);
17699
- }, [
17701
+ disableAnimation,
17700
17702
  isHidden,
17701
17703
  frameSize,
17702
17704
  screenSize,
@@ -17811,7 +17813,7 @@ var require_SheetImplementationCustom_native = __commonJS({
17811
17813
  }, [
17812
17814
  open
17813
17815
  ]);
17814
- var forcedContentHeight = hasFit ? void 0 : snapPointsMode === "percent" ? `${maxSnapPoint}${import_constants4.isWeb ? "dvh" : "%"}` : maxSnapPoint, id = (0, import_react3.useId)(), contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_contexts.ParentSheetContext.Provider, {
17816
+ var forcedContentHeight = hasFit ? void 0 : snapPointsMode === "percent" ? `${maxSnapPoint}${import_constants4.isWeb ? "dvh" : "%"}` : maxSnapPoint, contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_contexts.ParentSheetContext.Provider, {
17815
17817
  value: nextParentContext,
17816
17818
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_SheetContext.SheetProvider, {
17817
17819
  ...providerProps,
@@ -17840,7 +17842,7 @@ var require_SheetImplementationCustom_native = __commonJS({
17840
17842
  onLayout: handleAnimationViewLayout,
17841
17843
  ...!isDragging && {
17842
17844
  // @ts-ignore for CSS driver this is necessary to attach the transition
17843
- animation
17845
+ animation: disableAnimation ? null : animation
17844
17846
  },
17845
17847
  // @ts-ignore
17846
17848
  disableClassName: !0,