From 9fd5ddc9e30bc57932ff55d6f301477c01e919c9 Mon Sep 17 00:00:00 2001 From: Martin Yankov Date: Thu, 25 Jul 2019 21:56:01 +0300 Subject: [PATCH] fix(android): remove wait for doubletap if no gesture recognizer (#7584) --- tns-core-modules/ui/gestures/gestures.android.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tns-core-modules/ui/gestures/gestures.android.ts b/tns-core-modules/ui/gestures/gestures.android.ts index 89330e4e2..019e3935e 100644 --- a/tns-core-modules/ui/gestures/gestures.android.ts +++ b/tns-core-modules/ui/gestures/gestures.android.ts @@ -68,13 +68,20 @@ function initializeTapAndDoubleTapGestureListener() { } private _handleSingleTap(motionEvent: android.view.MotionEvent): void { - this._tapTimeoutId = timer.setTimeout(() => { + if (this._target.getGestureObservers(GestureTypes.doubleTap)) { + this._tapTimeoutId = timer.setTimeout(() => { + if (this._type & GestureTypes.tap) { + const args = _getArgs(GestureTypes.tap, this._target, motionEvent); + _executeCallback(this._observer, args); + } + timer.clearTimeout(this._tapTimeoutId); + }, TapAndDoubleTapGestureListenerImpl.DoubleTapTimeout); + } else { if (this._type & GestureTypes.tap) { const args = _getArgs(GestureTypes.tap, this._target, motionEvent); _executeCallback(this._observer, args); } - timer.clearTimeout(this._tapTimeoutId); - }, TapAndDoubleTapGestureListenerImpl.DoubleTapTimeout); + } } private _handleDoubleTap(motionEvent: android.view.MotionEvent): void {