Skip to content

Conversation

@mateoguzmana
Copy link
Collaborator

Summary:

Migrate com.facebook.react.views.text.ReactTextViewManager to Kotlin.

In this diff, ReactTextAnchorViewManager is made public again as it's extended by ReactTextViewManager.

Changelog:

[INTERNAL] - Migrate com.facebook.react.views.text.ReactTextViewManager to Kotlin

Test Plan:

yarn test-android
yarn android

@facebook-github-bot facebook-github-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 May 31, 2025
@mateoguzmana mateoguzmana marked this pull request as ready for review June 1, 2025 16:26
@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 Jun 1, 2025
@NickGerleman
Copy link
Contributor

ReactTextAnchorViewManager is made public again as it's extended by ReactTextViewManager

Could ReactTextViewManager not extend it if it was internal? Otherwise, could we add @UnstablReactNativeAPI to the class?

From the history, these two can really just be merged together. There used to be a hierarchy there, but now ReactTextAnchorViewManager only actually works specifically when ReactTextViewManager extends it. They should be merged.

Not necessarily needed for this change though.

Comment on lines 140 to 141
"Paragraph Attributes: %s",
// if (paragraphAttributes != null) paragraphAttributes.toString() else "<empty>"
Copy link
Contributor

@NickGerleman NickGerleman Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Paragraph Attributes: %s",
// if (paragraphAttributes != null) paragraphAttributes.toString() else "<empty>"
"Paragraph Attributes: %s",

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crash actually went away at some point, so we could also remove the try/catch entirely

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the try/catch


@ReactProp(name = "accessible")
public fun setAccessible(view: ReactTextView, accessible: Boolean) {
internal fun setAccessible(view: ReactTextView, accessible: Boolean) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are prop setters allowed to be internal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There doesn't seem to be any build/runtime issue, so it looks like it is allowed

@mateoguzmana
Copy link
Collaborator Author

Could ReactTextViewManager not extend it if it was internal? Otherwise, could we add @UnstablReactNativeAPI to the class?

It is unfortunately not possible while keeping it internal as the consumer class is public, we could make the consumer class internal as well to avoid this but it has some OSS usages

From the history, these two can really just be merged together. There used to be a hierarchy there, but now ReactTextAnchorViewManager only actually works specifically when ReactTextViewManager extends it. They should be merged.

Interesting, thanks for the info! I think just to keep this PR within the scope of migration, maybe that can be done separately – I'm happy to follow up later on.

I've annotated the class with @UnstableReactNativeAPI now.

@facebook-github-bot
Copy link
Contributor

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@NickGerleman merged this pull request in d631ec9.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jun 5, 2025
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @mateoguzmana in d631ec9

When will my fix make it into a release? | How to file a pick request?

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. Merged This PR has been merged. 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.

4 participants