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
3 changes: 3 additions & 0 deletions src/packages/tabs/tabs.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,11 @@
.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
}

Check failure on line 216 in src/packages/tabs/tabs.taro.tsx

View workflow job for this annotation

GitHub Actions / lint

Delete `········`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修复格式问题

调用 nextTick 确保适当地处理滚动动画,但需要修复格式问题。

应用以下diff修复格式:

-        
+
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Tools
GitHub Check: lint

[failure] 216-216:
Delete ········

nextTick(() => {
scrollWithAnimation.current = true
})
Expand Down
Loading