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

Prop destroyOnClose prevents the closing animation of drawer #11307

Closed
1 task done
kennylbj opened this issue Jul 17, 2018 · 11 comments
Closed
1 task done

Prop destroyOnClose prevents the closing animation of drawer #11307

kennylbj opened this issue Jul 17, 2018 · 11 comments

Comments

@kennylbj
Copy link

@kennylbj kennylbj commented Jul 17, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.7.0

Environment

MacOS: Darwin kenny.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
Chrome: Version 67.0.3396.99 (Official Build) (64-bit)

Reproduction link

https://codepen.io/kennylbj-the-bashful/pen/PBNVYY?editors=0010

Steps to reproduce

  1. Add destroyOnClose prop to Drawer
  2. Close the Drawer

What is expected?

Showing closing animation

What is actually happening?

Drawer close immediately without closing animation.

@jljsj33
Copy link
Member

@jljsj33 jljsj33 commented Jul 17, 2018

destroyOnClose 是 antd 里 @chenshuai2144 加的。。。

@yesmeck
Copy link
Member

@yesmeck yesmeck commented Jul 17, 2018

可能得在 rc-drawer 里实现才能有动画。

@jljsj33
Copy link
Member

@jljsj33 jljsj33 commented Jul 17, 2018

可能是 react 15.x 的问题。。我看看

@jljsj33 jljsj33 assigned jljsj33 and unassigned chenshuai2144 Jul 17, 2018
@jljsj33
Copy link
Member

@jljsj33 jljsj33 commented Jul 17, 2018

这个真是 antd 里的问题。。。
https://github.com/ant-design/ant-design/blob/master/components/drawer/index.tsx#L111

return null 了,,,
我搞下?? @chenshuai2144 ?

jljsj33 added a commit to react-component/drawer that referenced this issue Jul 17, 2018
@chenshuai2144
Copy link
Contributor

@chenshuai2144 chenshuai2144 commented Jul 17, 2018

这个行为的错误在哪里?

@jljsj33
Copy link
Member

@jljsj33 jljsj33 commented Jul 17, 2018

关闭时直接删了,,没有把抽屉收回再删,,他的意思。。。

afc163 referenced this issue Jul 18, 2018
bors bot added a commit to mozilla/delivery-console that referenced this issue Jul 23, 2018
Merge #317
317: Update dependency antd to v3.7.1 r=magopian a=renovate[bot]

