jquense / react-formal

Sophisticated HTML form management for React
http://jquense.github.io/react-formal
MIT License
527 stars 52 forks source link

addType/resolveFieldComponent inconsistency #100

Closed rosskevin closed 7 years ago

rosskevin commented 7 years ago

It took me a while to debug this since I was developing new components. I hope to change this to save some others the time.

I was using Form.addInputTypes({radioGroup: RadioGroup}) and it was always resolving to Input due to this code in resolveFieldComponent:

Component = types[type.toLowerCase()] || Input // radioGroup not found

I suggest that this is unbalanced, since my code could never work. I'm not sure why type is being lower-cased, I assume for good reason, but I suggest that addType be modified accordingly:

types[type] = Component // multi-case allowed as key, though resolved as only lowercase
rosskevin commented 7 years ago

PR available