Skip to content

fix(native): measure inline-size and block-size container queries - #480

Merged
danstepanov merged 1 commit into
nativewind:mainfrom
YevheniiKotyrlo:fix/container-logical-sizes
Dec 4, 2026
Merged

danstepanov merged 1 commit into
nativewind:mainfrom
YevheniiKotyrlo:fix/container-logical-sizes

Conversation

@YevheniiKotyrlo

@YevheniiKotyrlo YevheniiKotyrlo commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On main, getContainerFeatureValue answers undefined for inline-size and block-size, so @container (min-inline-size: 400px) matches nothing at any size, though inline-size is the axis container-type: inline-size names.

Solution

React Native lays out in one writing mode, so the inline axis is the width and the block axis is the height.

Tests

src/__tests__/native/container-logical-sizes.test.tsx checks min-inline-size and min-block-size at 39, 40 and 41px on a non-square container, the way container-boundaries.test.tsx checks width and height. Both cases fail on main.

Verification

Every ci.yml job but the iOS build, on Ubuntu with Node 22.18.0: green, with yarn test at 1337 passed.

Split out of #425.

#426 also rewrites src/native/conditions/container-query.ts and leaves inline-size and block-size to this one; whichever lands second rebases.

Device evidence, before and after: #480 (comment)

@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor Author

Device evidence — before / after

UNFIXED — Only the control paints. The runtime answers neither inline-size nor block-size, so both subjects stay outlines.

FIXED — All three bars paint. React Native lays out in one writing mode, so the inline size is the width and the block size the height.

before — 3.1.0-rc.0 after — with this PR

Android 16 emulator (API 36, GLES on the host GPU), 1140×2400 @ 480dpi, both frames from one run. before is the published 3.1.0-rc.0 plus what my test app needs from my other patches to run: the native and native-internal subpath exports, PR 459, cascade-layer ranking, and a shim that compiles a class-qualified :root inert. after adds the rest of my open PRs, this one included. One of them shows on every screen: PR 417 narrows a var()-valued font-family to one family, so the after sets its text in the theme's face where the before falls back to the platform's.

@sammoore sammoore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM

getContainerFeatureValue answered undefined for both logical size
features, so @container (min-inline-size: 400px) matched nothing at any
size, on the axis container-type: inline-size names. React Native lays
out in one writing mode, so the inline axis is the width and the block
axis the height.
@danstepanov
danstepanov force-pushed the fix/container-logical-sizes branch from d1f93f7 to a19fd6e Compare December 4, 2026 03:15
@danstepanov
danstepanov merged commit f4d18b0 into nativewind:main Dec 4, 2026
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.

3 participants