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

VirtualList scrollTo/scrollToItem 能不能添加个 enhanced 参数? #14162

Closed
diamont1001 opened this issue Jul 12, 2023 · 1 comment · Fixed by #14155
Closed

VirtualList scrollTo/scrollToItem 能不能添加个 enhanced 参数? #14162

diamont1001 opened this issue Jul 12, 2023 · 1 comment · Fixed by #14155
Labels
A-components-advanced Area - 高阶组件 E-medium Helper Wanted - Medium enhancement New feature or request

Comments

@diamont1001
Copy link

diamont1001 commented Jul 12, 2023

这个特性解决了什么问题?

项目中使用 VirtualList 写了个 IndexBar 索引列表,不开启 enhanced 的时候滚动会抖动的厉害,开启 enhanced 的时候滚动没问题了,但是点击 index 时调用 scrollTo 滚动到指定位置的时候会有半秒的滚动动画(过程是白屏的)。
希望可以在 scrollTo 添加个 enhanced 参数,可以自由选择是否使用动画去调用 scrollTo 接口。

这个 API 长什么样?

scrollToItem(index: number, align: string = "auto", enhanced: bool = false): void

@diamont1001
Copy link
Author

@ZakaryCode 非常感谢,但是我这边测试了下,还是不生效。

情况1(主场景):VirtualList:enhanced=true

调用 scrollToItem(index, 'start', false) 后白屏,触摸屏幕后内容重新可见,但滚动并没有生效

情况2:VirtualList:enhanced=false

调用 scrollToItem(index, 'start', true) 没反应,控制台输出 warn 信息:此方法需要 scroll-view 开启 enhanced 属性!

yechunxi pushed a commit to yechunxi/taro that referenced this issue Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-components-advanced Area - 高阶组件 E-medium Helper Wanted - Medium enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants