Skip to content

Commit

Permalink
feature: add barStyle prop for rn-tabs, #676
Browse files Browse the repository at this point in the history
  • Loading branch information
silentcloud committed Dec 28, 2016
1 parent 533e8d4 commit f422c4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions components/tabs/PropsType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface TabsProps {
textColor?: string;
activeTextColor?: string;
styles?: any;
barStyle?: any;
/*web only*/
className?: string;
prefixCls?: string;
Expand Down
12 changes: 7 additions & 5 deletions components/tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Tabs extends React.Component<TabsProps, any> {
textColor: '#000',
activeTextColor: '#108ee9',
styles: styles,
barStyle: null,
};

static TabPane: any;
Expand Down Expand Up @@ -66,20 +67,21 @@ class Tabs extends React.Component<TabsProps, any> {

renderTabBar = () => {
const {
tabBarPosition, underlineColor, activeUnderlineColor, textColor, activeTextColor, styles,
tabBarPosition, underlineColor, activeUnderlineColor, textColor, activeTextColor, styles, barStyle,
} = this.props;
const barStyle = tabBarPosition === 'top' ? styles.barTop : styles.barBottom;
const barBaseStyle = tabBarPosition === 'top' ? styles.barTop : styles.barBottom;
const linePosition = tabBarPosition === 'top' ? {} : { top: -1 };
return (
<DefaultTabBar
activeTextColor={activeTextColor}
inactiveTextColor={textColor}
style={[barStyle, { borderColor: underlineColor } ]}
style={[barBaseStyle, { borderColor: underlineColor }, barStyle ]}
textStyle={[styles.text]}
tabStyle={[styles.tab]}
underlineStyle={[styles.underline, {
bottom: tabBarPosition === 'top' ? 0 : null,
bottom: tabBarPosition === 'top' ? -1 : null,
backgroundColor: activeUnderlineColor,
}]}
}, linePosition]}
/>
);
}
Expand Down

0 comments on commit f422c4d

Please sign in to comment.