Uh oh!
There was an error while loading. Please reload this page.
2/n Nested Text textAlignVertical (Android) - adding textAlignVertical prop to NestedText - #35704
2/n Nested Text textAlignVertical (Android) - adding textAlignVertical prop to NestedText#35704fabOnReact wants to merge 65 commits into
Conversation
P type task |
Base commit: bf03e86 |
Base commit: 4d8ba7b |
fabOnReact
commented
Dec 22, 2022
P type task |
pull-bot
commented
Dec 22, 2022
PR build artifact for 7d147de is ready. |
pull-bot
commented
Dec 22, 2022
PR build artifact for 7d147de is ready. |
…figs in TtsSpan, because the value mVerticalAlign is set in TextAttributesProps.java, but not in MapBuffer. react#35704 (comment)
This comment was marked as duplicate.
This comment was marked as duplicate.
fabOnReact
commented
Dec 26, 2022
P type task |
pull-bot
commented
Dec 26, 2022
PR build artifact for fdeb37c is ready. |
pull-bot
commented
Dec 26, 2022
PR build artifact for fdeb37c is ready. |
fabOnReact
commented
Dec 27, 2022
P type task |
fabOnReact
commented
Dec 27, 2022
pull-bot
commented
Dec 27, 2022
PR build artifact for 5565bc1 is ready. |
pull-bot
commented
Dec 27, 2022
PR build artifact for 5565bc1 is ready. |
fabOnReact
commented
Dec 28, 2022
P type task |
…h the updated TextView height react#35704 (comment)
pull-bot
commented
Dec 28, 2022
PR build artifact for 9de465b is ready. |
pull-bot
commented
Dec 28, 2022
PR build artifact for 9de465b is ready. |
fabOnReact
commented
Dec 28, 2022
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| } | ||
| for (CustomStyleSpan span : customStyleSpans) { | ||
| span.updateSpan(highestLineHeight, highestFontSize); |
There was a problem hiding this comment.
https://developer.android.com/develop/ui/views/text-and-emoji/spans#best-practices
Calling view.setText(update) before updating the span. Result: text correctly aligns to the top or the bottom, the parent text vertical align does not change.
https://www.icloud.com/iclouddrive/0e3YRsM1KKEs0SXo0nvkEy9OQ#call_set_text_before_mutation
Calling view.setText(update) after updating the span. Result: text does not align correctly, The regression is caused by the change in the parent text vertical align.
https://www.icloud.com/iclouddrive/087kw0jNMTAFnT5pJ-mPHXzaQ#call_set_text_after_mutation
The logic is required to align spans correctly. The functionality works without issues.
fabOnReact
commented
Feb 22, 2023
P type task |
If you need to change only an internal attribute of a mutable span, such as the bullet color in a custom bullet span, you can avoid the overhead from calling setText() multiple times by keeping a reference to the span as it's created. When you need to modify the span, you can modify the reference and then call either invalidate() or requestLayout() on the TextView, depending on the type of attribute that you changed.
fabOnReact
commented
Feb 24, 2023
P type task |
b42f981 to
dbeecaaCompareThis PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This PR was closed because it has been stalled for 7 days with no activity. |
fabOnReact
commented
Jan 31, 2024
I deleted the branch for mistake |


Summary
Requires merging 1/n Nested Text textAlignVertical (Android) - Adding CustomStyleSpan API to align nested text vertically PR #35949.
2/n of a series of pull requests (Nested Text textAlignVertical):
CSS - vertical-align with spans
The CSS vertical-align property vertically aligns text on a character level
Code example CSS vertical-align
#30375 (comment)
https://jsfiddle.net/2duoLyq4/14/
Android - explanation of the corresponding Span Android APIs
MetricAffectingSpan allows to vertically align text (group of characters, not paragraphs divided by
\n) by changing the TextPaint baseline of a span.Text is represented as TextView on Android, Nested Text is represented as Spans.
https://developer.android.com/develop/ui/views/text-and-emoji/spans
https://developer.android.com/develop/ui/views/text-and-emoji/spans#span-types
They consist of four types:
Android does not support CSS vertical-align on character-level
An example of similar functionality on Android is the AlignmentSpan.
A paragraph is a text separated by
\n(new line). The AlignmentSpan changes the horizontal alignment of the paragraph.https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/text/Layout.java;l=494-500;drc=caabd536e8fea82b888902f359b33e637267966c;bpv=1;bpt=1?q=ALIGN_OPPOSITE&ss=android%2Fplatform%2Fsuperproject
Details on how the Layout.java API draws text with the AlignmentSpan.
#30375 (comment).
ALIGN_CENTER,ALIGN_OPPOSITEorALIGN_NORMAL.fixes#30375#30375 (comment)
Changelog
[ANDROID] [ADDED] - 2/n Nested Text textAlignVertical (Android) - adding textAlignVertical prop to NestedText
Test Plan
#35704 (comment)
#35704 (comment)
#35704 (comment)
Previous Tests
#35704 (comment)
#35704 (comment)#35704 (comment)