mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
feat(TouchManager): touchDelay property for nested tap control
This commit is contained in:
@ -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',
|
||||
});
|
||||
|
@ -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) => {
|
||||
|
Reference in New Issue
Block a user