admin管理员组文章数量:1333693
I am using antd design in my React App. I have noticed that antd design modal flickers when opened.
Is there a way I can fix this problem?
I am following the instructions from /ponents/modal/
I do not have a codepen for this but I have written all the modals in following way and I am using the css from antd design.
<Modal
visible={visible}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" size="large" onClick={this.handleCancel}>Return</Button>,
<Button key="submit" type="primary" size="large" loading={loading} onClick={this.handleOk}>
Submit
</Button>,
]}
>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</Modal>
I am using antd design in my React App. I have noticed that antd design modal flickers when opened.
Is there a way I can fix this problem?
I am following the instructions from https://ant.design/ponents/modal/
I do not have a codepen for this but I have written all the modals in following way and I am using the css from antd design.
<Modal
visible={visible}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" size="large" onClick={this.handleCancel}>Return</Button>,
<Button key="submit" type="primary" size="large" loading={loading} onClick={this.handleOk}>
Submit
</Button>,
]}
>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</Modal>
Share
Improve this question
asked Aug 21, 2017 at 10:26
FE_AddictFE_Addict
6774 gold badges11 silver badges22 bronze badges
2 Answers
Reset to default 4Never happened to me. Did you check for any css in developer tools that might be causing this issue?
Example, when i was using modals, my background was getting dark. When I checked one of the ant's default class (which was not needed at all. It was a wrapper div which wrapped the actual modal divs) had dark background because of which that was happening. So, either by setting the background: transparent;
I could solve that issue. But then i found this:
mask = {false}
This goes into your modal declaration. Something like this:
<Modal
visible={visible}
mask = {false}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" size="large" onClick={this.handleCancel}>Return</Button>,
<Button key="submit" type="primary" size="large" loading={loading} onClick={this.handleOk}>
Submit
</Button>,
]}
>
So, give it a try. This might solve your problem.
One way to solve this issue:
Pass the prop transitionName="" to the ponent that is flickering, which disables the transition on the ponent thus no flickering occurs.
For more on this visit:
https://ant.design/ponents/modal/#How-to-disable-motion
本文标签: javascriptantd design modal flicker on openStack Overflow
版权声明:本文标题:javascript - antd design modal flicker on open - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742355812a2459386.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论