feat: add new configurations

This commit is contained in:
Horiuchi_H
2017-11-24 18:18:17 +09:00
parent 3289762cca
commit ba40bebaf2
3 changed files with 26 additions and 21 deletions
+21 -18
View File
@@ -1,7 +1,8 @@
// Type definitions for react-swipeable 4.0
// Type definitions for react-swipeable 4.2
// Project: https://www.npmjs.com/package/react-swipeable
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Konstantin Vasilev <https://github.com/mctep>
// Hiroki Horiuchi <https://github.com/horiuchi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -10,30 +11,32 @@ import * as React from 'react';
declare class ReactSwipeable extends React.Component<ReactSwipeable.SwipeableProps> {}
declare namespace ReactSwipeable {
type OnSwipingCallback = (event: React.TouchEvent<HTMLElement>, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void;
type OnSwipedCallback = (event: React.TouchEvent<HTMLElement>, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void;
type OnSwipedDirectionCallback = (event: React.TouchEvent<HTMLElement>, delta: number, isFlick: boolean) => void;
type OnSwipingDirectionCallback = (event: React.TouchEvent<HTMLElement>, delta: number) => void;
type OnTapCallback = (event: React.TouchEvent<HTMLElement>) => void;
type OnSwipingCallback<T extends Element = HTMLElement> = (event: React.TouchEvent<T>, deltaX: number, deltaY: number, absX: number, absY: number, velocity: number) => void;
type OnSwipedCallback<T extends Element = HTMLElement> = (event: React.TouchEvent<T>, deltaX: number, deltaY: number, isFlick: boolean, velocity: number) => void;
type OnSwipedDirectionCallback<T extends Element = HTMLElement> = (event: React.TouchEvent<T>, delta: number, isFlick: boolean) => void;
type OnSwipingDirectionCallback<T extends Element = HTMLElement> = (event: React.TouchEvent<T>, delta: number) => void;
type OnTapCallback<T extends Element = HTMLElement> = (event: React.TouchEvent<T>) => void;
interface SwipeableProps extends React.ClassAttributes<ReactSwipeable>, React.HTMLAttributes<HTMLElement> {
onSwiped?: OnSwipedCallback;
onSwiping?: OnSwipingCallback;
onSwipingUp?: OnSwipingDirectionCallback;
onSwipingRight?: OnSwipingDirectionCallback;
onSwipingDown?: OnSwipingDirectionCallback;
onSwipingLeft?: OnSwipingDirectionCallback;
onSwipedUp?: OnSwipedDirectionCallback;
onSwipedRight?: OnSwipedDirectionCallback;
onSwipedDown?: OnSwipedDirectionCallback;
onSwipedLeft?: OnSwipedDirectionCallback;
onTap?: OnTapCallback;
interface SwipeableProps<T extends Element = HTMLElement> extends React.ClassAttributes<ReactSwipeable>, React.HTMLAttributes<T> {
onSwiped?: OnSwipedCallback<T>;
onSwiping?: OnSwipingCallback<T>;
onSwipingUp?: OnSwipingDirectionCallback<T>;
onSwipingRight?: OnSwipingDirectionCallback<T>;
onSwipingDown?: OnSwipingDirectionCallback<T>;
onSwipingLeft?: OnSwipingDirectionCallback<T>;
onSwipedUp?: OnSwipedDirectionCallback<T>;
onSwipedRight?: OnSwipedDirectionCallback<T>;
onSwipedDown?: OnSwipedDirectionCallback<T>;
onSwipedLeft?: OnSwipedDirectionCallback<T>;
onTap?: OnTapCallback<T>;
flickThreshold?: number;
delta?: number;
preventDefaultTouchmoveEvent?: boolean;
stopPropagation?: boolean;
nodeName?: string;
trackMouse?: boolean;
disabled?: boolean;
innerRef?: React.Ref<T>;
children?: React.ReactNode;
}
}
@@ -35,6 +35,8 @@ class SampleComponent extends React.PureComponent<Swipeable.SwipeableProps> {
stopPropagation
nodeName="swipe"
trackMouse
disabled
innerRef="swipe-ref"
onClick={this.handleClick}
>
<div>
+3 -3
View File
@@ -6,8 +6,8 @@
"dom"
],
"noImplicitAny": true,
"noImplicitThis": false,
"strictNullChecks": false,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -22,4 +22,4 @@
"index.d.ts",
"react-swipeable-tests.tsx"
]
}
}