[PCCompat > Settings] Properly show SwitchItem changes, return values for settings store

This commit is contained in:
Ducko 2021-06-07 22:19:03 +01:00 committed by Alyxia Sother
parent da87247f5d
commit 549bb1afec
No known key found for this signature in database
GPG Key ID: 355968D14144B739
3 changed files with 27 additions and 2 deletions

View File

@ -4,5 +4,4 @@ export { default as SliderInput } from './sliderInput';
export { default as Divider } from './divider';
export { default as ButtonItem } from './buttonItem';
export { default as Category } from './category';
export const SwitchItem = goosemodScope.webpackModules.findByDisplayName('SwitchItem');
export { default as SwitchItem } from './switchItem';

View File

@ -0,0 +1,22 @@
const { React } = goosemodScope.webpackModules.common;
const SwitchItem = goosemodScope.webpackModules.findByDisplayName('SwitchItem');
export default class SwitchItemContainer extends React.Component {
constructor(props) {
const originalHandler = props.onChange;
props.onChange = (e) => {
originalHandler(e);
this.props.value = e;
this.forceUpdate();
};
super(props);
}
render() {
return React.createElement(SwitchItem, {
...this.props
});
}
}

View File

@ -19,10 +19,14 @@ class SimpleStore {
}
this.store[key] = value;
return this.store[key];
}
toggleSetting = (key) => {
this.store[key] = !this.store[key];
return this.store[key];
}
deleteSetting = (key) => {