Merge pull request #22555 from plantain-00/react-native-qrcode

add types of react-native-qrcode
This commit is contained in:
Paul van Brenk
2017-12-29 11:15:52 -08:00
committed by GitHub
4 changed files with 92 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for react-native-qrcode 0.2
// Project: https://github.com/cssivision/react-native-qrcode
// Definitions by: York Yao <https://github.com/plantain-00>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as React from 'react';
export default class QRCode extends React.Component<QRCodeProperties> { }
export interface QRCodeProperties {
value?: string;
size?: number;
bgColor?: string;
fgColor?: string;
}
@@ -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 (
<View style={styles.container}>
<TextInput
style={styles.input}
onChangeText={(text) => this.setState({ text })}
value={this.state.text}
/>
<QRCode
value={this.state.text}
size={200}
bgColor='purple'
fgColor='white' />
</View>
);
}
}
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,
}
});
+25
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }