var React = require('react'); var Radio = require('./index'); var AntRadioGroup = React.createClass({ getDefaultProps: function () { return { prefixCls: 'ant-radio-group' }; }, getInitialState: function () { var value = null; this.props.children.forEach(function (radio) { if (radio.props && radio.props.checked) { value = radio.props.value; } return false; }); return { selectedValue: value }; }, render: function () { var self = this; var props = self.props; var children = props.children.map(function (radio) { if (radio.props) { return ; } return radio; }); return (
{children}
); }, onRadioChange: function (ev) { this.setState({ selectedValue: ev.target.value }); this.props.onChange(ev); } }); module.exports = AntRadioGroup;