Commit 8e4d542
Move Linkification for dataDetectorType into TextLayoutManager (fixes 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: D940171721 parent 481134a commit 8e4d542
13 files changed
Lines changed: 172 additions & 125 deletions
File tree
- packages/react-native
- ReactAndroid
- api
- src/main/java/com/facebook/react/views
- textinput
- text
- ReactCommon/react/renderer
- attributedstring
- components/text
- platform/android/react/renderer/components/text
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6056 | 6056 | | |
6057 | 6057 | | |
6058 | 6058 | | |
| 6059 | + | |
6059 | 6060 | | |
6060 | 6061 | | |
6061 | 6062 | | |
| |||
6100 | 6101 | | |
6101 | 6102 | | |
6102 | 6103 | | |
6103 | | - | |
6104 | 6104 | | |
6105 | 6105 | | |
6106 | 6106 | | |
| |||
6135 | 6135 | | |
6136 | 6136 | | |
6137 | 6137 | | |
6138 | | - | |
6139 | 6138 | | |
6140 | 6139 | | |
6141 | 6140 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
| |||
Lines changed: 7 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
| |||
91 | 89 | | |
92 | 90 | | |
93 | 91 | | |
94 | | - | |
95 | 92 | | |
96 | 93 | | |
97 | 94 | | |
| |||
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
134 | | - | |
135 | 131 | | |
136 | 132 | | |
137 | 133 | | |
138 | 134 | | |
139 | 135 | | |
140 | 136 | | |
141 | 137 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | 138 | | |
146 | 139 | | |
147 | 140 | | |
| |||
386 | 379 | | |
387 | 380 | | |
388 | 381 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
394 | 386 | | |
| 387 | + | |
| 388 | + | |
395 | 389 | | |
396 | | - | |
397 | 390 | | |
398 | 391 | | |
399 | 392 | | |
| |||
627 | 620 | | |
628 | 621 | | |
629 | 622 | | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | 623 | | |
635 | 624 | | |
636 | 625 | | |
| |||
Lines changed: 2 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| |||
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | 349 | | |
374 | 350 | | |
375 | 351 | | |
| |||
Lines changed: 59 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| |||
530 | 532 | | |
531 | 533 | | |
532 | 534 | | |
| 535 | + | |
533 | 536 | | |
534 | 537 | | |
535 | 538 | | |
| |||
541 | 544 | | |
542 | 545 | | |
543 | 546 | | |
| 547 | + | |
544 | 548 | | |
545 | 549 | | |
546 | 550 | | |
| |||
552 | 556 | | |
553 | 557 | | |
554 | 558 | | |
| 559 | + | |
555 | 560 | | |
556 | 561 | | |
557 | 562 | | |
558 | | - | |
559 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
560 | 570 | | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
565 | 576 | | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
| 577 | + | |
570 | 578 | | |
571 | | - | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
572 | 584 | | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
577 | 589 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
582 | 593 | | |
583 | | - | |
584 | | - | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
585 | 597 | | |
| 598 | + | |
| 599 | + | |
586 | 600 | | |
587 | 601 | | |
588 | 602 | | |
| |||
742 | 756 | | |
743 | 757 | | |
744 | 758 | | |
| 759 | + | |
| 760 | + | |
745 | 761 | | |
746 | 762 | | |
747 | 763 | | |
| |||
809 | 825 | | |
810 | 826 | | |
811 | 827 | | |
812 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
813 | 835 | | |
814 | 836 | | |
815 | 837 | | |
| |||
915 | 937 | | |
916 | 938 | | |
917 | 939 | | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
918 | 953 | | |
919 | 954 | | |
920 | 955 | | |
| |||
932 | 967 | | |
933 | 968 | | |
934 | 969 | | |
| 970 | + | |
935 | 971 | | |
936 | 972 | | |
937 | 973 | | |
| 974 | + | |
938 | 975 | | |
939 | 976 | | |
940 | 977 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
| 1017 | + | |
1017 | 1018 | | |
1018 | 1019 | | |
1019 | 1020 | | |
| |||
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
| |||
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
112 | | - | |
| 118 | + | |
| 119 | + | |
113 | 120 | | |
114 | 121 | | |
115 | 122 | | |
0 commit comments