diff --git a/types/react-native-qrcode/index.d.ts b/types/react-native-qrcode/index.d.ts new file mode 100644 index 0000000000..11b54f3a95 --- /dev/null +++ b/types/react-native-qrcode/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for react-native-qrcode 0.2 +// Project: https://github.com/cssivision/react-native-qrcode +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from 'react'; + +export default class QRCode extends React.Component { } + +export interface QRCodeProperties { + value?: string; + size?: number; + bgColor?: string; + fgColor?: string; +} diff --git a/types/react-native-qrcode/react-native-qrcode-tests.tsx b/types/react-native-qrcode/react-native-qrcode-tests.tsx new file mode 100644 index 0000000000..2fd4b22750 --- /dev/null +++ b/types/react-native-qrcode/react-native-qrcode-tests.tsx @@ -0,0 +1,50 @@ +import * as React from 'react'; +import QRCode from 'react-native-qrcode'; + +import { + AppRegistry, + StyleSheet, + View, + TextInput +} from 'react-native'; + +class HelloWorld extends React.Component { + state = { + text: 'http://facebook.github.io/react-native/', + }; + + render() { + return ( + + this.setState({ text })} + value={this.state.text} + /> + + + ); + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: 'white', + alignItems: 'center', + justifyContent: 'center' + }, + + input: { + height: 40, + borderColor: 'gray', + borderWidth: 1, + margin: 10, + borderRadius: 5, + padding: 5, + } +}); diff --git a/types/react-native-qrcode/tsconfig.json b/types/react-native-qrcode/tsconfig.json new file mode 100644 index 0000000000..b21253194b --- /dev/null +++ b/types/react-native-qrcode/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-qrcode-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-qrcode/tslint.json b/types/react-native-qrcode/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-qrcode/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }