UNPKG

3.71 kBTypeScriptView Raw
1import * as React from 'react';
2import { ColorValue, GestureResponderEvent, PressableAndroidRippleConfig, StyleProp, TextStyle, ViewStyle } from 'react-native';
3import type { ThemeProp, MD3TypescaleKey } from '../../types';
4export type Props = {
5 /**
6 * Value of the radio button.
7 */
8 value: string;
9 /**
10 * Label to be displayed on the item.
11 */
12 label: string;
13 /**
14 * Whether radio is disabled.
15 */
16 disabled?: boolean;
17 /**
18 * Type of background drawabale to display the feedback (Android).
19 * https://reactnative.dev/docs/pressable#rippleconfig
20 */
21 background?: PressableAndroidRippleConfig;
22 /**
23 * Function to execute on press.
24 */
25 onPress?: (e: GestureResponderEvent) => void;
26 /**
27 * Function to execute on long press.
28 */
29 onLongPress?: (e: GestureResponderEvent) => void;
30 /**
31 * Accessibility label for the touchable. This is read by the screen reader when the user taps the touchable.
32 */
33 accessibilityLabel?: string;
34 /**
35 * Custom color for unchecked radio.
36 */
37 uncheckedColor?: string;
38 /**
39 * Custom color for radio.
40 */
41 color?: string;
42 /**
43 * Color of the ripple effect.
44 */
45 rippleColor?: ColorValue;
46 /**
47 * Status of radio button.
48 */
49 status?: 'checked' | 'unchecked';
50 /**
51 * Additional styles for container View.
52 */
53 style?: StyleProp<ViewStyle>;
54 /**
55 * Style that is passed to Label element.
56 */
57 labelStyle?: StyleProp<TextStyle>;
58 /**
59 * @supported Available in v5.x with theme version 3
60 *
61 * Label text variant defines appropriate text styles for type role and its size.
62 * Available variants:
63 *
64 * Display: `displayLarge`, `displayMedium`, `displaySmall`
65 *
66 * Headline: `headlineLarge`, `headlineMedium`, `headlineSmall`
67 *
68 * Title: `titleLarge`, `titleMedium`, `titleSmall`
69 *
70 * Label: `labelLarge`, `labelMedium`, `labelSmall`
71 *
72 * Body: `bodyLarge`, `bodyMedium`, `bodySmall`
73 */
74 labelVariant?: keyof typeof MD3TypescaleKey;
75 /**
76 * Specifies the largest possible scale a label font can reach.
77 */
78 labelMaxFontSizeMultiplier?: number;
79 /**
80 * @optional
81 */
82 theme?: ThemeProp;
83 /**
84 * testID to be used on tests.
85 */
86 testID?: string;
87 /**
88 * Whether `<RadioButton.Android />` or `<RadioButton.IOS />` should be used.
89 * Left undefined `<RadioButton />` will be used.
90 */
91 mode?: 'android' | 'ios';
92 /**
93 * Radio button control position.
94 */
95 position?: 'leading' | 'trailing';
96};
97/**
98 * RadioButton.Item allows you to press the whole row (item) instead of only the RadioButton.
99 *
100 * ## Usage
101 * ```js
102 * import * as React from 'react';
103 * import { RadioButton } from 'react-native-paper';
104 *
105 * const MyComponent = () => {
106 * const [value, setValue] = React.useState('first');
107 *
108 * return (
109 * <RadioButton.Group onValueChange={value => setValue(value)} value={value}>
110 * <RadioButton.Item label="First item" value="first" />
111 * <RadioButton.Item label="Second item" value="second" />
112 * </RadioButton.Group>
113 * );
114 * };
115 *
116 * export default MyComponent;
117 *```
118 */
119declare const RadioButtonItem: {
120 ({ value, label, style, labelStyle, onPress, onLongPress, disabled, color, uncheckedColor, rippleColor, status, theme: themeOverrides, background, accessibilityLabel, testID, mode, position, labelVariant, labelMaxFontSizeMultiplier, }: Props): React.JSX.Element;
121 displayName: string;
122};
123export default RadioButtonItem;
124export { RadioButtonItem };
125//# sourceMappingURL=RadioButtonItem.d.ts.map
\No newline at end of file