Skip to content

Initial support for selectable text with enablePreparedTextLayout#55552

Open
NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman:export-D92928315
Open

Initial support for selectable text with enablePreparedTextLayout#55552
NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman:export-D92928315

Conversation

@NickGerleman
Copy link
Contributor

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

@meta-cla meta-cla 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 Feb 14, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 14, 2026

@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
@github-actions
Copy link

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

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
…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
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. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants