From c05145bd9b62cb017349acf46827fec929b3289c Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 5 Apr 2022 11:26:33 -0700 Subject: [PATCH] feat(TouchManager): touchDelay property for nested tap control --- packages/core/ui/core/view/view-common.ts | 10 ++++++++++ packages/core/ui/gestures/touch-manager.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/core/ui/core/view/view-common.ts b/packages/core/ui/core/view/view-common.ts index 6f826e882..ffb7bdfad 100644 --- a/packages/core/ui/core/view/view-common.ts +++ b/packages/core/ui/core/view/view-common.ts @@ -86,6 +86,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { public touchAnimation: boolean | TouchAnimationOptions; public ignoreTouchAnimation: boolean; + public touchDelay: number; protected _closeModalCallback: Function; public _manager: any; @@ -1208,6 +1209,15 @@ const ignoreTouchAnimationProperty = new Property({ }); ignoreTouchAnimationProperty.register(ViewCommon); +const touchDelayProperty = new Property({ + name: 'touchDelay', + valueChanged(view, oldValue, newValue) { + view.touchDelay = newValue; + }, + valueConverter: (v) => parseFloat(v), +}); +touchDelayProperty.register(ViewCommon); + export const testIDProperty = new Property({ name: 'testID', }); diff --git a/packages/core/ui/gestures/touch-manager.ts b/packages/core/ui/gestures/touch-manager.ts index 9a8267220..09e66fc8c 100644 --- a/packages/core/ui/gestures/touch-manager.ts +++ b/packages/core/ui/gestures/touch-manager.ts @@ -92,7 +92,7 @@ export class TouchManager { if (handleDown || handleUp) { view.on(GestureEvents.gestureAttached, (args: GestureEventData) => { if (args.type === GestureTypes.longPress) { - (args.ios).minimumPressDuration = 0; + (args.ios).minimumPressDuration = (args.object)?.touchDelay || 0; } }); view.on(GestureTypes.longPress, (args: GestureEventDataWithState) => {