ant-design: Form nested and array values mapPropsToFields not working
Version
2.12.6
Environment
Chrome 60.0.3112.90 OSX (irrelevant in this case)
Reproduction link
https://codepen.io/MathiasGilson/pen/jLapPz
Steps to reproduce
Try to use mapPropsToFields with an array ([{ first: {value: "nameArray"} }]
) or a composed object ({ first: {value: "nestedName"}}
) like in the codepen
What is expected?
This should set the corresponding inputs with the given values getFieldDecorator(‘names[0].first’) input should be set to “nameArray” getFieldDecorator(‘name.first’) input should be set to “nestedName”
What is actually happening?
the input stay empty, no error in the console to debug
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 15 (3 by maintainers)
It’s a known issue, I don’t have enough time to dig into it. Need time to re-design data structure and behavior of nested fields.
Sorry about that.
Here is my solution
https://codesandbox.io/s/2z2ojxy22r?fontsize=14
I have more of a generic solution, but its still far from ideal. The main problem is that rc-forms expects the value field, which forces us to do a back and forth transformation if connected to a “normalized” redux store.