From 863519d139a1cc4afcbda4aaddf2843e71126c19 Mon Sep 17 00:00:00 2001 From: Rodolphe Lemasquerier Date: Fri, 10 Jan 2020 20:38:12 +0100 Subject: [PATCH] add: type definition for react-native-check-box (#41400) --- types/react-native-check-box/index.d.ts | 29 +++++++++++++++++++ .../react-native-check-box-tests.tsx | 22 ++++++++++++++ types/react-native-check-box/tsconfig.json | 17 +++++++++++ types/react-native-check-box/tslint.json | 1 + 4 files changed, 69 insertions(+) create mode 100644 types/react-native-check-box/index.d.ts create mode 100644 types/react-native-check-box/react-native-check-box-tests.tsx create mode 100644 types/react-native-check-box/tsconfig.json create mode 100644 types/react-native-check-box/tslint.json diff --git a/types/react-native-check-box/index.d.ts b/types/react-native-check-box/index.d.ts new file mode 100644 index 0000000000..62efe2a79b --- /dev/null +++ b/types/react-native-check-box/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for react-native-check-box 2.1 +// Project: https://github.com/crazycodeboy/react-native-check-box#readme +// Definitions by: Rodolphe Lemasquerier +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from 'react'; +import { StyleProp, TextStyle, ViewStyle } from 'react-native'; + +export interface CheckBoxProps { + style?: StyleProp; + leftText?: string; + leftTextStyle?: StyleProp; + leftTextView?: React.ReactNode; + rightText?: string; + rightTextStyle?: StyleProp; + rightTextView?: React.ReactNode; + checkedImage?: React.ReactElement; + uncheckedImage?: React.ReactElement; + isChecked: boolean; + onClick: () => void; + disabled?: boolean; + checkBoxColor?: string; + checkedCheckBoxColor?: string; + uncheckedCheckBoxColor?: string; +} + +declare class CheckBox extends React.Component {} + +export default CheckBox; diff --git a/types/react-native-check-box/react-native-check-box-tests.tsx b/types/react-native-check-box/react-native-check-box-tests.tsx new file mode 100644 index 0000000000..68035b4ed8 --- /dev/null +++ b/types/react-native-check-box/react-native-check-box-tests.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import CheckBox from 'react-native-check-box'; +import { View, Image } from 'react-native'; + +export default class MyCheckBox extends React.Component { + render() { + return ( + { + console.log('clicked'); + }} + checkBoxColor={'#000'} + isChecked={true} + leftTextStyle={{ color: 'red', fontSize: 10 }} + leftText={'Check me!'} + checkedImage={} + rightTextView={} + /> + ); + } +} diff --git a/types/react-native-check-box/tsconfig.json b/types/react-native-check-box/tsconfig.json new file mode 100644 index 0000000000..1142a6c5e4 --- /dev/null +++ b/types/react-native-check-box/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "es2017"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": ["index.d.ts", "react-native-check-box-tests.tsx"] +} diff --git a/types/react-native-check-box/tslint.json b/types/react-native-check-box/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-check-box/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }