tamagui 1.138.3 → 1.138.4

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.
Files changed (3) hide show
  1. package/dist/native.cjs +61 -33
  2. package/dist/test.cjs +61 -33
  3. package/package.json +55 -55
package/dist/native.cjs CHANGED
@@ -3115,12 +3115,12 @@ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), resolveTokensAndVar
3115
3115
  for (var _key in value) {
3116
3116
  var subKey = conf2.shorthands[_key] || _key, val = value[_key];
3117
3117
  if (!(!styleProps2.noSkip && subKey in skipProps)) {
3118
+ if (staticConfig) {
3119
+ var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
3120
+ contextProps && subKey in contextProps && (styleState.overriddenContextProps || (styleState.overriddenContextProps = {}), styleState.overriddenContextProps[subKey] = val);
3121
+ }
3118
3122
  if (styleProps2.noExpand) res[subKey] = val;
3119
3123
  else if (variants2 && subKey in variants2) {
3120
- if (staticConfig) {
3121
- var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
3122
- contextProps && subKey in contextProps && (styleState.resolvedContextVariants || (styleState.resolvedContextVariants = {}), styleState.resolvedContextVariants[subKey] = val);
3123
- }
3124
3124
  if (parentVariantKey && parentVariantKey === key) res[subKey] = // SYNC WITH *1
3125
3125
  val[0] === "$" ? getTokenForKey(subKey, val, styleProps2, styleState) : val;
3126
3126
  else {
@@ -3544,6 +3544,10 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
3544
3544
  (_styleState2 = styleState).style || (_styleState2.style = {}), Object.assign(styleState.style, normalizeStyle(style));
3545
3545
  }
3546
3546
  }
3547
+ if (viewProps.tabIndex === 0) {
3548
+ var _viewProps1, _accessible1;
3549
+ (_accessible1 = (_viewProps1 = viewProps).accessible) !== null && _accessible1 !== void 0 || (_viewProps1.accessible = true);
3550
+ }
3547
3551
  var style1 = styleState.style;
3548
3552
  if (style1 == null ? void 0 : style1.fontFamily) {
3549
3553
  var _getFont, faceInfo = (_getFont = getFont(style1.fontFamily)) === null || _getFont === void 0 ? void 0 : _getFont.face;
@@ -3564,7 +3568,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
3564
3568
  dynamicThemeAccess,
3565
3569
  pseudoGroups,
3566
3570
  mediaGroups,
3567
- resolvedContextVariants: styleState.resolvedContextVariants
3571
+ overriddenContextProps: styleState.overriddenContextProps
3568
3572
  }, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
3569
3573
  if (!styleProps2.noMergeStyle && !asChildExceptStyleLike) {
3570
3574
  var style2 = styleState.style;
@@ -3582,26 +3586,33 @@ function mergeFlatTransforms(target, flatTransforms) {
3582
3586
  });
3583
3587
  }
3584
3588
  function mergeStyle(styleState, key, val, importance) {
3585
- var {
3589
+ var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, {
3586
3590
  viewProps,
3587
3591
  styleProps: styleProps2,
3588
3592
  staticConfig,
3589
3593
  usedKeys
3590
3594
  } = styleState, existingImportance = usedKeys[key] || 0;
3591
- if (!(existingImportance > importance)) if (key in stylePropsTransform) {
3592
- var _styleState;
3593
- (_styleState = styleState).flatTransforms || (_styleState.flatTransforms = {}), usedKeys[key] = importance, styleState.flatTransforms[key] = val;
3594
- } else {
3595
- var shouldNormalize = isWeb, out = shouldNormalize ? normalizeValueWithProperty$1(val) : val;
3596
- if (
3597
- // accept is for props not styles
3598
- staticConfig.accept && key in staticConfig.accept
3599
- ) viewProps[key] = out;
3600
- else {
3595
+ if (!(existingImportance > importance)) {
3596
+ var contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
3597
+ if (contextProps && key in contextProps) {
3598
+ var _styleState;
3599
+ (_styleState = styleState).overriddenContextProps || (_styleState.overriddenContextProps = {}), styleState.overriddenContextProps[key] = val;
3600
+ }
3601
+ if (key in stylePropsTransform) {
3601
3602
  var _styleState1;
3602
- (_styleState1 = styleState).style || (_styleState1.style = {}), usedKeys[key] = importance, styleState.style[key] = // if you dont do this you'll be passing props.transform arrays directly here and then mutating them
3603
- // if theres any flatTransforms later, causing issues (mutating props is bad, in strict mode styles get borked)
3604
- key === "transform" && Array.isArray(out) ? [...out] : out;
3603
+ (_styleState1 = styleState).flatTransforms || (_styleState1.flatTransforms = {}), usedKeys[key] = importance, styleState.flatTransforms[key] = val;
3604
+ } else {
3605
+ var shouldNormalize = isWeb, out = shouldNormalize ? normalizeValueWithProperty$1(val) : val;
3606
+ if (
3607
+ // accept is for props not styles
3608
+ staticConfig.accept && key in staticConfig.accept
3609
+ ) viewProps[key] = out;
3610
+ else {
3611
+ var _styleState2;
3612
+ (_styleState2 = styleState).style || (_styleState2.style = {}), usedKeys[key] = importance, styleState.style[key] = // if you dont do this you'll be passing props.transform arrays directly here and then mutating them
3613
+ // if theres any flatTransforms later, causing issues (mutating props is bad, in strict mode styles get borked)
3614
+ key === "transform" && Array.isArray(out) ? [...out] : out;
3615
+ }
3605
3616
  }
3606
3617
  }
3607
3618
  }
@@ -4120,11 +4131,11 @@ function createComponent(staticConfig) {
4120
4131
  styledContext: styledContextValue
4121
4132
  }, themeName = (themeState == null ? void 0 : themeState.name) || "";
4122
4133
  var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps2, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, contextForOverride = staticConfig.context;
4123
- if (splitStyles == null ? void 0 : splitStyles.resolvedContextVariants) {
4124
- var _staticConfig_parentStaticConfig, contextForVariants = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
4125
- if (contextForVariants) {
4126
- for (var key in splitStyles.resolvedContextVariants) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.resolvedContextVariants[key];
4127
- staticConfig.context || (contextForOverride = contextForVariants);
4134
+ if (splitStyles == null ? void 0 : splitStyles.overriddenContextProps) {
4135
+ var _staticConfig_parentStaticConfig, contextForProps = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
4136
+ if (contextForProps) {
4137
+ for (var key in splitStyles.overriddenContextProps) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.overriddenContextProps[key];
4138
+ staticConfig.context || (contextForOverride = contextForProps);
4128
4139
  }
4129
4140
  }
4130
4141
  var groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
@@ -9855,11 +9866,18 @@ var hiddenSize = 10000.1, relativeDimensionTo = "screen", SheetImplementationCus
9855
9866
  })(), [isShowingInnerSheet, setIsShowingInnerSheet] = React.useState(false), shouldHideParentSheet = modal && isShowingInnerSheet && // if not using weird portal limitation we dont need to hide parent sheet
9856
9867
  USE_NATIVE_PORTAL, sheetInsideSheet = React.useContext(SheetInsideSheetContext), onInnerSheet = React.useCallback(function(hasChild) {
9857
9868
  setIsShowingInnerSheet(hasChild);
9858
- }, []), positions = React.useMemo(function() {
9869
+ }, []), stableFrameSize = React.useRef(frameSize);
9870
+ React.useEffect(function() {
9871
+ open2 && frameSize && (stableFrameSize.current = frameSize);
9872
+ }, [open2, frameSize]);
9873
+ var positions = React.useMemo(function() {
9859
9874
  return snapPoints.map(function(point) {
9860
- return getYPositions(snapPointsMode, point, screenSize, frameSize);
9875
+ return (
9876
+ // FIX: Use stable frameSize when closing to prevent position jumps
9877
+ getYPositions(snapPointsMode, point, screenSize, open2 ? frameSize : stableFrameSize.current)
9878
+ );
9861
9879
  });
9862
- }, [screenSize, frameSize, snapPoints, snapPointsMode]), {
9880
+ }, [screenSize, frameSize, snapPoints, snapPointsMode, open2]), {
9863
9881
  useAnimatedNumber,
9864
9882
  useAnimatedNumberStyle,
9865
9883
  useAnimatedNumberReaction
@@ -9974,9 +9992,12 @@ var hiddenSize = 10000.1, relativeDimensionTo = "screen", SheetImplementationCus
9974
9992
  onPanResponderRelease: finish
9975
9993
  });
9976
9994
  }, [disableDrag, isShowingInnerSheet, animateTo, frameSize, positions, setPosition]), handleAnimationViewLayout = React.useCallback(function(e2) {
9977
- var _e_nativeEvent, next = Math.min((_e_nativeEvent = e2.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, Dimensions.get(relativeDimensionTo).height);
9978
- next && setFrameSize(next);
9979
- }, []), handleMaxContentViewLayout = React.useCallback(function(e2) {
9995
+ var _e_nativeEvent;
9996
+ if (!(!open2 && stableFrameSize.current !== 0)) {
9997
+ var next = Math.min((_e_nativeEvent = e2.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, Dimensions.get(relativeDimensionTo).height);
9998
+ next && setFrameSize(next);
9999
+ }
10000
+ }, [open2]), handleMaxContentViewLayout = React.useCallback(function(e2) {
9980
10001
  var _e_nativeEvent, next = Math.min((_e_nativeEvent = e2.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, Dimensions.get(relativeDimensionTo).height);
9981
10002
  next && setMaxContentSize(next);
9982
10003
  }, []), animatedStyle = useAnimatedNumberStyle(animatedNumber, function(val) {
@@ -10324,13 +10345,18 @@ function createSheet(param) {
10324
10345
  frameSize,
10325
10346
  contentRef,
10326
10347
  open: open2
10327
- } = context2, composedContentRef = useComposedRefs(forwardedRef, contentRef), offscreenSize = useSheetOffscreenSize(context2), sheetContents = React.useMemo(function() {
10348
+ } = context2, composedContentRef = useComposedRefs(forwardedRef, contentRef), offscreenSize = useSheetOffscreenSize(context2), stableFrameSize = React.useRef(frameSize);
10349
+ React.useEffect(function() {
10350
+ open2 && frameSize && (stableFrameSize.current = frameSize);
10351
+ }, [open2, frameSize]);
10352
+ var sheetContents = React.useMemo(function() {
10353
+ var shouldUseFixedHeight = hasFit && !open2 && stableFrameSize.current;
10328
10354
  return (
10329
10355
  // @ts-expect-error
10330
10356
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Frame2, __spreadProps(__spreadValues({
10331
10357
  ref: composedContentRef,
10332
- flex: hasFit ? 0 : 1,
10333
- height: hasFit ? void 0 : frameSize,
10358
+ flex: hasFit && open2 ? 0 : 1,
10359
+ height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
10334
10360
  pointerEvents: open2 ? "auto" : "none"
10335
10361
  }, props), {
10336
10362
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(StackZIndexContext, {
@@ -11374,6 +11400,8 @@ var ButtonContext = createStyledContext({
11374
11400
  context: ButtonContext,
11375
11401
  role: "button",
11376
11402
  focusable: true,
11403
+ // forces runtime pressStyle so it passes through context text colors
11404
+ disableClassName: true,
11377
11405
  variants: {
11378
11406
  unstyled: {
11379
11407
  false: {
package/dist/test.cjs CHANGED
@@ -3356,12 +3356,12 @@ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), resolveTokensAndVar
3356
3356
  for (var _key in value) {
3357
3357
  var subKey = conf2.shorthands[_key] || _key, val = value[_key];
3358
3358
  if (!(!styleProps2.noSkip && subKey in skipProps)) {
3359
+ if (staticConfig) {
3360
+ var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
3361
+ contextProps && subKey in contextProps && (styleState.overriddenContextProps || (styleState.overriddenContextProps = {}), styleState.overriddenContextProps[subKey] = val);
3362
+ }
3359
3363
  if (styleProps2.noExpand) res[subKey] = val;
3360
3364
  else if (variants2 && subKey in variants2) {
3361
- if (staticConfig) {
3362
- var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
3363
- contextProps && subKey in contextProps && (styleState.resolvedContextVariants || (styleState.resolvedContextVariants = {}), styleState.resolvedContextVariants[subKey] = val);
3364
- }
3365
3365
  if (parentVariantKey && parentVariantKey === key) res[subKey] = // SYNC WITH *1
3366
3366
  val[0] === "$" ? getTokenForKey(subKey, val, styleProps2, styleState) : val;
3367
3367
  else {
@@ -3786,6 +3786,10 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
3786
3786
  (_styleState2 = styleState).style || (_styleState2.style = {}), Object.assign(styleState.style, normalizeStyle(style));
3787
3787
  }
3788
3788
  }
3789
+ if (viewProps.tabIndex === 0) {
3790
+ var _viewProps1, _accessible1;
3791
+ (_accessible1 = (_viewProps1 = viewProps).accessible) !== null && _accessible1 !== void 0 || (_viewProps1.accessible = true);
3792
+ }
3789
3793
  var style1 = styleState.style;
3790
3794
  if (style1 == null ? void 0 : style1.fontFamily) {
3791
3795
  var _getFont, faceInfo = (_getFont = getFont(style1.fontFamily)) === null || _getFont === void 0 ? void 0 : _getFont.face;
@@ -3806,7 +3810,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
3806
3810
  dynamicThemeAccess,
3807
3811
  pseudoGroups,
3808
3812
  mediaGroups,
3809
- resolvedContextVariants: styleState.resolvedContextVariants
3813
+ overriddenContextProps: styleState.overriddenContextProps
3810
3814
  }, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
3811
3815
  if (!styleProps2.noMergeStyle && !asChildExceptStyleLike) {
3812
3816
  var style2 = styleState.style;
@@ -3824,26 +3828,33 @@ function mergeFlatTransforms(target, flatTransforms) {
3824
3828
  });
3825
3829
  }
3826
3830
  function mergeStyle(styleState, key, val, importance) {
3827
- var {
3831
+ var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, {
3828
3832
  viewProps,
3829
3833
  styleProps: styleProps2,
3830
3834
  staticConfig,
3831
3835
  usedKeys
3832
3836
  } = styleState, existingImportance = usedKeys[key] || 0;
3833
- if (!(existingImportance > importance)) if (key in stylePropsTransform) {
3834
- var _styleState;
3835
- (_styleState = styleState).flatTransforms || (_styleState.flatTransforms = {}), usedKeys[key] = importance, styleState.flatTransforms[key] = val;
3836
- } else {
3837
- var shouldNormalize = isWeb, out = shouldNormalize ? normalizeValueWithProperty$1(val) : val;
3838
- if (
3839
- // accept is for props not styles
3840
- staticConfig.accept && key in staticConfig.accept
3841
- ) viewProps[key] = out;
3842
- else {
3837
+ if (!(existingImportance > importance)) {
3838
+ var contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
3839
+ if (contextProps && key in contextProps) {
3840
+ var _styleState;
3841
+ (_styleState = styleState).overriddenContextProps || (_styleState.overriddenContextProps = {}), styleState.overriddenContextProps[key] = val;
3842
+ }
3843
+ if (key in stylePropsTransform) {
3843
3844
  var _styleState1;
3844
- (_styleState1 = styleState).style || (_styleState1.style = {}), usedKeys[key] = importance, styleState.style[key] = // if you dont do this you'll be passing props.transform arrays directly here and then mutating them
3845
- // if theres any flatTransforms later, causing issues (mutating props is bad, in strict mode styles get borked)
3846
- key === "transform" && Array.isArray(out) ? [...out] : out;
3845
+ (_styleState1 = styleState).flatTransforms || (_styleState1.flatTransforms = {}), usedKeys[key] = importance, styleState.flatTransforms[key] = val;
3846
+ } else {
3847
+ var shouldNormalize = isWeb, out = shouldNormalize ? normalizeValueWithProperty$1(val) : val;
3848
+ if (
3849
+ // accept is for props not styles
3850
+ staticConfig.accept && key in staticConfig.accept
3851
+ ) viewProps[key] = out;
3852
+ else {
3853
+ var _styleState2;
3854
+ (_styleState2 = styleState).style || (_styleState2.style = {}), usedKeys[key] = importance, styleState.style[key] = // if you dont do this you'll be passing props.transform arrays directly here and then mutating them
3855
+ // if theres any flatTransforms later, causing issues (mutating props is bad, in strict mode styles get borked)
3856
+ key === "transform" && Array.isArray(out) ? [...out] : out;
3857
+ }
3847
3858
  }
3848
3859
  }
3849
3860
  }
@@ -4366,11 +4377,11 @@ function createComponent(staticConfig) {
4366
4377
  styledContext: styledContextValue
4367
4378
  }, themeName = (themeState == null ? void 0 : themeState.name) || "";
4368
4379
  var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps2, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, contextForOverride = staticConfig.context;
4369
- if (splitStyles == null ? void 0 : splitStyles.resolvedContextVariants) {
4370
- var _staticConfig_parentStaticConfig, contextForVariants = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
4371
- if (contextForVariants) {
4372
- for (var key in splitStyles.resolvedContextVariants) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.resolvedContextVariants[key];
4373
- staticConfig.context || (contextForOverride = contextForVariants);
4380
+ if (splitStyles == null ? void 0 : splitStyles.overriddenContextProps) {
4381
+ var _staticConfig_parentStaticConfig, contextForProps = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
4382
+ if (contextForProps) {
4383
+ for (var key in splitStyles.overriddenContextProps) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.overriddenContextProps[key];
4384
+ staticConfig.context || (contextForOverride = contextForProps);
4374
4385
  }
4375
4386
  }
4376
4387
  var groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
@@ -10003,11 +10014,18 @@ var hiddenSize = 10000.1, relativeDimensionTo = "screen", SheetImplementationCus
10003
10014
  })(), [isShowingInnerSheet, setIsShowingInnerSheet] = React.useState(false), shouldHideParentSheet = modal && isShowingInnerSheet && // if not using weird portal limitation we dont need to hide parent sheet
10004
10015
  USE_NATIVE_PORTAL, sheetInsideSheet = React.useContext(SheetInsideSheetContext), onInnerSheet = React.useCallback(function(hasChild) {
10005
10016
  setIsShowingInnerSheet(hasChild);
10006
- }, []), positions = React.useMemo(function() {
10017
+ }, []), stableFrameSize = React.useRef(frameSize);
10018
+ React.useEffect(function() {
10019
+ open2 && frameSize && (stableFrameSize.current = frameSize);
10020
+ }, [open2, frameSize]);
10021
+ var positions = React.useMemo(function() {
10007
10022
  return snapPoints.map(function(point) {
10008
- return getYPositions(snapPointsMode, point, screenSize, frameSize);
10023
+ return (
10024
+ // FIX: Use stable frameSize when closing to prevent position jumps
10025
+ getYPositions(snapPointsMode, point, screenSize, open2 ? frameSize : stableFrameSize.current)
10026
+ );
10009
10027
  });
10010
- }, [screenSize, frameSize, snapPoints, snapPointsMode]), {
10028
+ }, [screenSize, frameSize, snapPoints, snapPointsMode, open2]), {
10011
10029
  useAnimatedNumber,
10012
10030
  useAnimatedNumberStyle,
10013
10031
  useAnimatedNumberReaction
@@ -10122,9 +10140,12 @@ var hiddenSize = 10000.1, relativeDimensionTo = "screen", SheetImplementationCus
10122
10140
  onPanResponderRelease: finish
10123
10141
  });
10124
10142
  }, [disableDrag, isShowingInnerSheet, animateTo, frameSize, positions, setPosition]), handleAnimationViewLayout = React.useCallback(function(e2) {
10125
- var _e_nativeEvent, next = Math.min((_e_nativeEvent = e2.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, Dimensions.get(relativeDimensionTo).height);
10126
- next && setFrameSize(next);
10127
- }, []), handleMaxContentViewLayout = React.useCallback(function(e2) {
10143
+ var _e_nativeEvent;
10144
+ if (!(!open2 && stableFrameSize.current !== 0)) {
10145
+ var next = Math.min((_e_nativeEvent = e2.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, Dimensions.get(relativeDimensionTo).height);
10146
+ next && setFrameSize(next);
10147
+ }
10148
+ }, [open2]), handleMaxContentViewLayout = React.useCallback(function(e2) {
10128
10149
  var _e_nativeEvent, next = Math.min((_e_nativeEvent = e2.nativeEvent) === null || _e_nativeEvent === void 0 ? void 0 : _e_nativeEvent.layout.height, Dimensions.get(relativeDimensionTo).height);
10129
10150
  next && setMaxContentSize(next);
10130
10151
  }, []), animatedStyle = useAnimatedNumberStyle(animatedNumber, function(val) {
@@ -10472,13 +10493,18 @@ function createSheet(param) {
10472
10493
  frameSize,
10473
10494
  contentRef,
10474
10495
  open: open2
10475
- } = context2, composedContentRef = useComposedRefs(forwardedRef, contentRef), offscreenSize = useSheetOffscreenSize(context2), sheetContents = React.useMemo(function() {
10496
+ } = context2, composedContentRef = useComposedRefs(forwardedRef, contentRef), offscreenSize = useSheetOffscreenSize(context2), stableFrameSize = React.useRef(frameSize);
10497
+ React.useEffect(function() {
10498
+ open2 && frameSize && (stableFrameSize.current = frameSize);
10499
+ }, [open2, frameSize]);
10500
+ var sheetContents = React.useMemo(function() {
10501
+ var shouldUseFixedHeight = hasFit && !open2 && stableFrameSize.current;
10476
10502
  return (
10477
10503
  // @ts-expect-error
10478
10504
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Frame2, __spreadProps(__spreadValues({
10479
10505
  ref: composedContentRef,
10480
- flex: hasFit ? 0 : 1,
10481
- height: hasFit ? void 0 : frameSize,
10506
+ flex: hasFit && open2 ? 0 : 1,
10507
+ height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
10482
10508
  pointerEvents: open2 ? "auto" : "none"
10483
10509
  }, props), {
10484
10510
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(StackZIndexContext, {
@@ -11522,6 +11548,8 @@ var ButtonContext = createStyledContext({
11522
11548
  context: ButtonContext,
11523
11549
  role: "button",
11524
11550
  focusable: true,
11551
+ // forces runtime pressStyle so it passes through context text colors
11552
+ disableClassName: true,
11525
11553
  variants: {
11526
11554
  unstyled: {
11527
11555
  false: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamagui",
3
- "version": "1.138.3",
3
+ "version": "1.138.4",
4
4
  "type": "module",
5
5
  "description": "Style and UI for React (web and native) meet an optimizing compiler",
6
6
  "removeSideEffects": true,
@@ -81,62 +81,62 @@
81
81
  }
82
82
  },
83
83
  "dependencies": {
84
- "@tamagui/accordion": "1.138.3",
85
- "@tamagui/adapt": "1.138.3",
86
- "@tamagui/alert-dialog": "1.138.3",
87
- "@tamagui/animate-presence": "1.138.3",
88
- "@tamagui/avatar": "1.138.3",
89
- "@tamagui/button": "1.138.3",
90
- "@tamagui/card": "1.138.3",
91
- "@tamagui/checkbox": "1.138.3",
92
- "@tamagui/compose-refs": "1.138.3",
93
- "@tamagui/constants": "1.138.3",
94
- "@tamagui/core": "1.138.3",
95
- "@tamagui/create-context": "1.138.3",
96
- "@tamagui/dialog": "1.138.3",
97
- "@tamagui/elements": "1.138.3",
98
- "@tamagui/fake-react-native": "1.138.3",
99
- "@tamagui/focusable": "1.138.3",
100
- "@tamagui/font-size": "1.138.3",
101
- "@tamagui/form": "1.138.3",
102
- "@tamagui/get-button-sized": "1.138.3",
103
- "@tamagui/get-font-sized": "1.138.3",
104
- "@tamagui/get-token": "1.138.3",
105
- "@tamagui/group": "1.138.3",
106
- "@tamagui/helpers-tamagui": "1.138.3",
107
- "@tamagui/image": "1.138.3",
108
- "@tamagui/label": "1.138.3",
109
- "@tamagui/linear-gradient": "1.138.3",
110
- "@tamagui/list-item": "1.138.3",
111
- "@tamagui/polyfill-dev": "1.138.3",
112
- "@tamagui/popover": "1.138.3",
113
- "@tamagui/popper": "1.138.3",
114
- "@tamagui/portal": "1.138.3",
115
- "@tamagui/progress": "1.138.3",
116
- "@tamagui/radio-group": "1.138.3",
117
- "@tamagui/react-native-media-driver": "1.138.3",
118
- "@tamagui/scroll-view": "1.138.3",
119
- "@tamagui/select": "1.138.3",
120
- "@tamagui/separator": "1.138.3",
121
- "@tamagui/shapes": "1.138.3",
122
- "@tamagui/sheet": "1.138.3",
123
- "@tamagui/slider": "1.138.3",
124
- "@tamagui/stacks": "1.138.3",
125
- "@tamagui/switch": "1.138.3",
126
- "@tamagui/tabs": "1.138.3",
127
- "@tamagui/text": "1.138.3",
128
- "@tamagui/theme": "1.138.3",
129
- "@tamagui/toggle-group": "1.138.3",
130
- "@tamagui/tooltip": "1.138.3",
131
- "@tamagui/use-controllable-state": "1.138.3",
132
- "@tamagui/use-debounce": "1.138.3",
133
- "@tamagui/use-force-update": "1.138.3",
134
- "@tamagui/use-window-dimensions": "1.138.3",
135
- "@tamagui/visually-hidden": "1.138.3",
136
- "@tamagui/z-index-stack": "1.138.3"
84
+ "@tamagui/accordion": "1.138.4",
85
+ "@tamagui/adapt": "1.138.4",
86
+ "@tamagui/alert-dialog": "1.138.4",
87
+ "@tamagui/animate-presence": "1.138.4",
88
+ "@tamagui/avatar": "1.138.4",
89
+ "@tamagui/button": "1.138.4",
90
+ "@tamagui/card": "1.138.4",
91
+ "@tamagui/checkbox": "1.138.4",
92
+ "@tamagui/compose-refs": "1.138.4",
93
+ "@tamagui/constants": "1.138.4",
94
+ "@tamagui/core": "1.138.4",
95
+ "@tamagui/create-context": "1.138.4",
96
+ "@tamagui/dialog": "1.138.4",
97
+ "@tamagui/elements": "1.138.4",
98
+ "@tamagui/fake-react-native": "1.138.4",
99
+ "@tamagui/focusable": "1.138.4",
100
+ "@tamagui/font-size": "1.138.4",
101
+ "@tamagui/form": "1.138.4",
102
+ "@tamagui/get-button-sized": "1.138.4",
103
+ "@tamagui/get-font-sized": "1.138.4",
104
+ "@tamagui/get-token": "1.138.4",
105
+ "@tamagui/group": "1.138.4",
106
+ "@tamagui/helpers-tamagui": "1.138.4",
107
+ "@tamagui/image": "1.138.4",
108
+ "@tamagui/label": "1.138.4",
109
+ "@tamagui/linear-gradient": "1.138.4",
110
+ "@tamagui/list-item": "1.138.4",
111
+ "@tamagui/polyfill-dev": "1.138.4",
112
+ "@tamagui/popover": "1.138.4",
113
+ "@tamagui/popper": "1.138.4",
114
+ "@tamagui/portal": "1.138.4",
115
+ "@tamagui/progress": "1.138.4",
116
+ "@tamagui/radio-group": "1.138.4",
117
+ "@tamagui/react-native-media-driver": "1.138.4",
118
+ "@tamagui/scroll-view": "1.138.4",
119
+ "@tamagui/select": "1.138.4",
120
+ "@tamagui/separator": "1.138.4",
121
+ "@tamagui/shapes": "1.138.4",
122
+ "@tamagui/sheet": "1.138.4",
123
+ "@tamagui/slider": "1.138.4",
124
+ "@tamagui/stacks": "1.138.4",
125
+ "@tamagui/switch": "1.138.4",
126
+ "@tamagui/tabs": "1.138.4",
127
+ "@tamagui/text": "1.138.4",
128
+ "@tamagui/theme": "1.138.4",
129
+ "@tamagui/toggle-group": "1.138.4",
130
+ "@tamagui/tooltip": "1.138.4",
131
+ "@tamagui/use-controllable-state": "1.138.4",
132
+ "@tamagui/use-debounce": "1.138.4",
133
+ "@tamagui/use-force-update": "1.138.4",
134
+ "@tamagui/use-window-dimensions": "1.138.4",
135
+ "@tamagui/visually-hidden": "1.138.4",
136
+ "@tamagui/z-index-stack": "1.138.4"
137
137
  },
138
138
  "devDependencies": {
139
- "@tamagui/build": "1.138.3",
139
+ "@tamagui/build": "1.138.4",
140
140
  "react": "*",
141
141
  "react-native": "0.81.5",
142
142
  "react-native-web": "^0.21.0"