feat: text-alignment-support-android#488
Open
Wmg20 wants to merge 14 commits intosoftware-mansion:mainfrom
Open
feat: text-alignment-support-android#488Wmg20 wants to merge 14 commits intosoftware-mansion:mainfrom
Wmg20 wants to merge 14 commits intosoftware-mansion:mainfrom
Conversation
Author
|
I've just submitted a PR to add Text Alignment support for Android, bringing it up to parity with the iOS implementation. Key highlights:
I've also updated the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request introduces Text Alignment support for Android, bringing it to parity with the existing iOS implementation.
Motivation
Previously, the
setTextAlignmentmethod was only functional on iOS. This PR implements the necessary native Android logic to support alignment for paragraphs and lists.Implementation Details
AlignmentSpan.Standard.EnrichedAlignmentPlaceholderSpanwhich uses a Zero Width Space (ZWS) to maintain alignment state in empty paragraphs. This ensures the alignment isn't lost when a user clears a line and prevents the native placeholder from being incorrectly hidden.EnrichedParserandHtmlToSpannedConverterto support thetext-alignCSS property during HTML import/export for both<p>and<li>tags.EnrichedOrderedListSpan,EnrichedUnorderedListSpan, andEnrichedCheckboxListSpanto correctly position markers (bullets, numbers, checkboxes) according to the paragraph's alignment and text direction.EnrichedSpanStateto emit the current alignment back to the React Native side, allowing toolbar buttons to highlight correctly.Impacted Areas
android/src/main/java/com/swmansion/enriched/...)Test Plan
Verification Steps
Expected Results
justify, which falls back to default on Android) should render consistently with iOS.Screenshots / Videos
Compatibility