mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 19:43:20 +08:00
Added declaration of JodusNodus/react-qr-reader (#27665)
* Added declaration of JodusNodus/react-qr-reader * lint fix * Fix react-qr-reader issues * Fix delay type and add event param for onImageLoad func
This commit is contained in:
committed by
Sheetal Nandi
parent
ac91f0945d
commit
25ea12a5d2
30
types/react-qr-reader/index.d.ts
vendored
Normal file
30
types/react-qr-reader/index.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Type definitions for react-qr-reader 2.1
|
||||
// Project: https://github.com/JodusNodus/react-qr-reader
|
||||
// Definitions by: David Kevork <https://github.com/davidkevork>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
export as namespace QrReader;
|
||||
|
||||
export default QrReader;
|
||||
|
||||
export namespace QrReader {
|
||||
interface props {
|
||||
onScan: (data: string | null) => void;
|
||||
onError: (err: any) => void;
|
||||
onLoad?: () => void;
|
||||
onImageLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
|
||||
delay?: number | false;
|
||||
facingMode?: 'user' | 'environment';
|
||||
legacyMode?: boolean;
|
||||
resolution?: number;
|
||||
showViewFinder?: boolean;
|
||||
style?: any;
|
||||
className?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare class QrReader extends React.Component<QrReader.props> {
|
||||
}
|
||||
14
types/react-qr-reader/react-qr-reader-tests.tsx
Normal file
14
types/react-qr-reader/react-qr-reader-tests.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as React from "react";
|
||||
import QrReader from "react-qr-reader";
|
||||
|
||||
export class Test extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<QrReader
|
||||
onError={(err) => { console.log(err); }}
|
||||
onScan={(data) => { console.log(data); }}
|
||||
facingMode={'user'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
25
types/react-qr-reader/tsconfig.json
Normal file
25
types/react-qr-reader/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-qr-reader-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-qr-reader/tslint.json
Normal file
1
types/react-qr-reader/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user