From 6d3f88bd989cc4b1927f9a6a4cd9ac64a5d4e72c Mon Sep 17 00:00:00 2001 From: franzmoro Date: Mon, 25 Mar 2019 16:26:31 +0000 Subject: [PATCH 1/2] added react native checkbox --- types/react-native/index.d.ts | 33 ++++++++++++++++++++++++++++++- types/react-native/test/index.tsx | 11 +++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 1c6d6437d9..06eea96fe0 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-native 0.57 +// Type definitions for react-native 0.59 // Project: https://github.com/facebook/react-native // Definitions by: Eloy Durán // HuHuanming @@ -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"; From 344341e0cc1a58a1a8917dc99b50fe7c0ab78d7e Mon Sep 17 00:00:00 2001 From: franzmoro Date: Wed, 27 Mar 2019 16:53:11 +0000 Subject: [PATCH 2/2] reverted to version 0.57 --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 06eea96fe0..99998e9241 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-native 0.59 +// Type definitions for react-native 0.57 // Project: https://github.com/facebook/react-native // Definitions by: Eloy Durán // HuHuanming