You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
876 B

import RcRadio from 'rc-radio';
import React from 'react';
import classNames from 'classnames';
import PureRenderMixin from 'react-addons-pure-render-mixin';
export default class Radio extends React.Component {
static defaultProps = {
prefixCls: 'ant-radio',
}
shouldComponentUpdate(...args) {
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
}
render() {
const { prefixCls, children, checked, disabled, className, style } = this.props;
const classString = classNames({
[`${prefixCls}`]: true,
[`${prefixCls}-checked`]: checked,
[`${prefixCls}-disabled`]: disabled,
[className]: !!className,
});
return (
<label className={classString} style={style}>
<RcRadio {...this.props} style={null} children={null} />
{children ? <span>{children}</span> : null}
</label>
);
}
}