Merge pull request #34195 from franzmoro/master

added CheckBox to react-native
This commit is contained in:
Eloy Durán
2019-03-27 21:03:21 +01:00
committed by GitHub
2 changed files with 42 additions and 0 deletions
+31
View File
@@ -18,6 +18,7 @@
// Souvik Ghosh <https://github.com/souvik-ghosh>
// Cheng Gibson <https://github.com/nossbigg>
// Saransh Kataria <https://github.com/saranshkataria>
// Francesco Moro <https://github.com/franzmoro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -7292,6 +7293,36 @@ export interface CameraRollStatic {
getPhotos(params: GetPhotosParamType): Promise<GetPhotosReturnType>;
}
// 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<CheckBoxProps> {}
/** Clipboard gives you an interface for setting and getting content from Clipboard on both iOS and Android */
export interface ClipboardStatic {
getString(): Promise<string>;
+11
View File
@@ -21,6 +21,7 @@ import {
BackAndroid,
BackHandler,
Button,
CheckBox,
ColorPropType,
DataSourceAssetCallback,
DeviceEventEmitterStatic,
@@ -534,6 +535,16 @@ class MaskedViewTest extends React.Component {
}
}
const CheckboxTest = () => (
<CheckBox
testID="testId"
disabled={false}
onChange={value => { console.log(value); }}
onValueChange={value => { console.log(value); }}
value={true}
/>
);
class InputAccessoryViewTest extends React.Component {
render() {
const uniqueID = "foobar";