From e42e9157c98eb7ef33f77fed034649d5d848c02c Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Tue, 8 Jun 2021 18:14:01 +0200 Subject: [PATCH] fix: accessibilityIdentifier fix for nativeTextViewProtected --- packages/core/ui/text-base/index.android.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/core/ui/text-base/index.android.ts b/packages/core/ui/text-base/index.android.ts index 83e056498..77e935e10 100644 --- a/packages/core/ui/text-base/index.android.ts +++ b/packages/core/ui/text-base/index.android.ts @@ -13,6 +13,8 @@ import { Span } from './span'; import { CoreTypes } from '../../core-types'; import { layout } from '../../utils'; import { isString, isNullOrUndefined } from '../../utils/types'; +import { accessibilityIdentifierProperty } from '../../accessibility/accessibility-properties'; +import * as Utils from '../../utils'; export * from './text-base-common'; @@ -278,6 +280,15 @@ export class TextBase extends TextBaseCommon { this.nativeTextViewProtected.setTransformationMethod(new TextTransformation(this)); } + [accessibilityIdentifierProperty.setNative](value: string): void { + const id = Utils.ad.resources.getId(':id/nativescript_accessibility_id'); + + if (id) { + this.nativeViewProtected.setTag(id, value); + this.nativeViewProtected.setTag(value); + } + } + [textAlignmentProperty.getDefault](): CoreTypes.TextAlignmentType { return 'initial'; }