Skip to content
New issue

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

feat: getFormControl #33

Merged
merged 3 commits into from
Aug 29, 2016
Merged

feat: getFormControl #33

merged 3 commits into from
Aug 29, 2016

Conversation

benjycui
Copy link
Member

ref: ant-design/ant-design#1533

getFieldProps 相比,getFormControl 会多做点事:

  • 判断是否设置了 value defaultValue 之类会与 rc-form 的工作机制发生冲突的属性,然后报错
  • 自动处理用户定义的事件(onChange 之类)与 trigger 的冲突

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.9%) to 85.208% when pulling b6f4c15 on feat-getFormControl into 1b5536e on master.

@benjycui
Copy link
Member Author

调整了参数顺序,现在的写法贴近 decorator

{getFormControl({
name: 'name',
initialValue: '',
rules: [{
required: true,
message: 'What\'s your name?',
}],
},
<input
onChange={console.log.bind(console)}
/>
)}

即使是 Select 之类会有子树的控件应该也不会觉得奇怪。

@yiminghe yiminghe merged commit f805709 into master Aug 29, 2016
@yiminghe yiminghe deleted the feat-getFormControl branch August 29, 2016 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants