When the props (selected, disabled) changes after a Switch component is initiated , it does not change its shape accordingly, thus I cannot create a controlled Switch.
The props only affects the initial render of a Switch.
A quick example to reproduce the bug:
https://codesandbox.io/s/jvkx6zoj75
When the props (
selected
,disabled
) changes after a Switch component is initiated , it does not change its shape accordingly, thus I cannot create a controlled Switch. The props only affects the initial render of a Switch. A quick example to reproduce the bug: https://codesandbox.io/s/jvkx6zoj75This might be caused by the upstream as stated here: https://github.com/material-components/material-components-web/tree/master/packages/mdc-switch#initially-disabled-switch Maybe we should use
MDCSwitchFoundation.setDisabled
andMDCSwitchFoundation.setChecked
?