mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
Added usage test
This commit is contained in:
2
types/react-resize-detector/index.d.ts
vendored
2
types/react-resize-detector/index.d.ts
vendored
@@ -21,4 +21,4 @@ interface ReactResizeDetectorProps extends React.Props<ReactResizeDetector> {
|
||||
|
||||
declare class ReactResizeDetector extends React.PureComponent<ReactResizeDetectorProps> { }
|
||||
|
||||
export = ReactResizeDetector;
|
||||
export default ReactResizeDetector;
|
||||
|
||||
31
types/react-resize-detector/react-resize-detector-tests.tsx
Normal file
31
types/react-resize-detector/react-resize-detector-tests.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
// Adapted from example provided at https://github.com/maslianok/react-resize-detector
|
||||
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
|
||||
import ReactResizeRouter from "./index";
|
||||
|
||||
class App extends React.PureComponent {
|
||||
constructor(props: {}) {
|
||||
super(props);
|
||||
|
||||
this.handleResize = this.handleResize.bind;
|
||||
}
|
||||
|
||||
render(): JSX.Element {
|
||||
return <div>
|
||||
<div>Some child content</div>
|
||||
<ReactResizeRouter
|
||||
onResize={this.handleResize}
|
||||
handleWidth
|
||||
handleHeight
|
||||
skipOnMount
|
||||
resizableElementId="someElement" />
|
||||
</div>;
|
||||
}
|
||||
|
||||
private handleResize(width: number, height: number) {
|
||||
console.log(`width = ${width}`);
|
||||
console.log(`height = ${height}`);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"jsx": "react",
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -17,6 +19,7 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
"index.d.ts",
|
||||
"react-resize-detector-tests.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user