Skip to content

Commit

Permalink
remove deprecated prop
Browse files Browse the repository at this point in the history
  • Loading branch information
muzea authored and afc163 committed Jun 21, 2018
1 parent 2ce3ffd commit 126bb42
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions components/form/index.en-US.md
Expand Up @@ -57,18 +57,12 @@ The following `options` are available:
| validateMessages | Default validate message. And its format is similar with [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js)'s returned value | Object { [nested.path]: String } |
| onFieldsChange | Specify a function that will be called when the value a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) |
| onValuesChange | A handler while value of any field is changed | (props, changedValues, allValues) => void |
| withRef | Whether `refs` contain `wrappedComponent` | boolean |

If you want to get `ref` after `Form.create`, you can use `withRef` or `wrappedComponentRef` provided by `rc-form`[details can be viewed here](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140).
If you want to get `ref` after `Form.create`, you can use `wrappedComponentRef` provided by `rc-form`[details can be viewed here](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140).

```jsx
class CustomizedForm extends React.Component { ... }

// use withRef
const EnhancedForm = Form.create({ withRef: true })(CustomizedForm);
<EnhancedForm ref={(form) => this.form = form} />
this.form.refs.wrappedComponent // => The instance of CustomizedForm

// use wrappedComponentRef
const EnhancedForm = Form.create()(CustomizedForm);
<EnhancedForm wrappedComponentRef={(form) => this.form = form} />
Expand Down
8 changes: 1 addition & 7 deletions components/form/index.zh-CN.md
Expand Up @@ -59,18 +59,12 @@ CustomizedForm = Form.create({})(CustomizedForm);
| validateMessages | 默认校验信息,可用于把默认错误信息改为中文等,格式与 [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js) 返回值一致 | Object { [nested.path]&#x3A; String } |
| onFieldsChange |`Form.Item` 子节点的值发生改变时触发,可以把对应的值转存到 Redux store | Function(props, fields) |
| onValuesChange | 任一表单域的值发生改变时的回调 | (props, changedValues, allValues) => void |
| withRef | `refs` 中是否有 `wrappedComponent` | boolean |

经过 `Form.create` 之后如果要拿到 `ref`,可以使用 `withRef` 也可以使用 `rc-form` 提供的 `wrappedComponentRef`[详细内容可以查看这里](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140)
经过 `Form.create` 之后如果要拿到 `ref`,可以使用 `rc-form` 提供的 `wrappedComponentRef`[详细内容可以查看这里](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140)

```jsx
class CustomizedForm extends React.Component { ... }

// use withRef
const EnhancedForm = Form.create({ withRef: true })(CustomizedForm);
<EnhancedForm ref={(form) => this.form = form} />
this.form.refs.wrappedComponent // => The instance of CustomizedForm

// use wrappedComponentRef
const EnhancedForm = Form.create()(CustomizedForm);
<EnhancedForm wrappedComponentRef={(form) => this.form = form} />
Expand Down

0 comments on commit 126bb42

Please sign in to comment.