Skip to content

Commit

Permalink
fix(Tab): rtl support
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna committed Jan 17, 2019
1 parent 11f6d99 commit 2151ee8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/tab/tab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export default class Tab extends Component {

const navProps = {
prefix,
rtl,
animation,
activeKey,
excessMode,
Expand Down
7 changes: 5 additions & 2 deletions src/tab/tabs/nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import { triggerEvents, getOffsetLT, getOffsetWH, isTransformSupported } from '.

const noop = () => {};
const floatRight = { float: 'right' };
const floatLeft = { float: 'left' };
const { Popup } = Overlay;

class Nav extends React.Component {
static propTypes = {
prefix: PropTypes.string,
rtl: PropTypes.bool,
animation: PropTypes.bool,
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
excessMode: PropTypes.string,
Expand Down Expand Up @@ -363,7 +365,7 @@ class Nav extends React.Component {
}

render() {
const { prefix, tabPosition, excessMode, extra, onKeyDown, animation, style, className } = this.props;
const { prefix, tabPosition, excessMode, extra, onKeyDown, animation, style, className, rtl } = this.props;
const state = this.state;

let nextButton;
Expand Down Expand Up @@ -441,7 +443,8 @@ class Nav extends React.Component {
key: 'nav-extra',
};
if (tabPosition === 'top' || tabPosition === 'bottom') {
navChildren.unshift(<div {...extraProps} style={floatRight}>{extra}</div>);
const style = rtl ? floatLeft : floatRight;
navChildren.unshift(<div {...extraProps} style={style}>{extra}</div>);
} else {
navChildren.push(<div {...extraProps}>{extra}</div>);
}
Expand Down

0 comments on commit 2151ee8

Please sign in to comment.