Skip to content

fix(ios): measure padded LiquidGlass content inside its padding - #11562

Merged
NathanWalker merged 2 commits into
NativeScript:mainfrom
aleclarson:fix/liquid-glass-padding-measure
Oct 21, 2026
Merged

NathanWalker merged 2 commits into
NativeScript:mainfrom
aleclarson:fix/liquid-glass-padding-measure

Conversation

@aleclarson

@aleclarson aleclarson commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

On iOS, LiquidGlass and LiquidGlassContainer override onMeasure (added in #11134). The override sets their effective padding and border to zero while delegating to GridLayout/AbsoluteLayout. It assumes the parent already removed the child's padding from the measure spec, but no layout does that. View.measureChild subtracts only margins, and the iOS FlexboxLayout subtracts its own padding plus the child's margins.

The result:

  • A padded LiquidGlass measures its content at the full outer width. onLayout, which runs with the padding restored, then offsets the content by the leading padding, so it overflows and is clipped.
  • A padded LiquidGlassContainer with no set size comes out too small by its padding.

Fixes #11561.

What is the new behavior?

  • Both onMeasure overrides are removed, so measurement runs as plain GridLayout/AbsoluteLayout and includes the padding.
  • The onLayout normalization from fix(ios): liquid glass flexbox #11134 (laying out children in the _contentHost local coordinate space) is unchanged. testLiquidGlassFlexboxLayout, which uses no padding, still passes.

New tests in flexbox-layout-tests.ts:

  • testLiquidGlassFlexboxLayout_padding_measures_content_box: a 300 dip glass with 20 dip horizontal padding holds a stretched child. The child must be 260 dip wide and start 20 dip in.
  • testLiquidGlassContainerFlexboxLayout_padding_wraps_content: an auto-sized container with 20/10 dip padding around a 100×40 child must be 140×60 dip.

Verification (iOS 27.0 simulator, apps/automated with the run filtered to FLEXBOXLAYOUT):

  • On unmodified main: 97 OK, 2 failed. The two failures are the new tests.
  • With this change: 99 OK, 0 failed.
  • tsc -p packages/core/tsconfig.lib.json --noEmit is clean.

LiquidGlass and LiquidGlassContainer zeroed their padding and border while
measuring (NativeScript#11134), assuming the parent had already removed the child's
padding from the measure spec. No layout does that, so padded content was
measured at the full width and then offset by the padding in onLayout,
overflowing and clipping. Measure through GridLayout/AbsoluteLayout as-is
and keep the local-coordinate onLayout.

Closes NativeScript#11561
@nx-cloud

nx-cloud Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 48ba7fd

Command Status Duration Result
nx run-many -t build -p core,webpack5,vite ✅ Succeeded 21s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-21 03:33:30 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11562
npm i https://pkg.pr.new/@nativescript/vite@11562
npm i https://pkg.pr.new/@nativescript/webpack@11562

commit: 48ba7fd

@NathanWalker
NathanWalker merged commit 4e3ffd2 into NativeScript:main Oct 21, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LiquidGlass / LiquidGlassContainer (iOS): padded content measured at the outer width and overflows by the padding

2 participants