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

formsy-react@0.18.0 #65

Closed
sveip opened this issue Apr 21, 2016 · 5 comments
Closed

formsy-react@0.18.0 #65

sveip opened this issue Apr 21, 2016 · 5 comments

Comments

@sveip
Copy link

sveip commented Apr 21, 2016

Hi, I updated formsy-react to 0.18.0 to make it satisfied with react 15. The problem now is that formsy-react-components does not work anymore. It might well be something I'm doing wrong, so just let me know if there is any info that I can give that might be helpful.

@twisty
Copy link
Owner

twisty commented Apr 21, 2016

Hi @petersvei, I haven't had a chance to try this with formsy-react v0.18 yet.

However, I've had success using this alongside react v15 with formsy-react v0.17. (npm will warn about an unsatisfied peer dependency on react 0.14, but if you use npm v3.x it doesn't try and install peer dependencies, so it'll be okay).

You say it doesn't work -- what happened / didn't happen? Did the form render? Any errors in the browser console?

@sveip
Copy link
Author

sveip commented Apr 21, 2016

Thanks for you lightning fast response @twisty !

Same here, it was working fine with formsy-react@0.17 except the unmet dep. warning.

The problem I experience when I upgrade is that the properties of the inputs seems not to be defined. If I try to set this.refs.form.inputs.name.setValue i get an error that it is undefined. The input is created like this:

Input layout="vertical" name="my_name" type="text" label="My Name" validations={{ validate: this.validate.my_name }} />

This worked fine with formsy-react@0.17.0 (which I know is not a good indicator that it's related to that :) .)

@twisty
Copy link
Owner

twisty commented Apr 21, 2016

Hi, I've had a quick look and have observed this:

  • in formsy-react@0.17 form.inputs returned an object, keyed by the formsy.mixin "name" prop.
  • in formsy-react@0.18 form.inputs returns an array.

So it looks like this is a formsy-react change (is Formsy.Form.inputs listed as a public API? -- I don't think so?).

A workaround may be to set a React ref on the form components you need to track and use those instead, instead of relying form.inputs.

I'm going to close this because I don't think it is a FRC problem.

Good luck with sorting it out though!

@twisty twisty closed this as completed Apr 21, 2016
@twisty
Copy link
Owner

twisty commented Apr 21, 2016

@sveip
Copy link
Author

sveip commented Apr 22, 2016

Thanks, you are absolutely right. I changed my app to use reset(values) to set the input fields instead, so that I don't have to rely on form.inputs anymore.

So now everything seems to work perfectly without any dep warnings 👍

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

No branches or pull requests

2 participants