fix: make useResolvedFontFamily consistent with documented setup for custom fonts #5756
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
This PR fixes an inconsistency between
useResolvedFontFamily
and the documentation & examples.To use a custom font, the documentation suggests that a property needs to be added to
theme.fontConfig
mapping all the font weights and styles to specific font files.The
useResolvedFontFamily
implementation, however, on line 23, suggests that a property also needs to be added totheme.fonts
which is inconsistent with the documentation.As documented, if I wanted to add
SF Pro Display
as a custom font, I would do:But nowhere does it suggest I need to update
fonts
, adding a property withSF Pro Display
as a key. Unless I were to do that, line 23 ofuseResolvedFontFamily
always evaluates tofalse
and this hook never properly does its job to map fonts to the correct value for Android and iOS.Changelog
General Fixed - Correct an inconsistency between useResolvedFontFamily and the documentation for using custom fonts
Test Plan