mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-03 20:13:02 +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) {
|
public onCreate(savedInstanceState: android.os.Bundle) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
var ownerId = this.getArguments()?.getInt(DOMID);
|
const ownerId = this.getArguments()?.getInt(DOMID);
|
||||||
var options = getModalOptions(ownerId);
|
const options = getModalOptions(ownerId);
|
||||||
// The teardown when the activity is destroyed happens after the state is saved, but is not recoverable,
|
// 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.
|
// Cancel the native dialog in this case or the app will crash with subsequent errors.
|
||||||
if (savedInstanceState != null && options === undefined) {
|
if (savedInstanceState != null && options === undefined) {
|
||||||
@ -325,7 +325,6 @@ export class View extends ViewCommon {
|
|||||||
|
|
||||||
public _dialogFragment: androidx.fragment.app.DialogFragment;
|
public _dialogFragment: androidx.fragment.app.DialogFragment;
|
||||||
public _manager: androidx.fragment.app.FragmentManager;
|
public _manager: androidx.fragment.app.FragmentManager;
|
||||||
private _isClickable: boolean;
|
|
||||||
private touchListenerIsSet: boolean;
|
private touchListenerIsSet: boolean;
|
||||||
private touchListener: android.view.View.OnTouchListener;
|
private touchListener: android.view.View.OnTouchListener;
|
||||||
private layoutChangeListenerIsSet: boolean;
|
private layoutChangeListenerIsSet: boolean;
|
||||||
@ -465,7 +464,7 @@ export class View extends ViewCommon {
|
|||||||
|
|
||||||
public initNativeView(): void {
|
public initNativeView(): void {
|
||||||
super.initNativeView();
|
super.initNativeView();
|
||||||
this._isClickable = this.nativeViewProtected.isClickable();
|
|
||||||
if (this.needsOnLayoutChangeListener()) {
|
if (this.needsOnLayoutChangeListener()) {
|
||||||
this.setOnLayoutChangeListener();
|
this.setOnLayoutChangeListener();
|
||||||
}
|
}
|
||||||
@ -825,8 +824,8 @@ export class View extends ViewCommon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[accessibilityEnabledProperty.setNative](value: boolean): void {
|
[accessibilityEnabledProperty.setNative](value: boolean): void {
|
||||||
// ensure `accessibilityEnabled=false` does not disable focus for view with `isUserInteractionEnabled=true`
|
this.nativeViewProtected.setFocusable(!!value);
|
||||||
this.nativeViewProtected.setFocusable(!!value || this.isUserInteractionEnabled);
|
|
||||||
if (value) {
|
if (value) {
|
||||||
updateAccessibilityProperties(this);
|
updateAccessibilityProperties(this);
|
||||||
}
|
}
|
||||||
@ -1265,15 +1264,6 @@ export class View extends ViewCommon {
|
|||||||
|
|
||||||
export class ContainerView extends View {
|
export class ContainerView extends View {
|
||||||
public iosOverflowSafeArea: boolean;
|
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 {
|
export class CustomLayoutView extends ContainerView implements CustomLayoutViewDefinition {
|
||||||
|
|||||||
@ -1069,11 +1069,6 @@ export class ContainerView extends View {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.iosOverflowSafeArea = true;
|
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 { View, CustomLayoutView, AddChildFromBuilder } from '../core/view';
|
||||||
import { booleanConverter, getViewById } from '../core/view-base';
|
import { booleanConverter, getViewById } from '../core/view-base';
|
||||||
import { Property } from '../core/properties';
|
import { Property } from '../core/properties';
|
||||||
|
import { accessibilityEnabledProperty } from '../../accessibility/accessibility-properties';
|
||||||
|
|
||||||
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
|
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
|
||||||
private _subViews = new Array<View>();
|
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) {
|
public _addChildFromBuilder(name: string, value: any) {
|
||||||
if (value instanceof View) {
|
if (value instanceof View) {
|
||||||
this.addChild(value);
|
this.addChild(value);
|
||||||
|
|||||||
Reference in New Issue
Block a user