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(drawer): 修复开启 destroyOnClose 时多次打开关闭时动效丢失问题 #1119

Merged
merged 1 commit into from
Jul 18, 2022
Merged

fix(drawer): 修复开启 destroyOnClose 时多次打开关闭时动效丢失问题 #1119

merged 1 commit into from
Jul 18, 2022

Conversation

LittlehorseXie
Copy link
Contributor

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#1115

💡 需求背景和解决方案

原逻辑:开启destroyOnClose时,初次visible为false时,加载了dom且translateX为100%,当visible设置为true时style的translateX更改为0,所以初次有动效;当再次visible设置为false时,dom完全清除,再次visible设置为true,导致dom和translateX(0)同时生效(因为style计算逻辑直接写在了fc内,没有使用setState),所以动效消失

解决:在visible生效后,使用setState更新translateX,时间上先渲染dom,后设置样式

📝 更新日志

  • fix(drawer): 修复开启 destroyOnClose 时多次打开关闭时动效丢失问题

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@github-actions
Copy link
Contributor

github-actions bot commented Jul 18, 2022

完成

@honkinglin
Copy link
Collaborator

更新下 snapshort

@codecov-commenter
Copy link

Codecov Report

Merging #1119 (0b4bbe4) into develop (7b04365) will decrease coverage by 0.09%.
The diff coverage is 55.49%.

@@             Coverage Diff             @@
##           develop    #1119      +/-   ##
===========================================
- Coverage    60.40%   60.30%   -0.10%     
===========================================
  Files          937      955      +18     
  Lines        16498    16784     +286     
  Branches      3743     3845     +102     
===========================================
+ Hits          9966    10122     +156     
- Misses        6532     6662     +130     
Impacted Files Coverage Δ
src/_util/copyText.ts 0.00% <0.00%> (ø)
src/_util/dom.ts 42.59% <ø> (ø)
src/_util/helper.ts 41.07% <ø> (ø)
src/_util/insertCSS.ts 0.00% <ø> (ø)
src/_util/number.ts 33.33% <ø> (ø)
src/_util/setStyle.ts 0.00% <ø> (ø)
src/_util/useDialogEsc.ts 46.66% <ø> (ø)
src/_util/useDragSorter.tsx 25.45% <ø> (ø)
src/_util/useRipple.ts 26.76% <ø> (ø)
src/anchor/Anchor.tsx 81.33% <ø> (ø)
... and 146 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30d9504...0b4bbe4. Read the comment docs.

@honkinglin honkinglin merged commit df93427 into Tencent:develop Jul 18, 2022
@github-actions github-actions bot mentioned this pull request Jul 18, 2022
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants