mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
add: type definition for react-native-check-box (#41400)
This commit is contained in:
committed by
Armando Aguirre
parent
c83e56ca90
commit
863519d139
29
types/react-native-check-box/index.d.ts
vendored
Normal file
29
types/react-native-check-box/index.d.ts
vendored
Normal file
@@ -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 <https://github.com/rlemasquerier>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from 'react';
|
||||
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
||||
|
||||
export interface CheckBoxProps {
|
||||
style?: StyleProp<ViewStyle>;
|
||||
leftText?: string;
|
||||
leftTextStyle?: StyleProp<TextStyle>;
|
||||
leftTextView?: React.ReactNode;
|
||||
rightText?: string;
|
||||
rightTextStyle?: StyleProp<TextStyle>;
|
||||
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<CheckBoxProps> {}
|
||||
|
||||
export default CheckBox;
|
||||
@@ -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 (
|
||||
<CheckBox
|
||||
style={{ margin: 20 }}
|
||||
onClick={() => {
|
||||
console.log('clicked');
|
||||
}}
|
||||
checkBoxColor={'#000'}
|
||||
isChecked={true}
|
||||
leftTextStyle={{ color: 'red', fontSize: 10 }}
|
||||
leftText={'Check me!'}
|
||||
checkedImage={<Image source={{ uri: 'path/to/image.webp' }} />}
|
||||
rightTextView={<View />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
17
types/react-native-check-box/tsconfig.json
Normal file
17
types/react-native-check-box/tsconfig.json
Normal file
@@ -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"]
|
||||
}
|
||||
1
types/react-native-check-box/tslint.json
Normal file
1
types/react-native-check-box/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user