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

Invalid Type #118

Open
lovato opened this issue Apr 21, 2019 · 0 comments
Open

Invalid Type #118

lovato opened this issue Apr 21, 2019 · 0 comments

Comments

@lovato
Copy link

lovato commented Apr 21, 2019

Hi. I am using react-jsonschema-form in UMD format. Therefore, trying to use your extension the same way to get typeahead functionality.

a) Package.json

  "react-jsonschema-form": "^1.5.0",
  "react-jsonschema-form-extras": "^0.9.40",

b) Load dependencies

  <script src="/npm/js/react-jsonschema-form.js"></script>
  <!-- <script src="/npm/js/form-with-extras.js"></script> -->

c) My Form Instance

  const JSONForm = window.JSONSchemaForm.default;

At this point, everything works fine. Perfectly nice should I say.

But when I load form-with-extras.js, it is not clear to me if I need to install all peer dependencies or not. I think I don't need them since I am using your /dist folder, which I guess contains everything. However, Typeahead library (from official repo) has a CSS file, which is not included in yours. So, perhaps it needs to be installed as well. It is unclear to me. The same way, I am not clear if I install react-bootstrap-typeahead I should load it explicitly the way I load all my other dependencies.

If I ignore that and try to use it anyways, I have no idea how to get an instance of those. It is explained that it uses the internal JSONSchemaForm extension mechanism. Well, since I was not able to figure that out, I tried to use anyways. At least load it...

Scenarios at JS console (chrome)

a) Not loading dist/form-with-extras.js

image

b) Loading dist/form-with-extras.js

image

It sorts of change my const JSONForm (because it actually interferes on window.JSONSchemaForm.default), and due to that, no one of my s is working anymore, with the error:

image

I tried several combinations, but since neither react-jsonschema-form nor react-jsonschema-form-extras provide UMD documentation, I am stuck at this point. I am not sure if I am using it incorrectly, or there is an issue here.

Please, can someone provide me some guidance here?

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

1 participant