Skip to content

Commit

Permalink
fix(tabs): 修复tabs异步设置titles滚动失效(#2351) (#2369)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShuchenEason authored Jun 21, 2024
1 parent 5ee64bf commit 327e639
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/packages/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ export const Tabs: FunctionComponent<Partial<TabsProps>> & {
const scrollIntoView = (index: number, immediate?: boolean) => {
const nav = navRef.current
const titleItem = titleItemsRef.current
if (!nav || !titleItem || !titleItem[index]) {
const titlesLength = titles.current.length
const itemLength = titleItemsRef.current.length
if (!nav || !titleItem || !titleItem[itemLength - titlesLength + index]) {
return
}
const title = titleItem[index]
const title = titleItem[itemLength - titlesLength + index]

let to = 0
if (direction === 'vertical') {
Expand Down

0 comments on commit 327e639

Please sign in to comment.