diff --git a/docs/src/app/components/pages/components/tabs.jsx b/docs/src/app/components/pages/components/tabs.jsx index 3b547a57996a95..882cf795b4ecc8 100644 --- a/docs/src/app/components/pages/components/tabs.jsx +++ b/docs/src/app/components/pages/components/tabs.jsx @@ -8,7 +8,7 @@ var Tabs = mui.Tabs; var Tab= mui.Tab; var TabsPage = React.createClass({ - + mixins: [Router.Navigation, Router.State], render: function(){ @@ -51,7 +51,7 @@ var TabsPage = React.createClass({ 'If you need to access a tab directly - you can do so with the first argument of onActive or ' + 'by accessing the props.children array by passing refs to the Tabs container.'; - + var componentInfo = [ { @@ -70,7 +70,7 @@ var TabsPage = React.createClass({ infoArray: [ { name: 'onChange', - type: 'function', + type: 'function(tabIndex, tab)', header: 'optional', desc: 'Fired on touch or tap of a tab.' } diff --git a/src/js/tabs/tabs.jsx b/src/js/tabs/tabs.jsx index c620e55d6eb472..92417549dd4bcc 100644 --- a/src/js/tabs/tabs.jsx +++ b/src/js/tabs/tabs.jsx @@ -40,14 +40,17 @@ var Tabs = React.createClass({ }, handleTouchTap: function(tabIndex, tab){ - if (this.props.onChange && this.state.selectedIndex !== tabIndex) this.props.onChange(); + if (this.props.onChange && this.state.selectedIndex !== tabIndex) { + this.props.onChange(tabIndex, tab); + } + this.setState({selectedIndex: tabIndex}); //default CB is _onActive. Can be updated in tab.jsx if(tab.props.onActive) tab.props.onActive(tab); }, render: function(){ - var _this = this; + var _this = this; var width = this.state.fixed ? this.state.width/this.props.children.length : this.props.tabWidth; @@ -84,4 +87,4 @@ var Tabs = React.createClass({ }); -module.exports = Tabs; \ No newline at end of file +module.exports = Tabs;