Skip to content

Commit

Permalink
fix: 修复 Tabs 左右切换渲染问题 (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
honkinglin authored Jun 17, 2022
1 parent aebfe91 commit 56d00f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/tabs/TabNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const TabNav: React.FC<TabNavProps> = (props) => {
onRemove = noop,
onChange = noop,
activeValue,
children,
} = props;

// 逻辑层较多处需要判断是否为 card 类型,进行逻辑抽象
Expand Down Expand Up @@ -106,7 +107,9 @@ const TabNav: React.FC<TabNavProps> = (props) => {

setToLeftBtnVisible(canToleft);
setToRightBtnVisible(canToRight);
}, [scrollLeft, placement]);
// children 发生变化也要触发一次切换箭头判断
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [scrollLeft, placement, children]);

// 滚动条处理逻辑
const handleScroll = (position: 'left' | 'right') => {
Expand Down

0 comments on commit 56d00f8

Please sign in to comment.