1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

improved logic to set inital active pane

This commit is contained in:
ivaosthu 2014-11-01 15:35:26 +01:00 committed by Ivar Conradi Østhus
parent 0032069c27
commit f472bf8585

View File

@ -6,19 +6,19 @@ var TabView = React.createClass({
},
getInitialState: function() {
return {activeTab: this.props.tabPanes[0]};
},
var activeTab = this.props.tabPanes[0];
componentDidMount:function() {
var userHash = window.location.hash;
if(userHash) {
userHash = userHash.split("#")[1];
this.props.tabPanes.forEach(function(pane) {
if(pane.name === userHash) {
this.setState({activeTab: pane})
}
if(pane.name === userHash) {
activeTab = pane;
}
}.bind(this));
}
return {activeTab: activeTab};
},
handleChangeTab: function(tabPane) {