Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions assets/index/bottom.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.@{tabs-prefix-cls} {
&-bottom {
border-top: 2px solid #f3f3f3;
overflow-x: hidden;
}

&-bottom &-content {
Expand Down Expand Up @@ -88,4 +87,4 @@
height: 0;
overflow: visible;
}
}
}
1 change: 1 addition & 0 deletions assets/index/common.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.@{tabs-prefix-cls} {
box-sizing: border-box;
position: relative;
overflow: hidden;

&-bar, &-nav-container {
font-size: 14px;
Expand Down
1 change: 0 additions & 1 deletion assets/index/left.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.@{tabs-prefix-cls} {
&-left {
border-right: 2px solid #f3f3f3;
overflow-y: hidden;
}

&-left &-bar {
Expand Down
3 changes: 1 addition & 2 deletions assets/index/right.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.@{tabs-prefix-cls} {
&-right {
border-left: 2px solid #f3f3f3;
overflow-y: hidden;
}

&-right &-bar {
Expand Down Expand Up @@ -97,4 +96,4 @@
&-right &-tab {
padding: 16px 24px;
}
}
}
3 changes: 1 addition & 2 deletions assets/index/top.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.@{tabs-prefix-cls} {
&-top {
border-bottom: 2px solid #f3f3f3;
overflow-x: hidden;
}

&-top &-content {
Expand Down Expand Up @@ -96,4 +95,4 @@
height: 0;
overflow: visible;
}
}
}
15 changes: 10 additions & 5 deletions src/ScrollableTabBarMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default {
const navNode = this.nav;
const navNodeWH = this.getScrollWH(navNode);
const containerWH = this.getOffsetWH(this.container);
const navWrapNodeWH = this.getOffsetWH(this.navWrap);
let { offset } = this;
const minOffset = containerWH - navNodeWH;
let { next, prev } = this.state;
Expand All @@ -71,8 +72,12 @@ export default {
next = (true);
} else {
next = (false);
this.setOffset(minOffset, false);
offset = minOffset;
// Fix https://github.com/ant-design/ant-design/issues/8861
// Test with container offset which is stable
// and set the offset of the nav wrap node
const realOffset = navWrapNodeWH - navNodeWH;
this.setOffset(realOffset, false);
offset = realOffset;
}

if (offset < 0) {
Expand Down Expand Up @@ -207,7 +212,7 @@ export default {
}

const activeTabWH = this.getScrollWH(activeTab);
const navWrapNodeWH = this.getScrollWH(navWrap);
const navWrapNodeWH = this.getOffsetWH(navWrap);
let { offset } = this;
const wrapOffset = this.getOffsetLT(navWrap);
const activeTabOffset = this.getOffsetLT(activeTab);
Expand All @@ -223,15 +228,15 @@ export default {
prev(e) {
this.props.onPrevClick(e);
const navWrapNode = this.navWrap;
const navWrapNodeWH = this.getScrollWH(navWrapNode);
const navWrapNodeWH = this.getOffsetWH(navWrapNode);
const { offset } = this;
this.setOffset(offset + navWrapNodeWH);
},

next(e) {
this.props.onNextClick(e);
const navWrapNode = this.navWrap;
const navWrapNodeWH = this.getScrollWH(navWrapNode);
const navWrapNodeWH = this.getOffsetWH(navWrapNode);
const { offset } = this;
this.setOffset(offset - navWrapNodeWH);
},
Expand Down