Skip to content

Commit

Permalink
fix: Fixed Tab titles rendering as all Closes #57
Browse files Browse the repository at this point in the history
  • Loading branch information
myxvisual committed Aug 8, 2018
1 parent c4f3881 commit d2d241b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,18 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
className={styles.root.className}
>
<div {...styles.titles}>
{tabs && tabs.map((tab, index) => (
<span
{...(index === tabFocusIndex ? styles.titleFocus : styles.title)}
key={`${index}`}
onClick={() => this.setState({ tabFocusIndex: index })}
>
{renderTitle(tabTitle || `Tabs Items ${index + 1}`)}
</span>
))}
{tabs && tabs.map((tab, index) => {
const tabTitle = tab.props.title || `Tabs Items ${index + 1}`;
return (
<span
{...(index === tabFocusIndex ? styles.titleFocus : styles.title)}
key={`${index}`}
onClick={() => this.setState({ tabFocusIndex: index })}
>
{renderTitle(tabTitle)}
</span>
);
})}
</div>
{useAnimate ? (
<CustomAnimate
Expand Down

0 comments on commit d2d241b

Please sign in to comment.