Skip to content

Commit 00968ee

Browse files
committed
Move onChange from FormControlLabel to Radio
1 parent b9951e9 commit 00968ee

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/material-renderers/src/controls/MaterialRadioGroup.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export const MaterialRadioGroup = (props: ControlProps & OwnPropsOfEnum) => {
6565
focused,
6666
appliedUiSchemaOptions.showUnfocusedDescription
6767
);
68-
const onChange = (_ev: any, value: any) => handleChange(path, value);
6968

7069
return (
7170
<Hidden xsUp={!visible}>
@@ -87,12 +86,17 @@ export const MaterialRadioGroup = (props: ControlProps & OwnPropsOfEnum) => {
8786
{label}
8887
</FormLabel>
8988

90-
<RadioGroup value={props.data ?? ''} onChange={onChange} row={true}>
89+
<RadioGroup value={props.data ?? ''} row={true}>
9190
{options.map((option) => (
9291
<FormControlLabel
9392
value={option.value}
9493
key={option.label}
95-
control={<Radio checked={data === option.value} />}
94+
control={
95+
<Radio
96+
checked={data === option.value}
97+
onChange={() => handleChange(path, option.value)}
98+
/>
99+
}
96100
label={option.label}
97101
disabled={!enabled}
98102
/>

0 commit comments

Comments
 (0)