UNPKG

1.7 kBTypeScriptView Raw
1import * as React from 'react';
2import { GestureResponderEvent } from 'react-native';
3import type { ThemeProp } from '../../types';
4export type Props = {
5 /**
6 * Value of the radio button
7 */
8 value: string;
9 /**
10 * Status of radio button.
11 */
12 status?: 'checked' | 'unchecked';
13 /**
14 * Whether radio is disabled.
15 */
16 disabled?: boolean;
17 /**
18 * Function to execute on press.
19 */
20 onPress?: (e: GestureResponderEvent) => void;
21 /**
22 * Custom color for unchecked radio.
23 */
24 uncheckedColor?: string;
25 /**
26 * Custom color for radio.
27 */
28 color?: string;
29 /**
30 * @optional
31 */
32 theme?: ThemeProp;
33 /**
34 * testID to be used on tests.
35 */
36 testID?: string;
37};
38/**
39 * Radio buttons allow the selection a single option from a set.
40 *
41 * ## Usage
42 * ```js
43 * import * as React from 'react';
44 * import { View } from 'react-native';
45 * import { RadioButton } from 'react-native-paper';
46 *
47 * const MyComponent = () => {
48 * const [checked, setChecked] = React.useState('first');
49 *
50 * return (
51 * <View>
52 * <RadioButton
53 * value="first"
54 * status={ checked === 'first' ? 'checked' : 'unchecked' }
55 * onPress={() => setChecked('first')}
56 * />
57 * <RadioButton
58 * value="second"
59 * status={ checked === 'second' ? 'checked' : 'unchecked' }
60 * onPress={() => setChecked('second')}
61 * />
62 * </View>
63 * );
64 * };
65 *
66 * export default MyComponent;
67 * ```
68 */
69declare const RadioButton: ({ theme: themeOverrides, ...props }: Props) => React.JSX.Element;
70export default RadioButton;
71//# sourceMappingURL=RadioButton.d.ts.map
\No newline at end of file