UNPKG

react-native-paper

Version:
53 lines 1.75 kB
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import * as React from 'react'; import { Platform } from 'react-native'; import RadioButtonAndroid from './RadioButtonAndroid'; import RadioButtonIOS from './RadioButtonIOS'; import { useInternalTheme } from '../../core/theming'; /** * Radio buttons allow the selection a single option from a set. * * ## Usage * ```js * import * as React from 'react'; * import { View } from 'react-native'; * import { RadioButton } from 'react-native-paper'; * * const MyComponent = () => { * const [checked, setChecked] = React.useState('first'); * * return ( * <View> * <RadioButton * value="first" * status={ checked === 'first' ? 'checked' : 'unchecked' } * onPress={() => setChecked('first')} * /> * <RadioButton * value="second" * status={ checked === 'second' ? 'checked' : 'unchecked' } * onPress={() => setChecked('second')} * /> * </View> * ); * }; * * export default MyComponent; * ``` */ const RadioButton = _ref => { let { theme: themeOverrides, ...props } = _ref; const theme = useInternalTheme(themeOverrides); const Button = Platform.select({ default: RadioButtonAndroid, ios: RadioButtonIOS }); return /*#__PURE__*/React.createElement(Button, _extends({}, props, { theme: theme })); }; export default RadioButton; //# sourceMappingURL=RadioButton.js.map