Skip to content

Commit

Permalink
fix(radio): onChange trigger twice when uncheck (#1422)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lmmmmmm-bb authored Sep 5, 2022
1 parent c90bffd commit 7698c35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/Check.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const Check = forwardRef((_props: CheckProps, ref: Ref<HTMLLabelElement>) => {
value={isBoolean(value) ? Number(value) : value}
onClick={(e) => {
e.stopPropagation();
if ((type === 'radio-button' || type === 'radio') && allowUncheck) {
if ((type === 'radio-button' || type === 'radio') && allowUncheck && internalChecked) {
setInternalChecked(!e.currentTarget.checked, { e });
}
}}
Expand Down

0 comments on commit 7698c35

Please sign in to comment.