feat(TouchManager): touchDelay property for nested tap control

This commit is contained in:
Nathan Walker
2022-04-05 11:26:33 -07:00
parent da3bd2c6fb
commit c05145bd9b
2 changed files with 11 additions and 1 deletions

View File

@ -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<ViewCommon, boolean>({
});
ignoreTouchAnimationProperty.register(ViewCommon);
const touchDelayProperty = new Property<ViewCommon, number>({
name: 'touchDelay',
valueChanged(view, oldValue, newValue) {
view.touchDelay = newValue;
},
valueConverter: (v) => parseFloat(v),
});
touchDelayProperty.register(ViewCommon);
export const testIDProperty = new Property<ViewCommon, string>({
name: 'testID',
});

View File

@ -92,7 +92,7 @@ export class TouchManager {
if (handleDown || handleUp) {
view.on(GestureEvents.gestureAttached, (args: GestureEventData) => {
if (args.type === GestureTypes.longPress) {
(<UILongPressGestureRecognizer>args.ios).minimumPressDuration = 0;
(<UILongPressGestureRecognizer>args.ios).minimumPressDuration = (<View>args.object)?.touchDelay || 0;
}
});
view.on(GestureTypes.longPress, (args: GestureEventDataWithState) => {