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
pass all fields value into onFieldsChange method #42
pass all fields value into onFieldsChange method #42
Conversation
You can get other fields from |
@benjycui Sometimes the component will be wrapped. I can't get other fields use In my case. I must use code like Maybe I do things wrong? |
@@ -37,11 +37,13 @@ describe('map usage', () => { | |||
it('onFieldsChange works', () => { | |||
const Test = createForm({ | |||
withRef: true, | |||
onFieldsChange(props, fields) { | |||
onFieldsChange(props, fields, allFields) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get fields from this props
,for you had pass fields to upper component by onChange
@benjycui 我决定还是打中文吧…… 可是很多时候我就只是简单想获取一下,没有强烈的需求要传给 redux store 或上层组件。还是说从规范上来说我就不应该这样做? getFieldDecorator('field', {
onChange(value) {
// do something
}
}); |
并没有不建议自行实现 |
@benjycui sorry 我没看仔细 |
我刚更新的 😄 |
Sometimes I want to do something when one field changing but use another field's value. So I make this PR.
We can use onChange prop at most of the time. But when we use package like Antd, there is no way to use a custom onChange prop(the onChange is generated by getFieldDecorator()).
Or we can add an option for getFieldDecorator() to do this? Or there is another solution I do not know? Please discuss.