picker icon indicating copy to clipboard operation
picker copied to clipboard

fix: ensure consistency between controlled and uncontrolled logic

Open Yuiai01 opened this issue 3 years ago • 2 comments

close https://github.com/ant-design/ant-design/issues/44992#issuecomment-1751910178 问题背景: 在该 PR 之前如果 RangePicker 的 open 设置为 true,因为没有初始化 nextActiveIndex,所以根据 afferentOpen 和 index 等判断 nextActiveIndex,但是这样会导致 nextActiveIndex 永远不会是 null,因此永远不会触发关闭时间选择面板的逻辑(不会触发 onOpenChange)。 该 PR 的作用是当 RangePicker 处于选择完日期也就是可关闭状态时触发关闭选择时间面板的逻辑(会触发 onOpenChange),当 open 受控变成 false 时,需要将 focus 动画取消,并且由于 mergedActivePickerIndex 会先改变因此需要改回去。

Yuiai01 avatar Oct 09 '23 14:10 Yuiai01

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
picker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 2:21pm

vercel[bot] avatar Oct 09 '23 14:10 vercel[bot]

Codecov Report

Merging #685 (f6b2569) into master (f6c6803) will increase coverage by 0.00%. The diff coverage is 100.00%.

:exclamation: Current head f6b2569 differs from pull request most recent head 934d722. Consider uploading reports for the commit 934d722 to get more accurate results

@@           Coverage Diff           @@
##           master     #685   +/-   ##
=======================================
  Coverage   98.94%   98.94%           
=======================================
  Files          56       56           
  Lines        2457     2466    +9     
  Branches      734      737    +3     
=======================================
+ Hits         2431     2440    +9     
  Misses         24       24           
  Partials        2        2           
Files Coverage Δ
src/hooks/useRangeOpen.ts 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Oct 09 '23 14:10 codecov[bot]