mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[PCCompat > Settings] Properly show SwitchItem changes, return values for settings store
This commit is contained in:
parent
da87247f5d
commit
549bb1afec
3 changed files with 27 additions and 2 deletions
|
@ -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');
|
|
22
moduleWrappers/powercord/components/settings/switchItem.js
Normal file
22
moduleWrappers/powercord/components/settings/switchItem.js
Normal 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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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…
Add table
Add a link
Reference in a new issue