fixed toggle click state change bug
This commit is contained in:
parent
f3b44c5560
commit
3d282f45fa
2 changed files with 3 additions and 4 deletions
|
@ -33,7 +33,6 @@ const defaultSettings = ImmutableMap({
|
|||
panes: ImmutableList(),
|
||||
mainWindow: 'minimized',
|
||||
sound: true,
|
||||
flash: true,
|
||||
}),
|
||||
|
||||
home: ImmutableMap({
|
||||
|
|
|
@ -36,18 +36,18 @@ class AudioToggle extends React.PureComponent {
|
|||
};
|
||||
|
||||
handleToggleAudio = () => {
|
||||
this.props.toggleAudio(this.props.settings.get('chats', 'sound') === true ? false : true);
|
||||
this.props.toggleAudio(this.props.settings.getIn(['chats', 'sound']) === true ? false : true);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { intl, settings, showLabel } = this.props;
|
||||
let toggle = (
|
||||
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} ariaLabel={settings.get('chats', 'sound') === 'light' ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
|
||||
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} ariaLabel={settings.get('chats', 'sound') === true ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
|
||||
);
|
||||
|
||||
if (showLabel) {
|
||||
toggle = (
|
||||
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} label={settings.get('chats', 'sound') === 'light' ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
|
||||
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} label={settings.get('chats', 'sound') === true ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue