Skip to content

fix: support generic font families on Apple platforms - #2997

Draft
wanxiankai wants to merge 1 commit into
software-mansion:mainfrom
wanxiankai:fix/ios-generic-font-family
Draft

fix: support generic font families on Apple platforms#2997
wanxiankai wants to merge 1 commit into
software-mansion:mainfrom
wanxiankai:fix/ios-generic-font-family

Conversation

@wanxiankai

@wanxiankai wanxiankai commented Jul 12, 2026

Copy link
Copy Markdown

Summary

Closes #2976.

This fixes generic CSS font family names on Apple platforms. Previously, values like fontFamily="serif" were passed directly to React Native's RCTFont helper. RCTFont does not resolve CSS generic family keywords such as serif, so iOS reported the family as unrecognized and fell back to the default system sans-serif font.

The Apple text glyph path now resolves generic family keywords before calling RCTFont updateFont:

  • serif -> Georgia
  • sans-serif -> System
  • monospace -> Menlo
  • cursive -> Snell Roundhand
  • fantasy -> Papyrus

I also added a common test screen reproducing the issue with a default system text line and a fontFamily="serif" line.

Test Plan

Commands run locally:

  • yarn lint
  • yarn tsc
  • git diff --check

What's required for testing (prerequisites)?

An iOS simulator or device running the example app.

What are the steps to reproduce (after prerequisites)?

  1. Open the common test app.
  2. Render Test2976.
  3. Confirm the first SVG text line uses the default system sans-serif font.
  4. Confirm the second SVG text line with fontFamily="serif" renders with a serif font instead of falling back to the default system font.

Compatibility

OS Implemented
iOS
MacOS
Android
Web

Android and Web are not changed by this PR; the issue was reported for iOS and the fix is in the Apple text implementation.

Checklist

  • I have tested this on a device and a simulator
  • I added documentation in README.md
  • I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

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.

Generic Family fonts ignored on iOS

1 participant