react-native-paper
Version:
Material design for React Native
67 lines (66 loc) • 1.77 kB
TypeScript
import * as React from 'react';
declare type Props = {
/**
* Function to execute on selection change.
*/
onValueChange: (value: string) => void;
/**
* Value of the currently selected radio button.
*/
value: string;
/**
* React elements containing radio buttons.
*/
children: React.ReactNode;
};
export declare type RadioButtonContextType = {
value: string;
onValueChange: (item: string) => void;
};
export declare const RadioButtonContext: React.Context<RadioButtonContextType>;
/**
* Radio button group allows to control a group of radio buttons.
*
* <div class="screenshots">
* <figure>
* <img class="medium" src="screenshots/radio-button-group-android.gif" />
* <figcaption>Android</figcaption>
* </figure>
* <figure>
* <img class="medium" src="screenshots/radio-button-group-ios.gif" />
* <figcaption>iOS</figcaption>
* </figure>
* </div>
*
* ## Usage
* ```js
* import * as React from 'react';
* import { View } from 'react-native';
* import { RadioButton, Text } from 'react-native-paper';
*
* const MyComponent = () => {
* const [value, setValue] = React.useState('first');
*
* return (
* <RadioButton.Group onValueChange={newValue => setValue(newValue)} value={value}>
* <View>
* <Text>First</Text>
* <RadioButton value="first" />
* </View>
* <View>
* <Text>Second</Text>
* <RadioButton value="second" />
* </View>
* </RadioButton.Group>
* );
* };
*
* export default MyComponent;
*```
*/
declare const RadioButtonGroup: {
({ value, onValueChange, children }: Props): JSX.Element;
displayName: string;
};
export default RadioButtonGroup;
export { RadioButtonGroup };