Browse Source

docs: Add FormItem FAQ with Modal (#21077)

* docs: Add faq

* Update index.en-US.md
pull/21086/head
二货机器人 5 years ago
committed by GitHub
parent
commit
c4b9a02036
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      components/form/index.en-US.md
  2. 6
      components/form/index.zh-CN.md

6
components/form/index.en-US.md

@ -329,6 +329,12 @@ Online demo:
[![Edit wrappedComponentRef-in-function-component](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/wrappedcomponentref-in-function-component-fj43c?fontsize=14&hidenavigation=1&theme=dark)
### Why get form warning when used in Modal?
> Warning: Instance created by `useForm` is not connect to any Form element. Forget to pass `form` prop?
Before Modal open, children element do not exist in the view. You can set `forceRender` on Modal to pre-render its children. Click [here](https://codesandbox.io/s/antd-reproduction-template-ibu5c) to view example.
<style>
.site-form-item-icon {
color: rgba(0, 0, 0, 0.25);

6
components/form/index.zh-CN.md

@ -330,6 +330,12 @@ const TestForm = () => {
[![Edit wrappedComponentRef-in-function-component](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/wrappedcomponentref-in-function-component-fj43c?fontsize=14&hidenavigation=1&theme=dark)
### 为何在 Modal 中调用 form 控制台会报错?
> Warning: Instance created by `useForm` is not connect to any Form element. Forget to pass `form` prop?
这是因为你在调用 form 方法时,Modal 还未初始化导致 form 没有关联任何 Form 组件。你可以通过给 Modal 设置 `forceRender` 将其预渲染。示例点击[此处](https://codesandbox.io/s/antd-reproduction-template-ibu5c)。
<style>
.site-form-item-icon {
color: rgba(0, 0, 0, 0.25);

Loading…
Cancel
Save