Repository navigation
fix(compiler): compile padding-block/-inline to paddingVertical/Horizontal - #580
Merged
danstepanov merged 1 commit intoNov 20, 2026
Merged
Conversation
…ical/paddingHorizontal Android's Fabric TextInput applies its EditText theme padding (about 21dp) to every edge it finds no padding for, and it only checks padding, paddingVertical/paddingHorizontal and the single sides. React Native maps paddingBlock and paddingInline to the same Yoga edges as paddingVertical and paddingHorizontal, but that check doesn't see them. So a Tailwind py-*/px-* TextInput kept the theme padding. Renaming the keys at compile time fixes literal and var() values alike (propertyRename covers the unparsed path), costs nothing at runtime, and renders the same as before on every other component. Nativewind v4 rendered physical keys for py-*/px-*, so this fixes a v4 regression. Diagnosed in nativewind#400, which expanded the keys at runtime instead. Co-authored-by: Daewoon Kim <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
sammoore
force-pushed
the
fix/logical-padding-compile
branch
from
November 20, 2026 22:53
39e9501 to
58232af
Compare
danstepanov
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #400. Thanks to @kdwkr for the diagnosis and the device measurements.
Problem
Tailwind v4 compiles
py-*/px-*topadding-block/padding-inline, and we passed those through aspaddingBlock/paddingInline. On Android, Fabric'sTextInputapplies its EditText theme padding (about 21dp) to every edge it finds no padding for, and that check (AndroidTextInputComponentDescriptor::adopt) only readspadding,paddingVertical/paddingHorizontaland the single sides. It doesn't seepaddingBlock/paddingInline, so the theme padding wins. #400 measured apy-2input at 42.67dp on a real device, where it should be 35.81dp.Solution
React Native maps
paddingBlockto Yoga's Vertical edge andpaddingInlineto its Horizontal edge, the same edges aspaddingVerticalandpaddingHorizontal. So the compiler now emits those keys for a one-valuepadding-block/padding-inline:propertyRename, which covers values withvar()(Tailwind'scalc(var(--spacing) * 2)when the theme is kept at runtime)parsePaddingBlock/parsePaddingInline, for literal valuesTwo-value forms still emit
paddingBlockStart/EndandpaddingInlineStart/End.Why at compile time
#400 expanded the keys in
getStyledPropson every render. Doing it in the compiler instead:declarations.ts)styleAn inline
style={{ paddingBlock }}that the app passes itself still reaches TextInput unchanged. Plain React Native behaves the same, so that's left to React Native.Impact
py-*/px-*gets the new key names. On aView, every class paints the same edges as before, and nothing fails React Native's validators.native/logical-padding.test.tsxcovers literal,var()andcalc(var())values, with variables both inlined and kept at runtime. 8 of its 10 cases fail onmain.spacingand@applywere updated for the new keys.Possible follow-up, not in this PR:
ps-*/pe-*emitpaddingInlineStart/End, which the same TextInput check doesn't read either. v4 emittedpaddingStart/paddingEnd. Not verified on a device.