jsonschema-form-for-material-ui
jsonschema-form-for-material-ui copied to clipboard
Using MuiThemeProvider causes error when theme changes
Firstly, I'd like to thank you for your efforts with this project. I've tried multiple Material UI based JSON forms libraries and yours seems to be the only one that is actually compatible with my application!
Anyway, onto the error...
I encounter the following error when I toggle a light/dark theme within my application when viewing a form:
TypeError: Cannot read property 'anchorEl' of null at RawConfiguredField.shouldComponentUpdate (ConfiguredField.js:74)
This appears to be a similar issue to #17 but I encounter the error when using a MuiThemeProvider wrapper around my application. When my app triggers a change to the palette of the theme the error occurs.
Is there any workaround for this problem? Or is this going to have to wait for V2 to be implemented?
Thanks.
Hey, @weagertron ! There are many exciting things happening with Mozilla's jsonSchemaForm, see here: https://github.com/mozilla-services/react-jsonschema-form/issues/1222 there's also a good fork available there, which is much better than mine.
Because of this, this repo will not be maintained, due to my personal time constraints, and a much better option on the horizon. For some context, this repo was a fork of a copy or something similarly bizarre, and it was not based on Mozilla's repo at all.
I would look into https://github.com/cybertec-postgresql/rjsf-material-ui
Thanks for the rapid response @TwoAbove !
I did take a look at the mozilla-services page but didn't notice the fork you mentioned, I'll take a look at that now. Thanks for the tip!
I did try out rjsf but unfortunately I ran into multiple stumbling blocks and compatibility issues with that library which is why I ended up here.
Feel free to close this issue as I believe you've given me enough to continue my adventures into JSON forms. But if there are any further tips you can provide then I'm sure myself and others will be very appreciative of them!
Thanks again for the help, keep up the great work!
That's what email notifications are for :wink:
I found the error, and I'll make a quick fix
You are a gentleman and a scholar @TwoAbove !
It was an issue with the re-write that I did. Forgot to remove an unused ref: https://github.com/TwoAbove/jsonschema-form-for-material-ui/pull/22 In a bit I'll deploy v1.4.3
Great, thanks! I'll keep an eye out for it :)
@weagertron Deployed
Received and it resolved my error! Thank you!
One thing I notice though is that once the theme is changed and is then reverted back i.e. light -> dark -> light, it then places a border around the form and some of the formatting appears a little off. This all seems to be fixed once an onChange
event is called.
Edit: Actually this seems to happen on the first theme change too like when changing from Dark -> Light.
I suspect this may be something to do with my theming but I thought I'd mention it in case you were experiencing the same issue