mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
add types of react-native-qrcode
This commit is contained in:
16
types/react-native-qrcode/index.d.ts
vendored
Normal file
16
types/react-native-qrcode/index.d.ts
vendored
Normal 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;
|
||||
}
|
||||
50
types/react-native-qrcode/react-native-qrcode-tests.tsx
Normal file
50
types/react-native-qrcode/react-native-qrcode-tests.tsx
Normal file
@@ -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
types/react-native-qrcode/tsconfig.json
Normal file
25
types/react-native-qrcode/tsconfig.json
Normal 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
types/react-native-qrcode/tslint.json
Normal file
1
types/react-native-qrcode/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user