Commit 2da0244
Fix text decoration color fallback to use per-span foreground color
Summary:
D104680895 replaced `ReactUnderlineSpan`/`ReactStrikethroughSpan` with custom `CanvasEffectSpan` drawing, but when `textDecorationColor` is not explicitly set, it fell back to `layout.paint.color` (the base paint color, typically black) instead of the text's actual foreground color. This caused decorations to render in the wrong color for text with `ForegroundColorSpan` — e.g., white text on dark backgrounds got black underlines, teal link text got black underlines.
This diff fixes the color by looking up the `ForegroundColorSpan` at the decoration's character position and using its color as the fallback instead of the base paint color.
Changelog: [Android][Fixed] - Fix text decoration color not matching foreground color when `textDecorationColor` is not set
Reviewed By: javache
Differential Revision: D107645191
fbshipit-source-id: b1e0a616259c983ae57cdbf476ae97da4204d9061 parent 319610d commit 2da0244
1 file changed
Lines changed: 14 additions & 1 deletion
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
129 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
130 | 143 | | |
131 | 144 | | |
132 | 145 | | |
| |||
0 commit comments