mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
parent
8f81594f91
commit
54b49afd32
@ -1,7 +1,5 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import Radio from './radio';
|
||||
import RadioButton from './radioButton';
|
||||
import PureRenderMixin from 'rc-util/lib/PureRenderMixin';
|
||||
import assign from 'object-assign';
|
||||
|
||||
@ -87,7 +85,7 @@ export default class RadioGroup extends React.Component<RadioGroupProps, any> {
|
||||
render() {
|
||||
const props = this.props;
|
||||
const children = !props.children ? [] : React.Children.map(props.children, (radio: any) => {
|
||||
if (radio && (radio.type === Radio || radio.type === RadioButton) && radio.props) {
|
||||
if (radio && radio.type && (radio.type.__ANT_RADIO || radio.type.__ANT_RADIO_BUTTON) && radio.props) {
|
||||
return React.cloneElement(radio, assign({}, radio.props, {
|
||||
onChange: this.onRadioChange,
|
||||
checked: this.state.value === radio.props.value,
|
||||
|
@ -20,6 +20,8 @@ export interface RadioProps {
|
||||
}
|
||||
|
||||
export default class Radio extends React.Component<RadioProps, any> {
|
||||
static __ANT_RADIO = true;
|
||||
|
||||
static Group: any;
|
||||
static Button: any;
|
||||
|
||||
|
@ -7,6 +7,8 @@ export interface RadioButtonProps {
|
||||
}
|
||||
|
||||
export default class RadioButton extends React.Component<RadioButtonProps, any> {
|
||||
static __ANT_RADIO_BUTTON = true;
|
||||
|
||||
static defaultProps = {
|
||||
prefixCls: 'ant-radio-button',
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user