Skip to content

Commit 3c64953

Browse files
committedApr 19, 2022
fix(Radio): 使RadioButton更符合radio行为,而不是checked
1 parent 120d757 commit 3c64953

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎packages/react-radio/src/RadioButton.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ export const RadioButton = React.forwardRef<any, RadioButtonProps>((props, ref)
5252

5353
function handleChange(e: React.MouseEvent<HTMLButtonElement, MouseEvent> & MouseEvent) {
5454
e.persist();
55-
setChecked(!checked);
56-
onChange && onChange(value);
55+
if (!checked) {
56+
setChecked(!checked);
57+
onChange && onChange(value);
58+
}
5759
}
5860

5961
const label = children || value;

0 commit comments

Comments
 (0)
Please sign in to comment.