Skip to content

Commit 241ec17

Browse files
committed
fixed radio buttons
1 parent 7c8d0da commit 241ec17

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Input.jsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,16 @@ export default class Input extends Element {
145145
}
146146

147147
render() {
148-
const value = this.getValue();
148+
let value = this.getValue();
149149
const { type, path, originalValue } = this.props;
150150
const checked = (type === 'checkbox' && value)
151151
|| (type === 'radio' && value === originalValue);
152152

153+
if (type === 'radio' && originalValue) {
154+
value = originalValue;
155+
}
156+
157+
const isCheckbox = type === 'checkbox' || type === 'radio';
153158
const inputProps = clearProps(this.props);
154159

155160
return (
@@ -161,7 +166,7 @@ export default class Input extends Element {
161166
onFocus={this.onFocus}
162167
onBlur={this.onBlur}
163168
onKeyPress={this.onKeyPress}
164-
checked={checked || void 0}
169+
checked={isCheckbox ? checked : void 0}
165170
value={value}
166171
/>
167172
);

0 commit comments

Comments
 (0)