MatiPl01's Description of Work
Summary:
Since #56768 underline and strikethrough are painted by ReactTextView.onDraw through CanvasEffectSpans, and only when getLayout() is non-null. TextView.setText drops the Layout and rebuilds it in onMeasure, but Fabric measures a view only when its frame changed. A text update that keeps the frame (textDecorationLine or textDecorationColor changing on a text that keeps its size) therefore reaches onDraw without a Layout, the decorations are skipped and super.onDraw() paints plain text; they show up only once something else re-measures the view. Reported by @tshmieldev.
onDraw now rebuilds the Layout at the current size before painting the effects; TextView.onDraw would build one for the text anyway.
Changelog:
[ANDROID] [FIXED] - Draw text decorations after a text update that did not change the view's frame
Test Plan:
Android emulator API 34, RN 0.88.0-rc.1. With logging in onDraw, every frame-preserving update arrived as setText -> onDraw with getLayout() == null and no decoration painted, both for setState toggling textDecorationLine and for a Reanimated animation updating it every frame; the same update followed by a frame change painted it.
textDecorationLine cycling none / underline / line-through / underline line-through every 0.75 s, before and after:
https://github.com/user-attachments/assets/7aecf0a9-f999-4f1b-9699-fd07be53cb53