1import { SyntheticEvent } from 'react';
2import { ColorValue, NativeSyntheticEvent, ViewProps } from 'react-native';
3
4export type CheckboxEvent = {
5  /**
6   * On native platforms, a `NodeHandle` for the element on which the event has occurred.
7   * On web, a DOM node on which the event has occurred.
8   */
9  target: any;
10  /**
11   * A boolean representing checkbox current value.
12   */
13  value: boolean;
14};
15
16// @needsAudit
17export type CheckboxProps = ViewProps & {
18  /**
19   * Value indicating if the checkbox should be rendered as checked or not.
20   * @default false
21   */
22  value?: boolean;
23  /**
24   * If the checkbox is disabled, it becomes opaque and uncheckable.
25   */
26  disabled?: boolean;
27  /**
28   * The tint or color of the checkbox. This overrides the disabled opaque style.
29   */
30  color?: ColorValue;
31  /**
32   * Callback that is invoked when the user presses the checkbox.
33   * @param event A native event containing the checkbox change.
34   */
35  onChange?: (
36    event: NativeSyntheticEvent<CheckboxEvent> | SyntheticEvent<HTMLInputElement, CheckboxEvent>
37  ) => void;
38  /**
39   * Callback that is invoked when the user presses the checkbox.
40   * @param value A boolean indicating the new checked state of the checkbox.
41   */
42  onValueChange?: (value: boolean) => void;
43};
44