mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Fix resetting horizontal text alignment
This commit is contained in:
@ -89,7 +89,7 @@ export class TextBase extends TextBaseCommon {
|
|||||||
|
|
||||||
//TextAlignment
|
//TextAlignment
|
||||||
get [textAlignmentProperty.native](): TextAlignment {
|
get [textAlignmentProperty.native](): TextAlignment {
|
||||||
let textAlignmentGravity = this._nativeView.getGravity() & android.view.View.TEXT_ALIGNMENT_GRAVITY;
|
let textAlignmentGravity = this._nativeView.getGravity() & android.view.Gravity.HORIZONTAL_GRAVITY_MASK;
|
||||||
switch (textAlignmentGravity) {
|
switch (textAlignmentGravity) {
|
||||||
case android.view.Gravity.LEFT:
|
case android.view.Gravity.LEFT:
|
||||||
return TextAlignment.LEFT;
|
return TextAlignment.LEFT;
|
||||||
@ -98,7 +98,7 @@ export class TextBase extends TextBaseCommon {
|
|||||||
case android.view.Gravity.RIGHT:
|
case android.view.Gravity.RIGHT:
|
||||||
return TextAlignment.RIGHT;
|
return TextAlignment.RIGHT;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unsupported android.view.View.TEXT_ALIGNMENT_GRAVITY: ${textAlignmentGravity}. Currently supported values are android.view.Gravity.LEFT, android.view.Gravity.CENTER_HORIZONTAL, and android.view.Gravity.RIGHT.`);
|
return TextAlignment.LEFT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set [textAlignmentProperty.native](value: TextAlignment) {
|
set [textAlignmentProperty.native](value: TextAlignment) {
|
||||||
|
Reference in New Issue
Block a user