Skip to content

Move Linkification for dataDetectorType into TextLayoutManager (fixes dataDetectorType with Facsimile)#55756

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

Move Linkification for dataDetectorType into TextLayoutManager (fixes dataDetectorType with Facsimile)#55756
NickGerleman wants to merge 1 commit intofacebook:mainfrom
NickGerleman:export-D94017172

Conversation

@NickGerleman
Copy link
Contributor

Summary:
Move dataDetectorType Linkify handling from ReactTextView (view-level
Linkify on the TextView) to TextLayoutManager.kt (Linkify on the
Spannable), so it works for both ReactTextView and PreparedLayoutTextView.

Previously, dataDetectorType was handled as a ReactProp on
ReactTextViewManager, which called Linkify.addLinks() inside
ReactTextView.setText(). This meant the feature only worked for the legacy
ReactTextView path, not for the new PreparedLayoutTextView.

This diff:

  • Moves the DataDetectorType C++ enum from components/text/platform/android/
    to attributedstring/primitives.h (where all other paragraph-related enums
    live), replacing the original with a forwarding include.
  • Moves the DataDetectorType conversion functions to
    attributedstring/conversions.h, replacing the originals with a forwarding
    include.
  • Adds dataDetectorType as a field on ParagraphAttributes (with hash,
    equality, and debug support).
  • Serializes dataDetectorType via MapBuffer (key=9) so it flows from C++
    to Java.
  • Adds REBUILD_FIELD_SWITCH_CASE for dataDetectorType in
    BaseParagraphProps.cpp.
  • In TextLayoutManager.kt, reads PA_KEY_DATA_DETECTOR_TYPE from the
    paragraph attributes MapBuffer and calls Linkify.addLinks() on the
    Spannable before layout creation.
  • Removes the ReactProp handler and setLinkifyMask/mLinkifyMaskType
    from ReactTextViewManager.kt and ReactTextView.java.
  • Adds URLSpan-based LinkMovementMethod detection in ReactTextView.setText()
    so that links added by TextLayoutManager remain clickable.

HostPlatformParagraphProps is intentionally left unchanged—dataDetectorType
is parsed into both BaseParagraphProps::paragraphAttributes (for MapBuffer)
and HostPlatformParagraphProps (for getDiffProps).

Changelog: [Internal]

Differential Revision: D94017172

… dataDetectorType with Facsimile)

Summary:
Move `dataDetectorType` Linkify handling from `ReactTextView` (view-level
`Linkify` on the `TextView`) to `TextLayoutManager.kt` (`Linkify` on the
`Spannable`), so it works for both `ReactTextView` and `PreparedLayoutTextView`.

Previously, `dataDetectorType` was handled as a `ReactProp` on
`ReactTextViewManager`, which called `Linkify.addLinks()` inside
`ReactTextView.setText()`. This meant the feature only worked for the legacy
`ReactTextView` path, not for the new `PreparedLayoutTextView`.

This diff:
- Moves the `DataDetectorType` C++ enum from `components/text/platform/android/`
  to `attributedstring/primitives.h` (where all other paragraph-related enums
  live), replacing the original with a forwarding include.
- Moves the `DataDetectorType` conversion functions to
  `attributedstring/conversions.h`, replacing the originals with a forwarding
  include.
- Adds `dataDetectorType` as a field on `ParagraphAttributes` (with hash,
  equality, and debug support).
- Serializes `dataDetectorType` via MapBuffer (key=9) so it flows from C++
  to Java.
- Adds `REBUILD_FIELD_SWITCH_CASE` for `dataDetectorType` in
  `BaseParagraphProps.cpp`.
- In `TextLayoutManager.kt`, reads `PA_KEY_DATA_DETECTOR_TYPE` from the
  paragraph attributes MapBuffer and calls `Linkify.addLinks()` on the
  `Spannable` before layout creation.
- Removes the `ReactProp` handler and `setLinkifyMask`/`mLinkifyMaskType`
  from `ReactTextViewManager.kt` and `ReactTextView.java`.
- Adds URLSpan-based `LinkMovementMethod` detection in `ReactTextView.setText()`
  so that links added by `TextLayoutManager` remain clickable.

`HostPlatformParagraphProps` is intentionally left unchanged—`dataDetectorType`
is parsed into both `BaseParagraphProps::paragraphAttributes` (for MapBuffer)
and `HostPlatformParagraphProps` (for getDiffProps).

Changelog: [Internal]

Differential Revision: D94017172
@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 25, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 25, 2026

@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D94017172.

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