react-joi-forms icon indicating copy to clipboard operation
react-joi-forms copied to clipboard

Can't run the example

Open danielo515 opened this issue 8 years ago • 17 comments

Hello,

I'm trying to run your example, but I'm getting a plethora of errors.

What I do is

git clone "thisRepoUrl"
cd react-joi-forms
npm i
npm run example

The errors are about unexpected token loading the package.json of joi

ERROR in ../~/joi/package.json
Module parse failed: /Users/danielo/node_modules/joi/package.json Unexpected token (2:9)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:9)


.....


RROR in ../~/joi/lib/string.js
Module not found: Error: Cannot resolve module 'react-hot' in /Users/danielo/node_modules/joi/lib
 @ ../~/joi/lib/string.js 5:12-26

ERROR in ../~/isemail/lib/index.js
Module not found: Error: Cannot resolve module 'react-hot' in /Users/danielo/node_modules/isemail/lib
 @ ../~/isemail/lib/index.js 5:12-26

danielo515 avatar Apr 05 '17 11:04 danielo515

Hey! We are currently working on reviving this project after it was stagnant on our end for about a year. We are aware of some issues and working hard to fix them. We should have it worked out by weeks end.

mattapperson avatar Apr 05 '17 11:04 mattapperson

Dear @mattapperson Thank you for prompt your answer. So at this moment the project is not ready to be used. Am I right?

Regards

danielo515 avatar Apr 05 '17 12:04 danielo515

Not from source on github, no. The fork mehiel/react-joi-forms on NPM (that source is also broken) is stable and can be used until we make some needed fixes and enhancements

mattapperson avatar Apr 05 '17 12:04 mattapperson

Dear @mattapperson

I tried the version that is available at npm, and I'm still getting some errors:

JoiForm.js:173 Uncaught TypeError: Cannot read property 'language' of null
....
Uncaught TypeError: Cannot read property '__reactInternalInstance$0o8rvi7isx4n' of null

danielo515 avatar Apr 05 '17 14:04 danielo515

@danielo515 ok so I just pushed an update so that it should work now on our repo here.

mattapperson avatar Apr 06 '17 02:04 mattapperson

Hello again @mattapperson I'm testing this with react 15, and I have some things to say about it:

  1. The basic example that is on the readme DOES NOT WORK. It relies on the existence of certain components on its context, but they do not exist. For example textComponent is not defined, resulting on an error. However, using the basic example on your repo that uses a themeProvider does work. Seems that you forget to mention that you have to provide some kind of collection of elements on the context

  2. Object types are not properly displayed. I can see that you have some code to manage this kind of form, but it is not working for me. It just displays it as a text field, which is obviously not correct.

Another thing about this: why do you expect the schema to be an array of Joi objects ? That is not actually an schema. Why don't you also accept a Joi object defining all the fields?

Otherwise, great work. Thanks and regards.

danielo515 avatar May 11 '17 12:05 danielo515

Hey, yes the current version has a number of issues I don't love. The array was a trade off in order to allow you to order your fields when they are dynamically added using just the form component... that not being here or there... we have been working on a new 3.0 version that fixes these and many other issues.. you can find it on the 3.0 branch. Please note this version is not finished yet, but it is well tested and it does have working examples via react-storybook.

mattapperson avatar May 11 '17 12:05 mattapperson

Oh and docs are not at all updated for it... so just look at the examples 😊

mattapperson avatar May 11 '17 12:05 mattapperson

Oh and one last thing... we leave a lot up to the component themes. So yes we support lots of stuff in the core that the basic themes don't make use of

mattapperson avatar May 11 '17 12:05 mattapperson

Oh, I was adding comments on some bugs that I found, and I didn't realized that there is a 3.0 version. I'll check it out. Thanks.

danielo515 avatar May 11 '17 14:05 danielo515

Yea. It's not "done" but it's close... call it an early beta

mattapperson avatar May 11 '17 16:05 mattapperson

I am checking the branch 3.0 Looks like you don't have support for nested forms Joi.object().keys({name:Joi.string(), age: Joi.number()})

danielo515 avatar Jun 15 '17 07:06 danielo515

Nested was not yet something we needed but plan to add. Would not be too hard

mattapperson avatar Jun 15 '17 10:06 mattapperson

Ok, I'll keep an eye on that feature since it is a must-have for me

danielo515 avatar Jun 15 '17 12:06 danielo515

@danielo515 would you be interested in creating a PR? I could explain the little bit that is needed to be done!

mattapperson avatar Jun 15 '17 12:06 mattapperson

I would love to !

danielo515 avatar Jun 15 '17 16:06 danielo515

@danielo515 "All you need to do" is dive into the Input component and extend the name prop to understand dot notation (see https://stackoverflow.com/questions/6393943/convert-javascript-string-in-dot-notation-into-an-object-reference)

Then update the JoiForm component to understand the events where a component name has a dot notation as well using roughly the same concept

mattapperson avatar Jun 15 '17 16:06 mattapperson