Skip to content

Commit f26d74b

Browse files
committed
fix(android): justify text alignment support
1 parent fec48b9 commit f26d74b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: src/label.android.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,16 @@ export class Label extends LabelBase {
421421

422422
[textAlignmentProperty.setNative](value: CoreTypes.TextAlignmentType) {
423423
const view = this.nativeTextViewProtected;
424-
view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
424+
if (android.os.Build.VERSION.SDK_INT >= 25) {
425+
if ((value as any) === 'justify' && android.os.Build.VERSION.SDK_INT >= 25) {
426+
view.setJustificationMode(android.text.Layout.JUSTIFICATION_MODE_INTER_WORD);
427+
} else {
428+
view.setJustificationMode(android.text.Layout.JUSTIFICATION_MODE_NONE);
429+
view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
430+
}
431+
} else {
432+
view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
433+
}
425434
}
426435

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

0 commit comments

Comments
 (0)