From 95acd31055b8dc9b12ba861552ab8ed33cca535f Mon Sep 17 00:00:00 2001 From: Davi Ferreira Date: Tue, 18 Nov 2014 09:38:20 -0200 Subject: [PATCH] Solves #70 --- src/js/radio-button.jsx | 6 +++--- src/js/toggle.jsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/radio-button.jsx b/src/js/radio-button.jsx index 0223812eec8714..8d86e01c82cdf8 100644 --- a/src/js/radio-button.jsx +++ b/src/js/radio-button.jsx @@ -23,9 +23,9 @@ var RadioButton = React.createClass({ } }, - toggle: function() { - this.setState({ checked: !this.state.checked }); - this.refs.radioButton.getDOMNode().checked = !this.refs.radioButton.getDOMNode().checked; + toggle: function(checked) { + this.setState({ checked: checked || !this.state.checked }); + this.refs.radioButton.getDOMNode().checked = checked || !this.refs.radioButton.getDOMNode().checked; }, render: function() { diff --git a/src/js/toggle.jsx b/src/js/toggle.jsx index 272c4352d9b136..8aaad5f3e56420 100644 --- a/src/js/toggle.jsx +++ b/src/js/toggle.jsx @@ -39,7 +39,7 @@ var Toggle = React.createClass({ var toggledState = !this.state.toggled; this.setState({ toggled: toggledState }); - this.refs.radioButton.toggle(); + this.refs.radioButton.toggle(toggledState); if (this.props.onToggle) this.props.onToggle(e, toggledState); }