UNPKG

1.49 kBTypeScriptView Raw
1import * as React from 'react';
2export type Props = {
3 /**
4 * Function to execute on selection change.
5 */
6 onValueChange: (value: string) => void;
7 /**
8 * Value of the currently selected radio button.
9 */
10 value: string;
11 /**
12 * React elements containing radio buttons.
13 */
14 children: React.ReactNode;
15};
16export type RadioButtonContextType = {
17 value: string;
18 onValueChange: (item: string) => void;
19};
20export declare const RadioButtonContext: React.Context<RadioButtonContextType>;
21/**
22 * Radio button group allows to control a group of radio buttons.
23 *
24 * ## Usage
25 * ```js
26 * import * as React from 'react';
27 * import { View } from 'react-native';
28 * import { RadioButton, Text } from 'react-native-paper';
29 *
30 * const MyComponent = () => {
31 * const [value, setValue] = React.useState('first');
32 *
33 * return (
34 * <RadioButton.Group onValueChange={newValue => setValue(newValue)} value={value}>
35 * <View>
36 * <Text>First</Text>
37 * <RadioButton value="first" />
38 * </View>
39 * <View>
40 * <Text>Second</Text>
41 * <RadioButton value="second" />
42 * </View>
43 * </RadioButton.Group>
44 * );
45 * };
46 *
47 * export default MyComponent;
48 *```
49 */
50declare const RadioButtonGroup: {
51 ({ value, onValueChange, children }: Props): React.JSX.Element;
52 displayName: string;
53};
54export default RadioButtonGroup;
55export { RadioButtonGroup };
56//# sourceMappingURL=RadioButtonGroup.d.ts.map
\No newline at end of file