Repository navigation
Accept a numeric fontWeight in the Android TextInput native code - #60136
Merged
Merged
Conversation
intergalacticspacehighway
force-pushed
the
textinput-font-weight-cpp
branch
2 times, most recently
from
November 19, 2026 05:15
652baa9 to
354f5a3
Compare
intergalacticspacehighway
marked this pull request as ready for review
November 19, 2026 05:17
javache
requested changes
Nov 19, 2026
javache
left a comment
Contributor
There was a problem hiding this comment.
We'll want to split this in two changes to remain backwards compatible with older native release, one for the native capability to parse both variants, and one with the JS changes.
intergalacticspacehighway
force-pushed
the
textinput-font-weight-cpp
branch
from
November 19, 2026 11:45
354f5a3 to
b6bdac4
Compare
Collaborator
Author
javache
approved these changes
Nov 19, 2026
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D133209822. |
Collaborator
|
This pull request was successfully merged by @intergalacticspacehighway in 3d55ca9 When will my fix make it into a release? | How to file a pick request? |
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:
On Android,
TextInputkeepsfontWeightas a string. SoTextInput.jschanges a numericfontWeight(for example700) to a string before it sends the props. The commit that added this (15f27bc) calls it "a quick and dirty replication" of theText.jslogic, to fix later for Fabric.This PR makes the native code accept a number too:
AndroidTextInputProps): a number becomes a string, in the classic parser and in the iterator setter.ReactTextInputManager.setFontWeight): the setter takes aDynamic, so the raw props path also accepts a number. This changes the public signature fromString?toDynamic.The JS conversion stays, so a new JS bundle still works with an older native build. A follow-up PR removes it after this change ships.
This also makes a numeric
fontWeightwork in a conditional style value (RFC, #60124), because the JS conversion cannot see inside one.Changelog:
[ANDROID] [CHANGED] -
TextInputaccepts a numericfontWeightin native code.Test Plan:
ReactTextInputPropertyTest.testFontWeightAcceptsANumber.TextInputwith a numericfontWeightrenders with no errors in each combination of the props flags (Props 1.5, Props 2.0, exclusive props updates, the C++ iterator setter)../gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests ReactTextInputPropertyTest: pass.