8000 fix(android): ListView tap handling after setting children as focusab… · NativeScript/NativeScript@03268cc · GitHub
[go: up one dir, main page]

Skip to content < 65E8 react-partial partial-name="keyboard-shortcuts-dialog" data-ssr="false" data-attempted-ssr="false" data-react-profiling="false" >

Commit 03268cc

Browse files
authored
fix(android): ListView tap handling after setting children as focusable (#10522)
1 parent fc55717 commit 03268cc

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

packages/core/ui/core/view/index.android.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ function initializeDialogFragment() {
179179
}
180180
public onCreate(savedInstanceState: android.os.Bundle) {
181181
super.onCreate(savedInstanceState);
182-
var ownerId = this.getArguments()?.getInt(DOMID);
183-
var options = getModalOptions(ownerId);
182+
const ownerId = this.getArguments()?.getInt(DOMID);
183+
const options = getModalOptions(ownerId);
184184
// The teardown when the activity is destroyed happens after the state is saved, but is not recoverable,
185185
// Cancel the native dialog in this case or the app will crash with subsequent errors.
186186
if (savedInstanceState != null && options === undefined) {
@@ -325,7 +325,6 @@ export class View extends ViewCommon {
325325

326326
public _dialogFragment: androidx.fragment.app.DialogFragment;
327327
public _manager: androidx.fragment.app.FragmentManager;
328-
private _isClickable: boolean;
329328
private touchListenerIsSet: boolean;
330329
private touchListener: android.view.View.OnTouchListener;
331330
private layoutChangeListenerIsSet: boolean;
@@ -465,7 +464,7 @@ export class View extends ViewCommon {
465464

466465
public initNativeView(): void {
467466
super.initNativeView();
468-
this._isClickable = this.nativeViewProtected.isClickable();
467+
469468
if (this.needsOnLayoutChangeListener()) {
470469
this.setOnLayoutChangeListener();
471470
}
@@ -825,8 +824,8 @@ export class View extends ViewCommon {
825824
}
826825

827826
[accessibilityEnabledProperty.setNative](value: boolean): void {
828-
// ensure `accessibilityEnabled=false` does not disable focus for view with `isUserInteractionEnabled=true`
829-
this.nativeViewProtected.setFocusable(!!value || this.isUserInteractionEnabled);
827+
this.nativeViewProtected.setFocusable(!!value);
828+
830829
if (value) {
831830
updateAccessibilityProperties(this);
832831
}
@@ -1265,15 +1264,6 @@ export class View extends ViewCommon {
12651264

12661265
export class ContainerView extends View {
12671266
public iosOverflowSafeArea: boolean;
1268-
1269-
constructor() {
1270-
super();
1271-
/**
1272-
* mark accessible as false without triggering proerty change
1273-
* equivalent to changing the default
1274-
*/
1275-
this.style[accessibilityEnabledProperty.key] = false;
1276-
}
12771267
}
12781268

12791269
export class CustomLayoutView extends ContainerView implements CustomLayoutViewDefinition {

packages/core/ui/core/view/index.ios.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,11 +1069,6 @@ export class ContainerView extends View {
10691069
constructor() {
10701070
super();
10711071
this.iosOverflowSafeArea = true;
1072-
/**
1073-
* mark accessible as false without triggering proerty change
1074-
* equivalent to changing the default
1075-
*/
1076-
this.style[accessibilityEnabledProperty.key] = false;
10771072
}
10781073
}
10791074

packages/core/ui/layouts/layout-base-common.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@ import { CoreTypes } from '../../core-types';
33
import { View, CustomLayoutView, AddChildFromBuilder } from '../core/view';
44
import { booleanConverter, getViewById } from '../core/view-base';
55
import { Property } from '../core/properties';
6+
import { accessibilityEnabledProperty } from '../../accessibility/accessibility-properties';
67

78
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
89
private _subViews = new Array<View>();
910

11+
constructor() {
12+
super();
13+
14+
/**
15+
* mark accessible as false without triggering property change
16+
* equivalent to changing the default
17+
* TODO: Remove this when we have a more flexible API for declaring default property values per type of view
18+
*/
19+
this.style[accessibilityEnabledProperty.key] = false;
20+
}
21+
1022
public _addChildFromBuilder(name: string, value: any) {
1123
if (value instanceof View) {
1224
this.addChild(value);

0 commit comments

Comments
 (0)
0