Skip to content

Commit 6eead26

Browse files
committed
fix(antd): switch should bind 'checked' not 'value'
1 parent 68873fa commit 6eead26

File tree

1 file changed

+3
-3
lines changed
  • packages/ant-component-mapper/src/switch

1 file changed

+3
-3
lines changed

packages/ant-component-mapper/src/switch/switch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Switch = (props) => {
2323
...props,
2424
type: 'checkbox'
2525
});
26-
const { name, value, onChange, onBlur } = input;
26+
const { name, checked, onChange, onBlur } = input;
2727

2828
return (
2929
<FormGroup
@@ -37,9 +37,9 @@ export const Switch = (props) => {
3737
>
3838
<AntSwitch
3939
{...rest}
40-
defaultValue={input.value ? input.value : undefined}
40+
defaultValue={input.checked ? input.checked : undefined}
4141
onChange={onChange}
42-
checked={value}
42+
checked={checked}
4343
name={name}
4444
onClick={onBlur}
4545
checkedChildren={onText}

0 commit comments

Comments
 (0)