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:
Martin Guillon
2018-09-17 09:11:50 +02:00
committed by Alexander Vakrilov
parent bd91bfb28a
commit 8a5f73055e
4 changed files with 46 additions and 6 deletions

View File

@@ -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
}