mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
[react-hammerjs]: Update to v1.0 (#28508)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
a6e137333d
commit
4203215339
19
types/react-hammerjs/index.d.ts
vendored
19
types/react-hammerjs/index.d.ts
vendored
@@ -1,21 +1,30 @@
|
||||
// Type definitions for react-hammerjs 0.5
|
||||
// Type definitions for react-hammerjs 1.0
|
||||
// Project: https://github.com/JedWatson/react-hammerjs#readme
|
||||
// Definitions by: Jason Unger <https://github.com/jsonunger>
|
||||
// Cecchi MacNaughton <https://github.com/cecchi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as Hammer from 'hammerjs';
|
||||
import * as React from 'react';
|
||||
import * as Hammer from "hammerjs";
|
||||
import * as React from "react";
|
||||
|
||||
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
type HammerOptionsWithRecognizers = Omit<HammerOptions, 'recognizers'> & {
|
||||
type HammerOptionsWithRecognizers = Omit<HammerOptions, "recognizers"> & {
|
||||
recognizers?: { [gesture: string]: RecognizerOptions };
|
||||
};
|
||||
|
||||
declare namespace ReactHammer {
|
||||
interface ReactHammerProps {
|
||||
direction?: number;
|
||||
direction?:
|
||||
| "DIRECTION_NONE"
|
||||
| "DIRECTION_LEFT"
|
||||
| "DIRECTION_RIGHT"
|
||||
| "DIRECTION_UP"
|
||||
| "DIRECTION_DOWN"
|
||||
| "DIRECTION_HORIZONTAL"
|
||||
| "DIRECTION_VERTICAL"
|
||||
| "DIRECTION_ALL";
|
||||
options?: HammerOptionsWithRecognizers;
|
||||
recognizeWith?: { [gesture: string]: Recognizer | string };
|
||||
vertical?: boolean;
|
||||
|
||||
45
types/react-hammerjs/v0/index.d.ts
vendored
Normal file
45
types/react-hammerjs/v0/index.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// Type definitions for react-hammerjs 0.5
|
||||
// Project: https://github.com/JedWatson/react-hammerjs#readme
|
||||
// Definitions by: Jason Unger <https://github.com/jsonunger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as Hammer from 'hammerjs';
|
||||
import * as React from 'react';
|
||||
|
||||
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
type HammerOptionsWithRecognizers = Omit<HammerOptions, 'recognizers'> & {
|
||||
recognizers?: { [gesture: string]: RecognizerOptions };
|
||||
};
|
||||
|
||||
declare namespace ReactHammer {
|
||||
interface ReactHammerProps {
|
||||
direction?: number;
|
||||
options?: HammerOptionsWithRecognizers;
|
||||
recognizeWith?: { [gesture: string]: Recognizer | string };
|
||||
vertical?: boolean;
|
||||
action?: HammerListener;
|
||||
onDoubleTap?: HammerListener;
|
||||
onPan?: HammerListener;
|
||||
onPanCancel?: HammerListener;
|
||||
onPanEnd?: HammerListener;
|
||||
onPanStart?: HammerListener;
|
||||
onPinch?: HammerListener;
|
||||
onPinchCancel?: HammerListener;
|
||||
onPinchEnd?: HammerListener;
|
||||
onPinchIn?: HammerListener;
|
||||
onPinchStart?: HammerListener;
|
||||
onPress?: HammerListener;
|
||||
onPressUp?: HammerListener;
|
||||
onRotate?: HammerListener;
|
||||
onRotateCancel?: HammerListener;
|
||||
onRotateEnd?: HammerListener;
|
||||
onRotateMove?: HammerListener;
|
||||
onRotateStart?: HammerListener;
|
||||
onSwipe?: HammerListener;
|
||||
onTap?: HammerListener;
|
||||
}
|
||||
}
|
||||
declare const ReactHammer: React.ComponentClass<ReactHammer.ReactHammerProps>;
|
||||
export = ReactHammer;
|
||||
17
types/react-hammerjs/v0/react-hammerjs-tests.tsx
Normal file
17
types/react-hammerjs/v0/react-hammerjs-tests.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import * as React from 'react';
|
||||
import Hammer from 'react-hammerjs';
|
||||
|
||||
class ReactHammer extends React.Component<Hammer.ReactHammerProps> {
|
||||
swipe: Hammer.ReactHammerProps['onSwipe'] = input => {
|
||||
console.log(input.deltaX);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, ...props } = this.props;
|
||||
return (
|
||||
<Hammer onSwipe={this.swipe} {...props}>
|
||||
{children}
|
||||
</Hammer>
|
||||
);
|
||||
}
|
||||
}
|
||||
21
types/react-hammerjs/v0/tsconfig.json
Normal file
21
types/react-hammerjs/v0/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": ["../../"],
|
||||
"paths": {
|
||||
"react-hammerjs": ["react-hammerjs/v0"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": ["index.d.ts", "react-hammerjs-tests.tsx"]
|
||||
}
|
||||
1
types/react-hammerjs/v0/tslint.json
Normal file
1
types/react-hammerjs/v0/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user