Merge pull request #2590 from matrix-org/travis/settings/fix-directory-publish

Ensure toggle switches listen to property changes
pull/21833/head
Travis Ralston 2019-02-08 08:00:47 -07:00 committed by GitHub
commit 78ea531a87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,12 @@ export default class ToggleSwitch extends React.Component {
};
}
componentWillReceiveProps(nextProps) {
if (nextProps.checked !== this.state.checked) {
this.setState({checked: nextProps.checked});
}
}
_onClick = (e) => {
e.stopPropagation();
e.preventDefault();