[PCCompat > Settings] Properly show SwitchItem changes, return values for settings store
This commit is contained in:
parent
da87247f5d
commit
549bb1afec
|
@ -4,5 +4,4 @@ export { default as SliderInput } from './sliderInput';
|
||||||
export { default as Divider } from './divider';
|
export { default as Divider } from './divider';
|
||||||
export { default as ButtonItem } from './buttonItem';
|
export { default as ButtonItem } from './buttonItem';
|
||||||
export { default as Category } from './category';
|
export { default as Category } from './category';
|
||||||
|
export { default as SwitchItem } from './switchItem';
|
||||||
export const SwitchItem = goosemodScope.webpackModules.findByDisplayName('SwitchItem');
|
|
|
@ -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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,10 +19,14 @@ class SimpleStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.store[key] = value;
|
this.store[key] = value;
|
||||||
|
|
||||||
|
return this.store[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSetting = (key) => {
|
toggleSetting = (key) => {
|
||||||
this.store[key] = !this.store[key];
|
this.store[key] = !this.store[key];
|
||||||
|
|
||||||
|
return this.store[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteSetting = (key) => {
|
deleteSetting = (key) => {
|
||||||
|
|
Loading…
Reference in New Issue