diff --git a/packages/core/ui/core/view/index.android.ts b/packages/core/ui/core/view/index.android.ts index a9bf698cc..cad8911c1 100644 --- a/packages/core/ui/core/view/index.android.ts +++ b/packages/core/ui/core/view/index.android.ts @@ -179,8 +179,8 @@ function initializeDialogFragment() { } public onCreate(savedInstanceState: android.os.Bundle) { super.onCreate(savedInstanceState); - var ownerId = this.getArguments()?.getInt(DOMID); - var options = getModalOptions(ownerId); + const ownerId = this.getArguments()?.getInt(DOMID); + const options = getModalOptions(ownerId); // The teardown when the activity is destroyed happens after the state is saved, but is not recoverable, // Cancel the native dialog in this case or the app will crash with subsequent errors. if (savedInstanceState != null && options === undefined) { @@ -325,7 +325,6 @@ export class View extends ViewCommon { public _dialogFragment: androidx.fragment.app.DialogFragment; public _manager: androidx.fragment.app.FragmentManager; - private _isClickable: boolean; private touchListenerIsSet: boolean; private touchListener: android.view.View.OnTouchListener; private layoutChangeListenerIsSet: boolean; @@ -465,7 +464,7 @@ export class View extends ViewCommon { public initNativeView(): void { super.initNativeView(); - this._isClickable = this.nativeViewProtected.isClickable(); + if (this.needsOnLayoutChangeListener()) { this.setOnLayoutChangeListener(); } @@ -825,8 +824,8 @@ export class View extends ViewCommon { } [accessibilityEnabledProperty.setNative](value: boolean): void { - // ensure `accessibilityEnabled=false` does not disable focus for view with `isUserInteractionEnabled=true` - this.nativeViewProtected.setFocusable(!!value || this.isUserInteractionEnabled); + this.nativeViewProtected.setFocusable(!!value); + if (value) { updateAccessibilityProperties(this); } @@ -1265,15 +1264,6 @@ export class View extends ViewCommon { export class ContainerView extends View { public iosOverflowSafeArea: boolean; - - constructor() { - super(); - /** - * mark accessible as false without triggering proerty change - * equivalent to changing the default - */ - this.style[accessibilityEnabledProperty.key] = false; - } } export class CustomLayoutView extends ContainerView implements CustomLayoutViewDefinition { diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts index da7ac4ef4..df4d10460 100644 --- a/packages/core/ui/core/view/index.ios.ts +++ b/packages/core/ui/core/view/index.ios.ts @@ -1069,11 +1069,6 @@ export class ContainerView extends View { constructor() { super(); this.iosOverflowSafeArea = true; - /** - * mark accessible as false without triggering proerty change - * equivalent to changing the default - */ - this.style[accessibilityEnabledProperty.key] = false; } } diff --git a/packages/core/ui/layouts/layout-base-common.ts b/packages/core/ui/layouts/layout-base-common.ts index 95e10c70f..a07964a02 100644 --- a/packages/core/ui/layouts/layout-base-common.ts +++ b/packages/core/ui/layouts/layout-base-common.ts @@ -3,10 +3,22 @@ import { CoreTypes } from '../../core-types'; import { View, CustomLayoutView, AddChildFromBuilder } from '../core/view'; import { booleanConverter, getViewById } from '../core/view-base'; import { Property } from '../core/properties'; +import { accessibilityEnabledProperty } from '../../accessibility/accessibility-properties'; export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder { private _subViews = new Array(); + constructor() { + super(); + + /** + * mark accessible as false without triggering property change + * equivalent to changing the default + * TODO: Remove this when we have a more flexible API for declaring default property values per type of view + */ + this.style[accessibilityEnabledProperty.key] = false; + } + public _addChildFromBuilder(name: string, value: any) { if (value instanceof View) { this.addChild(value);