Fix switch onChange
This commit is contained in:
parent
4d4f5b4b66
commit
1f3bcf1a3c
2 changed files with 8 additions and 4 deletions
|
@ -21,8 +21,8 @@ interface PluginSettingsProps {
|
|||
|
||||
const styles = createStyles({
|
||||
item: {
|
||||
paddingBottom: 5,
|
||||
paddingTop: 5
|
||||
paddingBottom: 10,
|
||||
paddingTop: 10
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -57,7 +57,11 @@ const PluginSettings = withStyles(styles, { name: "PluginSettings" })(
|
|||
)}
|
||||
{configuration.type === "BOOLEAN" && (
|
||||
<ControlledSwitch
|
||||
checked={configuration.value === "true"}
|
||||
checked={
|
||||
typeof configuration.value !== "boolean"
|
||||
? configuration.value === "true"
|
||||
: configuration.value
|
||||
}
|
||||
label={configuration.label}
|
||||
name={configuration.name}
|
||||
onChange={onChange}
|
||||
|
|
|
@ -50,6 +50,7 @@ const PageDetailsPage: React.StatelessComponent<PageDetailsPageProps> = ({
|
|||
description: maybe(() => plugin.description, ""),
|
||||
name: maybe(() => plugin.name, "")
|
||||
};
|
||||
|
||||
return (
|
||||
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
|
||||
{({ data, errors, hasChanged, submit, set, triggerChange }) => {
|
||||
|
@ -63,7 +64,6 @@ const PageDetailsPage: React.StatelessComponent<PageDetailsPageProps> = ({
|
|||
name === "active"
|
||||
? (newData.active = value)
|
||||
: (newData.active = data.active);
|
||||
|
||||
newData.configuration.map(item => {
|
||||
if (item.name === name) {
|
||||
item.value = value;
|
||||
|
|
Loading…
Reference in a new issue