UNPKG

react-native-paper

Version:
80 lines 2.07 kB
import { GestureResponderEvent } from 'react-native'; import type { ThemeProp } from '../../types'; export declare type Props = { /** * Status of checkbox. */ status: 'checked' | 'unchecked' | 'indeterminate'; /** * Whether checkbox is disabled. */ disabled?: boolean; /** * Function to execute on press. */ onPress?: (e: GestureResponderEvent) => void; /** * Custom color for unchecked checkbox. */ uncheckedColor?: string; /** * Custom color for checkbox. */ color?: string; /** * @optional */ theme?: ThemeProp; /** * testID to be used on tests. */ testID?: string; }; /** * Checkboxes allow the selection of multiple options from a set. * * <div class="screenshots"> * <figure> * <img src="screenshots/checkbox-enabled.android.png" /> * <figcaption>Android (enabled)</figcaption> * </figure> * <figure> * <img src="screenshots/checkbox-disabled.android.png" /> * <figcaption>Android (disabled)</figcaption> * </figure> * <figure> * <img src="screenshots/checkbox-enabled.ios.png" /> * <figcaption>iOS (enabled)</figcaption> * </figure> * <figure> * <img src="screenshots/checkbox-disabled.ios.png" /> * <figcaption>iOS (disabled)</figcaption> * </figure> * </div> * * ## Usage * ```js * import * as React from 'react'; * import { Checkbox } from 'react-native-paper'; * * const MyComponent = () => { * const [checked, setChecked] = React.useState(false); * * return ( * <Checkbox * status={checked ? 'checked' : 'unchecked'} * onPress={() => { * setChecked(!checked); * }} * /> * ); * }; * * export default MyComponent; * ``` */ declare const Checkbox: ({ theme: themeOverrides, ...props }: Props) => JSX.Element; export default Checkbox; declare const CheckboxWithTheme: ({ theme: themeOverrides, ...props }: Props) => JSX.Element; export { CheckboxWithTheme as Checkbox }; //# sourceMappingURL=Checkbox.d.ts.map