You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using adjustsFontSizeToFit on Fabric the behavior is different from the old renderer. The text will grow bigger than the current font size while on the old renderer it won't. The minimumFontScale is also not implemented. The code currently uses minimumFontSize and maximumFontSize but those props do not actually exist.
This brings the behavior closer to the old renderer by removing the wrong props and implementing minimumFontScale instead. From what I understand in the old renderer it would use the font size of the outermost text, but since we don't easily have access to that in Fabric I use the maximum font size of the attributed string.
Changelog:
[IOS] [FIXED] - Fix adjustsFontSizeToFit on iOS Fabric
Test Plan:
This adds some example of the different behavior in RNTester
You can see that on iOS fabric the line It doesn't grow grows bigger than its original font size
You can see that on iOS and Android fabric the line Can limit how small the text becomes with minimumFontScale does not respect the minimumFontScale.
Before
Old renderer iOS:
Old renderer Android
Fabric iOS:
Fabric Android
After
Fabric iOS:
Fabric Android:
facebook-github-bot
added
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Contributor
A React Native contributor.
Shared with Meta
Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
labels
Mar 19, 2024
Could you rebase on main and retest on a recent version?
Many things have changed since March... I'd also summon @NickGerleman which has far more context on text than myself.
@janicduplessis do you mind rebasing this PR? We can't import it the PR is not updated.
Or do you rather abandon this and open a new one, if that's ready?
Thanks for your work @janicduplessis. I've opened a partial replacement PR that attempts to address the issue of minimumFontScale not being respected on iOS when used with adjustsFontSizeToFit: #54072.
Sorry for the ping but it's been 10 months since the last update and I would appreciate if we could move forward with this PR or supersed this with another one.
We would also be grateful if this could be resolved 🙏
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
CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.ContributorA React Native contributor.Shared with MetaApplied via automation to indicate that an Issue or Pull Request has been shared with the team.
9 participants
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:
When using adjustsFontSizeToFit on Fabric the behavior is different from the old renderer. The text will grow bigger than the current font size while on the old renderer it won't. The
minimumFontScaleis also not implemented. The code currently usesminimumFontSizeandmaximumFontSizebut those props do not actually exist.This brings the behavior closer to the old renderer by removing the wrong props and implementing
minimumFontScaleinstead. From what I understand in the old renderer it would use the font size of the outermost text, but since we don't easily have access to that in Fabric I use the maximum font size of the attributed string.Changelog:
[IOS] [FIXED] - Fix adjustsFontSizeToFit on iOS Fabric
Test Plan:
This adds some example of the different behavior in RNTester
It doesn't growgrows bigger than its original font sizeCan limit how small the text becomes with minimumFontScaledoes not respect the minimumFontScale.Before
Old renderer iOS:
Old renderer Android
Fabric iOS:
Fabric Android
After
Fabric iOS:
Fabric Android: