gerhat / material-ui-formik-components

Formik ready material ui components
MIT License
85 stars 13 forks source link

FieldArray does not render chipinput #17

Closed giq-re closed 4 years ago

giq-re commented 4 years ago

Issue: The chipinput works great when it is used as a standalone field but once you nest it in the field array component of formik the values never are set in the formik state. i think because the field array uses dot notation to slice the initial values so that it can set values that are deeply nested it is not translating properly with the components set field value method of transfering state. a similar occurrence is happening with the switch component as when you change the initial state it says you are switching from an uncontrolled to a controlled component - i have not checked it yet but I bet that setFieldValue is being used in this case as well. I can't seem to get a handle on it as of yet and was hoping someone who may have experienced this previously may have found a workaround. Its almost like you will have to use the same method that they implement behind fieldArray so that when you set the value its being set as if you are setting it directly on the field prop versus the form prop. because it does work on the Select and Textinputs components. i am rambling now because it just got me thinking.

CodeSandBox: i modified a codesandbox so you can see that the component works fine as long as its not within the fieldarray component.

Edit Material-UI Formik Chip Input Field Array

chaitanya1019 commented 4 years ago

I'm also facing the same issue. Please share workaround or release a fix ASAP

giq-re commented 4 years ago

I am happy to try to help. curious to see what the fix is because i tried to implement a few solutions with no success.

gerhat commented 4 years ago

Thanks for your input @chaitanya1019 @giq-re. An update is coming soon!

gerhat commented 4 years ago

@chaitanya1019, @giq-re can you please check v0.5.0 ?

giq-re commented 4 years ago

sure. just saw this. get back to you tomorrow.

giq-re commented 4 years ago

it is working. still get the uncontrolled warning for the switch.

what are your plans for the the library with formik 2.0 out and everything being rewritten in hooks? deprecation of the Field prop...etc. it seems like the transition from class based components to hooks is really accelerating fast.

gerhat commented 4 years ago

@giq-re can you please open a new issue for the switch uncontrolled warning and close this one?

The plan is to keep supporting upcoming versions from both formik and material-ui.

giq-re commented 4 years ago

Yep. I will today.

Sent from my IPhone

On Nov 24, 2019, at 1:38 AM, Gerasimos notifications@github.com wrote:

 @giq-re can you please open a new issue for the switch uncontrolled warning?

The plan is to keep supporting upcoming versions from both formik and material-ui.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.