fix(picker-view): round item height calculations#2544
Open
wangshunnn wants to merge 2 commits into
Open
Conversation
hiyuki
reviewed
Jul 8, 2026
| nodeRef: scrollViewRef | ||
| }) | ||
|
|
||
| const updateItemRawH = useCallback((height: number) => { |
Collaborator
There was a problem hiding this comment.
这个封装没有必要,直接用setItemRawH本身内部的比较优化机制即可
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix(RN)
修复 mpx2rn
picker-view多列滚动时选中项 Y 轴逐步偏移的问题。主要改动:
picker-view-column内部 item 渲染、padding、indicator、mask、snapToOffsets 与滚动计算的高度基准,避免indicator-style.height小数值和取整后的吸附高度不一致。itemRawH时统一取整,并通过itemRawHRef + updateItemRawH避免重复更新和高度回拉。NodeJS.Timeout调整为ReturnType<typeof setTimeout>,兼容 RN/runtime 类型环境。