Skip to content

Commit

Permalink
fix(tab-set): initial tab render when no selection is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Yorsh committed Oct 23, 2018
1 parent b085302 commit be58950
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/tabset/rkTabView.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class RkTabView extends React.Component {
super(props);
this.tabViews = props.children;
this.tabContentViews = React.Children.map(this.tabViews, child => child.props.children);
this.state.selectedIndex = this.tabViews.findIndex(child => child.props.isSelected);
const derivedSelectedIndex = this.tabViews.findIndex(child => child.props.isSelected);
this.state.selectedIndex = derivedSelectedIndex < 0 ? 0 : derivedSelectedIndex;
}

componentDidMount() {
Expand Down

0 comments on commit be58950

Please sign in to comment.