fix: paint Android text decorations when a text update keeps the view's frame #58579

Open
MatiPl01 opened 2:19pm on September 17, 2026 wants to merge 6 Ξ” into facebook/react-native main from
fix/android-text-decoration-null-layout

Pull Request Overview

  • Opened on September 17, 2026
  • Status Open
  • Commit count 1 with first commit September 18, 2026

Total Delta

6 Total Diff Delta

Open Days

Open 2 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 0 commits before pull request opened for review
 
0.0 days Awaiting first review
 
1.0 day Revising work with 1 commit in response to 0 reviews that left 1 comment

Total time for pull request still awaiting merge: 1.0 business day

Author avatar

fix: paint Android text decorations when a text update keeps the view's frame

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

Comments Threads Pending Resolution

Resolved Comment Threads

No resolved comments have been left on this PR.