-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
custom fontWeight numeric values for Text on Android (#25341)
Summary: I found that on Android we only support 2 fontWeight options, either **normal** or **bold**, even developer can set any numeric value. But iOS supports all possible numeric values. This PR tries to add support for all possible numeric values on Android, even if it's supported only on Android P(28) and above. This change might break texts where fontWeight use improperly, because this PR removes conversion of values above 500 to BOLD and below 500 to normal. FYI, also moved **mCustomTypefaceCache** usage up because it was working after unnecessary mFontCache usage. ## Changelog [Android] [Changed] - add custom font weight support to Text component on Android, only on P(API 28) and above versions. Pull Request resolved: #25341 Test Plan: RNTester app's Text examples will show Rubik Regular, Rubik Light, Rubik Bold, Rubik Medium and Rubik Medium Italic texts in corresponding font family, style and weights. Differential Revision: D15956350 Pulled By: mdvacca fbshipit-source-id: 61079d953c65fb34ab4497d44c22317912a5a616
- Loading branch information
1 parent
9ed6dc7
commit 3915c0f
Showing
14 changed files
with
70 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<font app:fontStyle="normal" app:fontWeight="300" app:font="@font/rubik_light"/> | ||
<font app:fontStyle="normal" app:fontWeight="400" app:font="@font/rubik_regular"/> | ||
<font app:fontStyle="normal" app:fontWeight="500" app:font="@font/rubik_medium" /> | ||
<font app:fontStyle="normal" app:fontWeight="700" app:font="@font/rubik_bold" /> | ||
<font app:fontStyle="italic" app:fontWeight="500" app:font="@font/rubik_medium_italic" /> | ||
</font-family> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
3915c0f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kelset could you please cherry pick into 0.60 if possible. Thank you