Repository navigation
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
|
Affected by this issue, underline is not visible on Android texts, after re-measure, its thin, not same as before |
|
Closing in favor of #58847 |
…'s frame This is #58579 by @MatiPl01, a fix for a bug I found. Mati is no longer at Software Mansion, so I'm picking this up from my fork. Thanks Mati! ## Summary: Since #56768 underline and strikethrough are painted by `ReactTextView.onDraw` through `CanvasEffectSpan`s, 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. `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 Differential Revision: D129144546 Pull Request resolved: #58847
…on Android React Native on Android redoes a paragraph's text whenever the paragraph moves if text sits straight in it, and redone text of the same size is drawn without its underlines (react/react-native#58579). The credits' text now all sits in one span, so moving no longer redoes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZDfHd7VmBPMjb2GEkC
…underlines (#146) * Put footnote options on their own row when they don't fit beside the lead On a phone, "Play against" plus five options didn't fit one line, so Full Stockfish wrapped alone onto an indented, finger-tall second line. The options now move under the lead as one row, and a wrapped line's first option lines its text up with the lead's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZDfHd7VmBPMjb2GEkC * PR screenshots (removed before merge) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZDfHd7VmBPMjb2GEkC * Keep the credit links' underlines when the settings sheet moves them on Android React Native on Android redoes a paragraph's text whenever the paragraph moves if text sits straight in it, and redone text of the same size is drawn without its underlines (react/react-native#58579). The credits' text now all sits in one span, so moving no longer redoes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZDfHd7VmBPMjb2GEkC * Split each footnote option into its own component, and test negated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZDfHd7VmBPMjb2GEkC * Remove PR screenshots Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZDfHd7VmBPMjb2GEkC * Let the footnote's options row shrink so its options wrap on very narrow screens Flex items don't shrink by default in React Native, so where all options didn't fit even on a line of their own (a 320 px phone, larger text) the row overflowed instead of wrapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5C5ZDfHd7VmBPMjb2GEkC --------- Co-authored-by: Claude <noreply@anthropic.com>
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