mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
docs: faq about modal. close #35177
This commit is contained in:
parent
f8e7cba353
commit
eb70223bdb
@ -142,6 +142,10 @@ return <div>{contextHolder}</div>;
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why content not update when Modal closed?
|
||||
|
||||
Modal will use memo to avoid content jumping when closed. Also, if you use Form in Modal, you can reset `initialValues` by calling `resetFields` in effect.
|
||||
|
||||
### Why I can not access context, redux, ConfigProvider `locale/prefixCls` in Modal.xxx?
|
||||
|
||||
antd will dynamic create React instance by `ReactDOM.render` when call Modal methods. Whose context is different with origin code located context.
|
||||
|
@ -145,6 +145,10 @@ return <div>{contextHolder}</div>;
|
||||
|
||||
## FAQ
|
||||
|
||||
### 为什么 Modal 关闭时,内容不会更新?
|
||||
|
||||
Modal 在关闭时会将内容进行 memo 从而避免关闭过程中的内容跳跃。也因此如果你在配合使用 Form 有关闭时重置 `initialValues` 的操作,请通过在 effect 中调用 `resetFields` 来重置。
|
||||
|
||||
### 为什么 Modal 方法不能获取 context、redux、的内容和 ConfigProvider `locale/prefixCls` 配置?
|
||||
|
||||
直接调用 Modal 方法,antd 会通过 `ReactDOM.render` 动态创建新的 React 实体。其 context 与当前代码所在 context 并不相同,因而无法获取 context 信息。
|
||||
|
Loading…
Reference in New Issue
Block a user