Skip to content

Commit

Permalink
fix(tabs.taro.tsx): 解决在不需要滚动的时候,切换tab产生tab位置错乱的问题 (jdf2e#2554)
Browse files Browse the repository at this point in the history
* Update infiniteloading.taro.tsx

* Update infiniteloading.tsx

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

滚动不可为负值,负值会导致在不需要滚动的时候,tab位置发生不可预知的顺序变化。

* fix(tabs.taro.tsx): 解决页面元素不需要滚动时,切换tab,tab顺序发生不可预知的变化的问题

* Update tabs.taro.tsx

修复格式问题

* Update tabs.taro.tsx

修改格式问题
  • Loading branch information
jqroom authored Aug 27, 2024
1 parent 3364ee6 commit d37be51
Showing 1 changed file with 2 additions and 0 deletions.
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

0 comments on commit d37be51

Please sign in to comment.