Fix radio style prop

This commit is contained in:
afc163 2016-03-04 12:07:17 +08:00
parent 958a74e028
commit a45ed7ee4c
2 changed files with 12 additions and 13 deletions

View File

@ -13,27 +13,26 @@ const RadioGroup = Radio.Group;
const App = React.createClass({
getInitialState() {
return {
value: 1
value: 1,
};
},
onChange(e) {
console.log('radio checked', e.target.value);
this.setState({
value: e.target.value
value: e.target.value,
});
},
render() {
return (
<div>
<RadioGroup onChange={this.onChange} value={this.state.value}>
<Radio key="a" value={1}>A</Radio>
<Radio key="b" value={2}>B</Radio>
<Radio key="c" value={3}>C</Radio>
<Radio key="d" value={null}>D</Radio>
</RadioGroup>
</div>
<RadioGroup onChange={this.onChange} value={this.state.value}>
<Radio key="a" value={1}>A</Radio>
<Radio key="b" value={2}>B</Radio>
<Radio key="c" value={3}>C</Radio>
<Radio key="d" value={null}>D</Radio>
</RadioGroup>
);
}
});
ReactDOM.render(<App />, mountNode);
````

View File

@ -9,7 +9,7 @@ const AntRadio = React.createClass({
};
},
render() {
const { prefixCls, children, checked, disabled, className } = this.props;
const { prefixCls, children, checked, disabled, className, style } = this.props;
const classString = classNames({
[prefixCls]: true,
[`${prefixCls}-checked`]: checked,
@ -17,8 +17,8 @@ const AntRadio = React.createClass({
[className]: !!className,
});
return (
<label className={classString}>
<Radio {...this.props} children={null} />
<label className={classString} style={style}>
<Radio {...this.props} style={null} children={null} />
{children}
</label>
);