fix: support generic font families on Apple platforms - #2997
Draft
wanxiankai wants to merge 1 commit into
Draft
Conversation
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.
Summary
Closes #2976.
This fixes generic CSS font family names on Apple platforms. Previously, values like
fontFamily="serif"were passed directly to React Native'sRCTFonthelper.RCTFontdoes not resolve CSS generic family keywords such asserif, 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->Georgiasans-serif->Systemmonospace->Menlocursive->Snell Roundhandfantasy->PapyrusI 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)?
Test2976.fontFamily="serif"renders with a serif font instead of falling back to the default system font.Compatibility
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
README.md__tests__folder