1 | import * as React from 'react';
|
2 | import { Platform } from 'react-native';
|
3 | import CheckboxIOS from './CheckboxIOS';
|
4 | import CheckboxAndroid from './CheckboxAndroid';
|
5 | import { withTheme } from '../../core/theming';
|
6 |
|
7 | /**
|
8 | * Checkboxes allow the selection of multiple options from a set.
|
9 | *
|
10 | * <div class="screenshots">
|
11 | * <figure>
|
12 | * <img src="screenshots/checkbox-enabled.android.png" />
|
13 | * <figcaption>Android (enabled)</figcaption>
|
14 | * </figure>
|
15 | * <figure>
|
16 | * <img src="screenshots/checkbox-disabled.android.png" />
|
17 | * <figcaption>Android (disabled)</figcaption>
|
18 | * </figure>
|
19 | * <figure>
|
20 | * <img src="screenshots/checkbox-enabled.ios.png" />
|
21 | * <figcaption>iOS (enabled)</figcaption>
|
22 | * </figure>
|
23 | * <figure>
|
24 | * <img src="screenshots/checkbox-disabled.ios.png" />
|
25 | * <figcaption>iOS (disabled)</figcaption>
|
26 | * </figure>
|
27 | * </div>
|
28 | *
|
29 | * ## Usage
|
30 | * ```js
|
31 | * import * as React from 'react';
|
32 | * import { Checkbox } from 'react-native-paper';
|
33 | *
|
34 | * const MyComponent = () => {
|
35 | * const [checked, setChecked] = React.useState(false);
|
36 | *
|
37 | * return (
|
38 | * <Checkbox
|
39 | * status={checked ? 'checked' : 'unchecked'}
|
40 | * onPress={() => {
|
41 | * setChecked(!checked);
|
42 | * }}
|
43 | * />
|
44 | * );
|
45 | * };
|
46 | *
|
47 | * export default MyComponent;
|
48 | * ```
|
49 | */
|
50 | const Checkbox = props => Platform.OS === 'ios' ? /*#__PURE__*/React.createElement(CheckboxIOS, props) : /*#__PURE__*/React.createElement(CheckboxAndroid, props);
|
51 |
|
52 | export default withTheme(Checkbox); // @component-docs ignore-next-line
|
53 |
|
54 | const CheckboxWithTheme = withTheme(Checkbox); // @component-docs ignore-next-line
|
55 |
|
56 | export { CheckboxWithTheme as Checkbox };
|
57 | //# sourceMappingURL=Checkbox.js.map |
\ | No newline at end of file |