react-component / react-component/tabs
SwipeableTabBarNode 中 didUpdate 时 setCache 导致 cache 里面的 totalDelta 会消失。
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 572
- Forks
- 241
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 4
Description
https://github.com/react-component/tabs/blob/master/src/SwipeableTabBarNode.js#L34
原因是在 didUpdate 时,只有 activeKey 发生变化时才会 setSwipePositionByKey,而 totalDelta 是在setSwipePositionByKey 里面调用的 setSwipePosition 里设置的。而 setCache,不是采用 merge 的形式,而是直接覆盖了整个 cache,导致 totalDelta 会消失。
这直接导致 https://github.com/react-component/tabs/blob/master/src/SwipeableTabBarNode.js#L48 _nextDelta 变成了 NaN ,于是无法滑动了。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect src/SwipeableTabBarNode.js at the didUpdate logic around line 34 and the _nextDelta calculation around line 48. Reproduce the swipe failure, then verify that updating the cache preserves totalDelta so _nextDelta remains usable and swiping works again.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100