mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-03 03:30:04 +08:00
fix(android): ListView tap handling after setting children as focusable (#10522)
This commit is contained in:
committed by
GitHub
parent
fc55717825
commit
03268cc60b
@ -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 {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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<View>();
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user