This Pull Request updates dependency [antd](https://github.com/ant-design/ant-design) from `v3.7.0` to `v3.7.1`



<details>
<summary>Release Notes</summary>

### [3.7.1](https://github.com/ant-design/ant-design/releases/3.7.1)
[Compare Source](ant-design/ant-design@3.7.0...3.7.1)
- 🐞 Fix popup content can't display in Drawer component.[#&#8203;11304](`ant-design/ant-design#11304)
- 🐞 Card using `tabList` support `disabled` prop.[#&#8203;11212](`ant-design/ant-design#11212)
- 🐞 Fix Link of Anchor not sync when `href` update.[#&#8203;11287](`ant-design/ant-design#11287) [@&#8203;tangjinzhou]
- 🐞 Fix Menu component style.[#&#8203;11299](`ant-design/ant-design#11299)
- 🐞 Fix Drawer component don't have animation when `destroyOnClose` is set.[#&#8203;11307](`ant-design/ant-design#11307)
- 🐞 Fix DirectoryTree can't expand when `expandedKeys` is in control.[#&#8203;11366](`ant-design/ant-design#11366)
- 🐞 Fix Button with Tooltip under ButtonGroup style issue when Button is `disabled`.[11321](`ant-design/ant-design#11321) [@&#8203;tangjinzhou]


---


- 🐞 修复 Drawer 内无法显示弹层组件的问题。[#&#8203;11304](`ant-design/ant-design#11304)
- 🐞 带页签的卡片页签支持 disabled 属性。[#&#8203;11212](`ant-design/ant-design#11212)
- 🐞 修复锚点链接组件 href 改变不更新的问题。 [#&#8203;11287](`ant-design/ant-design#11287) [@&#8203;tangjinzhou]
- 🐞 修复 Menu 样式细节问题。[#&#8203;11299](`ant-design/ant-design#11299)
- 🐞 修复 Drawer 组件设置 `destroyOnClose` 后关闭动画消失。[#&#8203;11307](`ant-design/ant-design#11307)
- 🐞 修复 DirectoryTree 在 `expandedKeys` 属性可控时点击无法展开的问题。[#&#8203;11366](`ant-design/ant-design#11366)
- 🐞 修复 ButtonGroup 中使用 Tooltip 的 Button 在 `disabled` 时样式不正确的问题。[11321](`ant-design/ant-design#11321) [@&#8203;tangjinzhou]

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).

Co-authored-by: Renovate Bot <bot@renovateapp.com>
bors bot added a commit to mozilla/delivery-console that referenced this issue Jul 25, 2018
Merge #319
319: Update dependency antd to v3.7.2 r=magopian a=renovate[bot]

This Pull Request updates dependency [antd](https://github.com/ant-design/ant-design) from `v3.7.1` to `v3.7.2`



<details>
<summary>Release Notes</summary>

### [3.7.2](https://github.com/ant-design/ant-design/releases/3.7.2)
[Compare Source](ant-design/ant-design@3.7.1...3.7.2)
- DatePicker
  - 🐞 **Fix issue resulting in year and month can not be changed in control mode.** [b9992f4](ant-design/ant-design@b9992f4)
  - 🐞 Fix warning of `getDerivedStateFromProp`. [#&#8203;11398](`ant-design/ant-design#11398) [@&#8203;yoyo837]
- Drawer
  - 🐞 Fix close animation when setting `destroyOnClose`. [#&#8203;11307](`ant-design/ant-design#11307)
  - 🐞 Fix display issue when using a `vw` value as `width`. [#&#8203;11326](`ant-design/ant-design#11326)
  - 🐞 Fix `wrapClassName` now working.
- 🐞 Fix text overflow of Tooltip. [#&#8203;11402](`ant-design/ant-design#11402) [@&#8203;weidapao]
- 🐞 Fix style issue of dark theme Menu in Layout.Header. [#&#8203;11400](`ant-design/ant-design#11400) [@&#8203;hongxuWei]
- 🐞 Fix the arrow buttons of InputNumber showing wrong positon in a fixed table. [#&#8203;11408](`ant-design/ant-design#11408)
- 🐞 Fix issue resulting in Select.Option shows wrong border radius in Select.OptGroup. [6cb6f5c](ant-design/ant-design@6cb6f5c)
- 🐞 Fix issue resulting in `onChange` was trigged twice when click the filter icon of Table. [#&#8203;11164](`ant-design/ant-design#11164) [@&#8203;adybionka]
- 🐞 Fix issue resulting title of Model.confirm shows scrollbar on Firefox. [#&#8203;11432](`ant-design/ant-design#11432)
- TypeScript
  - 🐞 Fix type definition of Radio.Group. [#&#8203;11409](`ant-design/ant-design#11409) [@&#8203;eddiemoore]
  - 🐞 Fix type definition of TreeSelect. [#&#8203;11442](`ant-design/ant-design#11442) [@&#8203;JribiBelhassen]
  - 🐞 Fix type definition of Badge. [#&#8203;11421](`ant-design/ant-design#11421) [@&#8203;zongzi531]


---


- DatePicker
  - 🐞 **修复在受控模式下不能切换年月的问题。**[b9992f4](ant-design/ant-design@b9992f4)
  - 🐞 修复在 `getDerivedStateFromProp` 的警告。[#&#8203;11398](`ant-design/ant-design#11398) [@&#8203;yoyo837]
- Drawer
  - 🐞 修复使用 `destroyOnClose` 时没有关闭动画的问题。[#&#8203;11307](`ant-design/ant-design#11307)
  - 🐞 修复 `width` 以 `vw` 为单位时的显示错误。[#&#8203;11326](`ant-design/ant-design#11326)
  - 🐞 修复 `wrapClassName` 属性无效的问题。
- 🐞 修复 Tooltip 文字溢出的问题。[#&#8203;11402](`ant-design/ant-design#11402) [@&#8203;weidapao]
- 🐞 修复 Menu 在 `theme` 为 `dark` 是在 Layout.Header 里的样式问题。[#&#8203;11400](`ant-design/ant-design#11400) [@&#8203;hongxuWei]
- 🐞 修复 InputNumber 的箭头按钮在使用了固定列的 Table 里显示错位的问题。[#&#8203;11408](`ant-design/ant-design#11408)
- 🐞 修复 Select 使用分组时 Option 的圆角显示错误。[6cb6f5c](ant-design/ant-design@6cb6f5c)
- 🐞 修复 Table 第一次点击过滤按钮的时候 `onChange` 会被触发两次的问题。[#&#8203;11164](`ant-design/ant-design#11164) [@&#8203;adybionka]
- 🐞 修复 Model.confirm 的标题在 Firefox 下会显示滚动条的问题。[#&#8203;11432](`ant-design/ant-design#11432)
- TypeScript
  - 🐞 修复 Radio.Group 类型定义。[#&#8203;11409](`ant-design/ant-design#11409) [@&#8203;eddiemoore]
  - 🐞 修复 TreeSelect 类型定义。[#&#8203;11442](`ant-design/ant-design#11442) [@&#8203;JribiBelhassen]
  - 🐞 修复 Badge 类型定义。[#&#8203;11421](`ant-design/ant-design#11421) [@&#8203;zongzi531]

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).

Co-authored-by: Renovate Bot <bot@renovateapp.com>
@amitpatil321
Copy link

@amitpatil321 amitpatil321 commented Jun 1, 2019

I am facing the same issue, while closing drawer it closes immediately but in the above demo its working fine, Not sure what's wrong. I even tried using the same code as above. The only difference in the above code and my code is that my visibility flags are getting set from parent component using react context.

I tried adding/removing destroyOnClose flag but it doesn't make any difference

<Drawer
  className    = "channel-info"
  title       = {<strong>About #{room.name}</strong> }
  placement    = "right"
  width    = "250"
  closable  = {true}
  maskClosable = {true}
  visible     = {context.state.channelInfoVisible}
  onClose   = {context.hideDrawer}
  destroyOnClose
 >

@amitpatil321
Copy link

@amitpatil321 amitpatil321 commented Jun 1, 2019

Okay I found the cause, it was because I was loading drawer component conditionally like below

{ showDrawer && <DrawerComponent /> }

Maybe because of that all the events were not getting bind to it. Instead, I am now lazy loading this component and it's working fine now.

BTW: Same happens with modal components close animation as well. Due to that only I was able to find the problem.

@laxarcuteria
Copy link

@laxarcuteria laxarcuteria commented Jun 9, 2020

I am now lazy loading this component and it's working fine now.

How are you doing this? React.lazy?

@amitpatil321
Copy link

@amitpatil321 amitpatil321 commented Jun 10, 2020

That was a year ago, May be they have changed code and it has started working now.

@hitanshiMehta-Dev
Copy link

@hitanshiMehta-Dev hitanshiMehta-Dev commented Jan 27, 2021

@amitpatil321 hey problem is still there, it would be helpful if you share the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants