fix: more text base fixes for plugins using nativeTextViewProtected

This commit is contained in:
Martin Guillon
2021-07-26 16:23:27 +02:00
parent 785b16a642
commit 2c8ff3191c

View File

@ -284,8 +284,8 @@ export class TextBase extends TextBaseCommon {
const id = Utils.ad.resources.getId(':id/nativescript_accessibility_id'); const id = Utils.ad.resources.getId(':id/nativescript_accessibility_id');
if (id) { if (id) {
this.nativeViewProtected.setTag(id, value); this.nativeTextViewProtected.setTag(id, value);
this.nativeViewProtected.setTag(value); this.nativeTextViewProtected.setTag(value);
} }
} }
@ -354,10 +354,10 @@ export class TextBase extends TextBaseCommon {
} }
[lineHeightProperty.getDefault](): number { [lineHeightProperty.getDefault](): number {
return this.nativeView.getLineSpacingExtra() / layout.getDisplayDensity(); return this.nativeTextViewProtected.getLineSpacingExtra() / layout.getDisplayDensity();
} }
[lineHeightProperty.setNative](value: number) { [lineHeightProperty.setNative](value: number) {
this.nativeView.setLineSpacing(value * layout.getDisplayDensity(), 1); this.nativeTextViewProtected.setLineSpacing(value * layout.getDisplayDensity(), 1);
} }
[fontInternalProperty.getDefault](): android.graphics.Typeface { [fontInternalProperty.getDefault](): android.graphics.Typeface {
@ -404,7 +404,7 @@ export class TextBase extends TextBaseCommon {
[textShadowProperty.setNative](value: CSSShadow) { [textShadowProperty.setNative](value: CSSShadow) {
// prettier-ignore // prettier-ignore
this.nativeViewProtected.setShadowLayer( this.nativeTextViewProtected.setShadowLayer(
Length.toDevicePixels(value.blurRadius, java.lang.Float.MIN_VALUE), Length.toDevicePixels(value.blurRadius, java.lang.Float.MIN_VALUE),
Length.toDevicePixels(value.offsetX, 0), Length.toDevicePixels(value.offsetX, 0),
Length.toDevicePixels(value.offsetY, 0), Length.toDevicePixels(value.offsetY, 0),
@ -480,10 +480,10 @@ export class TextBase extends TextBaseCommon {
if (this._tappable !== tappable) { if (this._tappable !== tappable) {
this._tappable = tappable; this._tappable = tappable;
if (this._tappable) { if (this._tappable) {
this.nativeViewProtected.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); this.nativeTextViewProtected.setMovementMethod(android.text.method.LinkMovementMethod.getInstance());
this.nativeViewProtected.setHighlightColor(null); this.nativeTextViewProtected.setHighlightColor(null);
} else { } else {
this.nativeViewProtected.setMovementMethod(this._defaultMovementMethod); this.nativeTextViewProtected.setMovementMethod(this._defaultMovementMethod);
} }
} }
} }