mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(gestures)propagate touch to parent so that gestures can work (#6171)
* propagate gesture touch to parent so that gestures can work * test: swipe passtrough test
This commit is contained in:
committed by
Alexander Vakrilov
parent
bd91bfb28a
commit
8a5f73055e
@@ -72,12 +72,7 @@ function initializeTouchListener(): void {
|
||||
|
||||
onTouch(view: android.view.View, event: android.view.MotionEvent): boolean {
|
||||
const owner = this.owner;
|
||||
for (let type in owner._gestureObservers) {
|
||||
let list = owner._gestureObservers[type];
|
||||
list.forEach(element => {
|
||||
element.androidOnTouchEvent(event);
|
||||
});
|
||||
}
|
||||
owner.handleGestureTouch(event);
|
||||
|
||||
let nativeView = owner.nativeViewProtected;
|
||||
if (!nativeView || !nativeView.onTouchEvent) {
|
||||
@@ -320,6 +315,18 @@ export class View extends ViewCommon {
|
||||
return false;
|
||||
}
|
||||
|
||||
public handleGestureTouch(event: android.view.MotionEvent): any {
|
||||
for (let type in this._gestureObservers) {
|
||||
let list = this._gestureObservers[type];
|
||||
list.forEach(element => {
|
||||
element.androidOnTouchEvent(event);
|
||||
});
|
||||
}
|
||||
if (this.parent instanceof View) {
|
||||
this.parent.handleGestureTouch(event);
|
||||
}
|
||||
}
|
||||
|
||||
private hasGestureObservers() {
|
||||
return this._gestureObservers && Object.keys(this._gestureObservers).length > 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user