Skip to content

Conversation

@SmartArray
Copy link

@SmartArray SmartArray commented Dec 19, 2025

Summary:

This change fixes a text rendering issue on iOS when using the new architecture (Fabric), most notably in app extensions on iOS.

While migrating an app extension to the new architecture, all the labels in our app became invisible. A bare <Text> component initially appeared to work, which made the issue hard to track down.

Text rendered correctly with default styles, but once fontSize or fontFamily was applied, text would ignore sizing or become invisible. Because text was still visible by default, the problem did not immediately appear to be related to font scaling or measurement, so it took me WEEKS to understand.
Please check out the issue I created almost a month ago: #54642

After deeper investigation into Fabric text measurement and after using 100 different breakpoint attempts, the root cause turned out to be an invalid font size multiplier coming from RCTFontSizeMultiplier() when running inside an app extension.

In app extensions, RCTSharedApplication() can (or will!) return nil. When that happened, RCTFontSizeMultiplier() could return an invalid value, which later caused Fabric text measurement to produce zero-height paragraphs. As a result, <Text> components could ignore fontSize or become invisible when fontFamily was set.

The fix makes RCTFontSizeMultiplier() app-extension-safe by returning a positive default (1.0) when UIApplication or the preferred content size category is unavailable, and by clamping invalid values.

Related issue:
#54642


Changelog:

[IOS] [FIXED] - Make RCTFontSizeMultiplier() app-extension-safe by adding a default fallback and clamping invalid values to a positive number, such that fonts are never scaled down to zero


Test Plan:

  • Reproduced the issue in an iOS app extension using Fabric
  • Observed <Text> rendering correctly by default but ignoring fontSize or becoming invisible when fontFamily was applied
  • Traced the issue through Fabric text measurement and font size multiplier handling
  • Applied the fix to RCTFontSizeMultiplier()
  • Verified that text renders correctly and respects fontSize
  • Confirmed no behavior change in a regular iOS app

To test this fix the repro that I provided in the issue above can easily be used.
First run the code without the commit (observe the bad outcome) then run it with the commit (observe the good outcome)

… so it returns a positive default (1.0) when UIApplication (or preferred content size category) is unavailable + clamp
@meta-cla
Copy link

meta-cla bot commented Dec 19, 2025

Hi @SmartArray!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@meta-cla
Copy link

meta-cla bot commented Dec 19, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 19, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants