diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 1c6d6437d9..99998e9241 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -18,6 +18,7 @@ // Souvik Ghosh // Cheng Gibson // Saransh Kataria +// Francesco Moro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -7292,6 +7293,36 @@ export interface CameraRollStatic { getPhotos(params: GetPhotosParamType): Promise; } +// https://facebook.github.io/react-native/docs/checkbox.html +export interface CheckBoxProps extends ViewProps { + /** + * If true the user won't be able to toggle the checkbox. Default value is false. + */ + disabled?: boolean; + + /** + * Used in case the props change removes the component. + */ + onChange?: (value: boolean) => void; + + /** + * Invoked with the new value when the value changes. + */ + onValueChange?: (value: boolean) => void; + + /** + * Used to locate this view in end-to-end tests. + */ + testID?: string; + + /** + * The value of the checkbox. If true the checkbox will be turned on. Default value is false. + */ + value?: boolean; +} + +export class CheckBox extends React.Component {} + /** Clipboard gives you an interface for setting and getting content from Clipboard on both iOS and Android */ export interface ClipboardStatic { getString(): Promise; diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 49e1bab1ac..7de9b96374 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -21,6 +21,7 @@ import { BackAndroid, BackHandler, Button, + CheckBox, ColorPropType, DataSourceAssetCallback, DeviceEventEmitterStatic, @@ -534,6 +535,16 @@ class MaskedViewTest extends React.Component { } } +const CheckboxTest = () => ( + { console.log(value); }} + onValueChange={value => { console.log(value); }} + value={true} + /> +); + class InputAccessoryViewTest extends React.Component { render() { const uniqueID = "foobar";