We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
autoDestroy
首先看这个示例: https://codesandbox.io/s/cool-tree-2j0rm?file=/src/App.js 没有消失动画,去掉autoDestroy就有了。 其实都是和 ant-design/ant-design#28151 这个有关的。 总而言之,就是没有正确实现afterVisibleChange。 destroy应该在完全消失动画结束后的,也就是afterVisibleChange(false)的时候。 看index.tsx中这段代码:
afterVisibleChange
let portal: React.ReactElement; // prevent unmounting after it's rendered if (popupVisible || this.popupRef.current || forceRender) { portal = ( <PortalComponent key="portal" getContainer={this.getContainer} didUpdate={this.handlePortalUpdate} > {this.getComponent()} </PortalComponent> ); } if (!popupVisible && autoDestroy) { portal = null; } return ( <TriggerContext.Provider value={{ onPopupMouseDown: this.onPopupMouseDown }} > {trigger} {portal} </TriggerContext.Provider> );
我对你们代码不是100%了解。以下是我的猜测:
portal
popupVisible
this.popupRef.current
所以,我猜测应该这么改:
onAppearEnd
onLeaveEnd
false
true
afterVisibleChange(true)
<true>
<false>
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
No branches or pull requests
首先看这个示例: https://codesandbox.io/s/cool-tree-2j0rm?file=/src/App.js
没有消失动画,去掉
autoDestroy
就有了。其实都是和 ant-design/ant-design#28151 这个有关的。
总而言之,就是没有正确实现
afterVisibleChange
。destroy应该在完全消失动画结束后的,也就是afterVisibleChange(false)的时候。
看index.tsx中这段代码:
我对你们代码不是100%了解。以下是我的猜测:
portal
变成null,弹出内容就彻底消失了popupVisible
就是一般的visible,只要变成false,就会开始播放消失动画猜错了this.popupRef.current
是在一般情况下,即使popupVisible
变成false,也能在播放消失动画的时候能渲染出来的原因。也就是动画结束this.popupRef.current会变成null。this.popupRef.current
只要开始显示了,就不会变成null了。所以,我猜测应该这么改:
onAppearEnd
onLeaveEnd
等事件来得知动画消失的时机,来实现afterVisibleChange。不过这要改到PopupInner.tsx里了。popupVisible
从false
变成true
的时候afterVisibleChange(true)
。当this.popupRef.current
从<true>
变成<false>
的时候afterVisibleChange(false)。The text was updated successfully, but these errors were encountered: