Conversation
|
Hi @MatiPl01! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
d0ab53e to
9542b15
Compare
9542b15 to
c86e46f
Compare
ReactTextView.onDraw paints CanvasEffectSpans (underline, strikethrough) only when getLayout() is non-null. TextView drops its Layout in setText and rebuilds it in onMeasure, and Fabric measures a view only when its frame changed, so a text state update that keeps the frame (a decoration or color change on a text of the same size) reaches onDraw with no Layout and the decorations are skipped until something else re-measures the view. Rebuild the Layout at the current size before painting; TextView.onDraw would build one for the plain text anyway.
c86e46f to
b642e15
Compare
Summary:
Since #56768 underline and strikethrough are painted by
ReactTextView.onDrawthroughCanvasEffectSpans, and only whengetLayout()is non-null.TextView.setTextdrops theLayoutand rebuilds it inonMeasure, but Fabric measures a view only when its frame changed. A text update that keeps the frame (textDecorationLineortextDecorationColorchanging on a text that keeps its size) therefore reachesonDrawwithout aLayout, the decorations are skipped andsuper.onDraw()paints plain text; they show up only once something else re-measures the view. Reported by @tshmieldev.onDrawnow rebuilds theLayoutat the current size before painting the effects;TextView.onDrawwould 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 assetText -> onDrawwithgetLayout() == nulland no decoration painted, both forsetStatetogglingtextDecorationLineand for a Reanimated animation updating it every frame; the same update followed by a frame change painted it.textDecorationLinecyclingnone/underline/line-through/underline line-throughevery 0.75 s, before and after:before-after-android-textDecorationLine.mp4