@td-design/react-native
Version:
react-native UI组件库
55 lines • 1.64 kB
JavaScript
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 React from 'react';
import Box from '../box';
import { ONE_PIXEL, px } from '../helpers/normalize';
import RadioItem from './RadioItem';
import useRadio from './useRadio';
const RadioList = _ref => {
let {
value,
disabledValue,
defaultValue,
containerStyle,
options,
size = px(24),
onChange,
itemStyle,
activeOpacity = 0.6,
...restProps
} = _ref;
const {
transformedOptions = [],
handleChange
} = useRadio({
options,
disabledValue,
defaultValue,
onChange,
value
});
return /*#__PURE__*/React.createElement(Box, {
style: containerStyle
}, transformedOptions.map(option => {
return /*#__PURE__*/React.createElement(Box, {
key: option.value,
style: itemStyle,
height: px(50),
justifyContent: "center",
alignItems: "flex-start",
paddingLeft: "x1"
}, /*#__PURE__*/React.createElement(RadioItem, _extends({
mode: "list"
}, option, {
size: size,
onChange: handleChange,
activeOpacity
}, restProps)), /*#__PURE__*/React.createElement(Box, {
width: '100%',
height: ONE_PIXEL,
backgroundColor: "border"
}));
}));
};
RadioList.displayName = 'RadioList';
export default RadioList;
//# sourceMappingURL=RadioList.js.map