Initial support for selectable text with enablePreparedTextLayout#55552
Open
NickGerleman wants to merge 1 commit intofacebook:mainfrom
Open
Initial support for selectable text with enablePreparedTextLayout#55552NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman wants to merge 1 commit intofacebook:mainfrom
Conversation
|
@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92928315. |
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Feb 14, 2026
…cebook#55552) Summary: Pull Request resolved: facebook#55552 enablePreparedTextLayout replaces ReactTextView (a real TextView) with PreparedLayoutTextView (a ViewGroup that draws a pre-computed Layout). PreparedLayoutTextView does not support native text selection, so selectable text was broken when the flag was on (T222052152). This diff adds support for selectable text by routing it through ReactTextView when enablePreparedTextLayout is enabled. A new JS component NativeSelectableText resolves to native name RCTSelectableText when the flag is on, or falls back to RCTText when it is off. Text.js uses NativeSelectableText whenever text is selectable, and a new SelectableTextViewManager (which extends ReactTextViewManager) is registered as RCTSelectableText in all ReactPackage sites. ReactTextViewManager.updateState() is also updated to handle ReferenceStateWrapper holding PreparedLayout, so that it can process state delivered through the PreparedLayout path. Note that this change relies on facebook/react#35780 to avoid warnings from React Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D92928315
73d98f8 to
5368b49
Compare
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
NickGerleman
added a commit
to NickGerleman/react-native
that referenced
this pull request
Feb 14, 2026
…cebook#55552) Summary: Pull Request resolved: facebook#55552 enablePreparedTextLayout replaces ReactTextView (a real TextView) with PreparedLayoutTextView (a ViewGroup that draws a pre-computed Layout). PreparedLayoutTextView does not support native text selection, so selectable text was broken when the flag was on (T222052152). This diff adds support for selectable text by routing it through ReactTextView when enablePreparedTextLayout is enabled. A new JS component NativeSelectableText resolves to native name RCTSelectableText when the flag is on, or falls back to RCTText when it is off. Text.js uses NativeSelectableText whenever text is selectable, and a new SelectableTextViewManager (which extends ReactTextViewManager) is registered as RCTSelectableText in all ReactPackage sites. ReactTextViewManager.updateState() is also updated to handle ReferenceStateWrapper holding PreparedLayout, so that it can process state delivered through the PreparedLayout path. Note that this change relies on facebook/react#35780 to avoid warnings from React Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D92928315
5368b49 to
0aa8f4d
Compare
…cebook#55552) Summary: Pull Request resolved: facebook#55552 enablePreparedTextLayout replaces ReactTextView (a real TextView) with PreparedLayoutTextView (a ViewGroup that draws a pre-computed Layout). PreparedLayoutTextView does not support native text selection, so selectable text was broken when the flag was on (T222052152). This diff adds support for selectable text by routing it through ReactTextView when enablePreparedTextLayout is enabled. A new JS component NativeSelectableText resolves to native name RCTSelectableText when the flag is on, or falls back to RCTText when it is off. Text.js uses NativeSelectableText whenever text is selectable, and a new SelectableTextViewManager (which extends ReactTextViewManager) is registered as RCTSelectableText in all ReactPackage sites. ReactTextViewManager.updateState() is also updated to handle ReferenceStateWrapper holding PreparedLayout, so that it can process state delivered through the PreparedLayout path. Note that this change relies on facebook/react#35780 to avoid warnings from React Changelog: [General][Changed] - Text Can Conditionally Use "RCTSelectableText" Native Component Reviewed By: mdvacca Differential Revision: D92928315
0aa8f4d to
fb6a43e
Compare
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:
enablePreparedTextLayout replaces ReactTextView (a real TextView) with PreparedLayoutTextView (a ViewGroup that draws a pre-computed Layout). PreparedLayoutTextView does not support native text selection, so selectable text was broken when the flag was on (T222052152).
This diff adds support for selectable text by routing it through ReactTextView when enablePreparedTextLayout is enabled. A new JS component NativeSelectableText resolves to native name RCTSelectableText when the flag is on, or falls back to RCTText when it is off. Text.js uses NativeSelectableText whenever text is selectable, and a new SelectableTextViewManager (which extends ReactTextViewManager) is registered as RCTSelectableText in all ReactPackage sites.
ReactTextViewManager.updateState() is also updated to handle ReferenceStateWrapper holding PreparedLayout, so that it can process state delivered through the PreparedLayout path.
Note that this change relies on facebook/react#35780 to avoid warnings from React
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D92928315