Skip to content

fix: rename font-variant-caps to font-variant and parse font-variant#347

Open
5ZYSZ3K wants to merge 1 commit into
nativewind:mainfrom
5ZYSZ3K:main
Open

fix: rename font-variant-caps to font-variant and parse font-variant#347
5ZYSZ3K wants to merge 1 commit into
nativewind:mainfrom
5ZYSZ3K:main

Conversation

@5ZYSZ3K
Copy link
Copy Markdown

@5ZYSZ3K 5ZYSZ3K commented May 28, 2026

font-variant and font-variant-caps both were broken:

font-variant-caps was being parsed correctly by parseFontVariantCapsDeclaration, but it ended up as fontVariantCaps style, which is not correct, such a style doesn't exist in react-native. I added a rename for that.

To make font-variant work, I parsed it as a custom value (for some reason, it is treated as a custom value by lightningcss, and then treated it as fontVariantCaps)

Copilot AI review requested due to automatic review settings May 28, 2026 11:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds parsing support for font-variant(-caps) declarations by renaming font-variant-caps to font-variant and handling font-variant in the custom declaration parser.

Changes:

  • Map font-variant-caps to font-variant in propertyRename
  • Add font-variant parsing branch that validates values via parseFontVariantCaps before adding a descriptor

Comment on lines +1002 to +1009
const parsedFontVariant = parseFontVariantCaps(
parseUnparsed(
declaration.value.value,
builder,
property,
) as FontVariantCaps,
builder,
);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I followed what was already there in an else if statement above. declaration.value isn't even the correct type

Comment on lines +1002 to +1009
const parsedFontVariant = parseFontVariantCaps(
parseUnparsed(
declaration.value.value,
builder,
property,
) as FontVariantCaps,
builder,
);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I couldn't really think of a better solution here in this architecture - parseFontVariantCaps checks, if the value argument is the correct string, but it also expects that argument to be of FontVariantCaps type

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.

2 participants