Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 25.2k
2/n Nested Text textAlignVertical (Android) - adding textAlignVertical prop to NestedText#35704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c6837796716e0f7d147de7914cfdfdeb37c5565bc19de465b7ab97c20f7d69d59fe7755017156f75e899ba181679a7ad5b61e5089582faa48573fd528608f1957c784ba5223b47ddd11ce2b8eb87d205f7ac7a9abec2e1d2ff855bee66a98b3efb82395bbd2af8a7e9e363196dbe25d3812d4064f6095e49abefd469c6d7003ab1817c70ad7fca70c6c4e19ba2e3d4e5b9c50572f4726331d945e85bbe71230e06c1398855879630c4d82d3eb0b424112eeee5f76bffa770ea895324ece59529d224c58ac9278d994d644e0e20043d28163846e3815c91e24d89b95dc0bf75e7dbeecaaFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -103,6 +103,38 @@ public void updateExtraData(ReactTextView view, Object extraData) { | ||
| ReactAccessibilityDelegate.resetDelegate( | ||
| view, view.isFocusable(), view.getImportantForAccessibility()); | ||
| } | ||
| CustomLineHeightSpan[] customLineHeightSpans = | ||
| spannable.getSpans(0, spannable.length(), CustomLineHeightSpan.class); | ||
| CustomStyleSpan[] customStyleSpans = | ||
| spannable.getSpans(0, spannable.length(), CustomStyleSpan.class); | ||
| if (customLineHeightSpans.length > 0 && customStyleSpans.length > 0) { | ||
| int highestLineHeight = 0; | ||
| for (CustomLineHeightSpan span : customLineHeightSpans) { | ||
| if (highestLineHeight == 0 || span.getLineHeight() > highestLineHeight) { | ||
| highestLineHeight = span.getLineHeight(); | ||
| } | ||
| } | ||
| int highestFontSize = 0; | ||
| if (highestLineHeight != 0) { | ||
| for (CustomStyleSpan span : customStyleSpans) { | ||
| if (highestFontSize == 0 || span.getSize() > highestFontSize) { | ||
| highestFontSize = span.getSize(); | ||
| } | ||
| } | ||
| for (CustomStyleSpan span : customStyleSpans) { | ||
| /* | ||
| * https://developer.android.com/develop/ui/views/text-and-emoji/spans#change-internal-attributes | ||
| * Changes the internal span 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. | ||
| */ | ||
| span.updateSpan(highestLineHeight, highestFontSize); | ||
| ||
| } | ||
| } | ||
| } | ||
| } | ||
| @Override | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.