Skip to content

Commit ad12c40

Browse files
committed
fix(RedioGroup): bind the value to Field Formik component.
1 parent 57777a4 commit ad12c40

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/core/src/components/RadioGroup.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ interface FieldToRadioGroupProps
2424
* @returns {BPRadioGroupProps}
2525
*/
2626
export function fieldToRadioGroup({
27-
field: { onChange, ...field },
27+
field,
2828
form,
29+
onChange,
2930
...props
3031
}: FieldToRadioGroupProps): BPRadioGroupProps {
3132
return {
3233
selectedValue: field.value,
33-
onChange,
34+
onChange:
35+
onChange ??
36+
function (event: React.FormEvent<HTMLInputElement>) {
37+
form.setFieldValue(field.name, event.currentTarget.value);
38+
},
3439
...props,
3540
};
3641
}

0 commit comments

Comments
 (0)