Skip to content

Commit

Permalink
fix(android): justify text alignment support
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Sep 24, 2021
1 parent fec48b9 commit f26d74b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/label.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,16 @@ export class Label extends LabelBase {

[textAlignmentProperty.setNative](value: CoreTypes.TextAlignmentType) {
const view = this.nativeTextViewProtected;
view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
if (android.os.Build.VERSION.SDK_INT >= 25) {
if ((value as any) === 'justify' && android.os.Build.VERSION.SDK_INT >= 25) {
view.setJustificationMode(android.text.Layout.JUSTIFICATION_MODE_INTER_WORD);
} else {
view.setJustificationMode(android.text.Layout.JUSTIFICATION_MODE_NONE);
view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
}
} else {
view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
}
}

[colorProperty.setNative](value: Color | string) {
Expand Down

0 comments on commit f26d74b

Please sign in to comment.