Skip to content

Commit

Permalink
fix(Radio): 使RadioButton更符合radio行为,而不是checked
Browse files Browse the repository at this point in the history
  • Loading branch information
nullptr-z committed Apr 19, 2022
1 parent 120d757 commit 3c64953
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react-radio/src/RadioButton.tsx
Expand Up @@ -52,8 +52,10 @@ export const RadioButton = React.forwardRef<any, RadioButtonProps>((props, ref)

function handleChange(e: React.MouseEvent<HTMLButtonElement, MouseEvent> & MouseEvent) {
e.persist();
setChecked(!checked);
onChange && onChange(value);
if (!checked) {
setChecked(!checked);
onChange && onChange(value);
}
}

const label = children || value;
Expand Down

0 comments on commit 3c64953

Please sign in to comment.