Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tabs.taro.tsx): 解决在不需要滚动的时候,切换tab产生tab位置错乱的问题 #2554

Merged
merged 8 commits into from
Aug 27, 2024
2 changes: 2 additions & 0 deletions src/packages/tabs/tabs.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ export const Tabs: FunctionComponent<Partial<TabsProps>> & {
.slice(0, index)
.reduce((prev: number, curr: RectItem) => prev + curr.width, 0)
to = left - (navRectRef.current.width - titleRect.width) / 2
// to < 0 说明不需要进行滚动,页面元素已全部显示出来
if (to < 0) return
to = rtl ? -to : to
}
nextTick(() => {
Expand Down
Loading