From fe4508f1f1b86ce1a8084ab528fdb634b482e32c Mon Sep 17 00:00:00 2001 From: vmakhaev Date: Sat, 6 Dec 2014 10:43:11 +0300 Subject: [PATCH] Toggle add toggled prop --- src/js/toggle.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/js/toggle.jsx b/src/js/toggle.jsx index 541dc25c9728e9..406d4d23bb41e7 100644 --- a/src/js/toggle.jsx +++ b/src/js/toggle.jsx @@ -10,14 +10,21 @@ var React = require('react'), var Toggle = React.createClass({ propTypes: { - onToggle: React.PropTypes.func + onToggle: React.PropTypes.func, + toggled: React.PropTypes.bool }, mixins: [Classable], - getInitialState: function() { + getDefaultProps: function() { return { toggled: false + }; + }, + + getInitialState: function() { + return { + toggled: this.props.toggled } },