react-native-paper
Version:
Material design for React Native
107 lines • 3.07 kB
TypeScript
import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';
import type { InternalTheme, MD3TypescaleKey } from '../../types';
export declare type Props = {
/**
* Value of the radio button.
*/
value: string;
/**
* Label to be displayed on the item.
*/
label: string;
/**
* Whether radio is disabled.
*/
disabled?: boolean;
/**
* Function to execute on press.
*/
onPress?: (e: GestureResponderEvent) => void;
/**
* Accessibility label for the touchable. This is read by the screen reader when the user taps the touchable.
*/
accessibilityLabel?: string;
/**
* Custom color for unchecked radio.
*/
uncheckedColor?: string;
/**
* Custom color for radio.
*/
color?: string;
/**
* Status of radio button.
*/
status?: 'checked' | 'unchecked';
/**
* Additional styles for container View.
*/
style?: StyleProp<ViewStyle>;
/**
* Style that is passed to Label element.
*/
labelStyle?: StyleProp<TextStyle>;
/**
* @supported Available in v5.x with theme version 3
*
* Label text variant defines appropriate text styles for type role and its size.
* Available variants:
*
* Display: `displayLarge`, `displayMedium`, `displaySmall`
*
* Headline: `headlineLarge`, `headlineMedium`, `headlineSmall`
*
* Title: `titleLarge`, `titleMedium`, `titleSmall`
*
* Label: `labelLarge`, `labelMedium`, `labelSmall`
*
* Body: `bodyLarge`, `bodyMedium`, `bodySmall`
*/
labelVariant?: keyof typeof MD3TypescaleKey;
/**
* @optional
*/
theme?: InternalTheme;
/**
* testID to be used on tests.
*/
testID?: string;
/**
* Whether `<RadioButton.Android />` or `<RadioButton.IOS />` should be used.
* Left undefined `<RadioButton />` will be used.
*/
mode?: 'android' | 'ios';
/**
* Radio button control position.
*/
position?: 'leading' | 'trailing';
};
/**
* RadioButton.Item allows you to press the whole row (item) instead of only the RadioButton.
*
* ## Usage
* ```js
* import * as React from 'react';
* import { RadioButton } from 'react-native-paper';
*
* const MyComponent = () => {
* const [value, setValue] = React.useState('first');
*
* return (
* <RadioButton.Group onValueChange={value => setValue(value)} value={value}>
* <RadioButton.Item label="First item" value="first" />
* <RadioButton.Item label="Second item" value="second" />
* </RadioButton.Group>
* );
* };
*
* export default MyComponent;
*```
*/
declare const RadioButtonItem: {
({ value, label, style, labelStyle, onPress, disabled, color, uncheckedColor, status, theme: themeOverrides, accessibilityLabel, testID, mode, position, labelVariant, }: Props): JSX.Element;
displayName: string;
};
export default RadioButtonItem;
export { RadioButtonItem };
//# sourceMappingURL=RadioButtonItem.d.ts.map