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

useMuiComponent from example fails #2905

Closed
3 of 4 tasks
joseika opened this issue Jul 4, 2022 · 2 comments
Closed
3 of 4 tasks

useMuiComponent from example fails #2905

joseika opened this issue Jul 4, 2022 · 2 comments
Assignees
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned

Comments

@joseika
Copy link

joseika commented Jul 4, 2022

Prerequisites

What theme are you using?

material-ui

Version

4.2.0

Current Behavior

I implemented a custom field based on the documentation example: https://react-jsonschema-form.readthedocs.io/en/latest/advanced-customization/material-ui/customizing-material-ui/#example-of-a-custom-field-for-rjsfmaterial-ui

Error:
export 'useMuiComponent' (imported as 'useMuiComponent') was not found in '@rjsf/material-ui/v4' (possible exports: ArrayFieldTemplate, FieldTemplate, Fields, MuiComponentContext, MuiForm, ObjectFieldTemplate, Theme, Widgets, default)

Is the export missing, or is the documentation outdated?

Expected Behavior

Examples in documentation should work.

Steps To Reproduce

  1. Set up a Create React App project
  2. Install @rjsf/core@4.2.0, rjsf/material-ui@4.2.0
  3. Add code from example
  4. Build fails

Environment

- OS: Ubuntu 20.04
- Node: 16.14.0
- npm: 8.3.1

Anything else?

No response

@joseika joseika added bug needs triage Initial label given, to be assigned correct labels and assigned labels Jul 4, 2022
@heath-freenome
Copy link
Member

Whoops, the export is missing. You can also do React.useContext(MuiComponentContext) as a work around

@heath-freenome
Copy link
Member

Fixed in v5 beta by removing the whole hooks implementation: https://react-jsonschema-form.readthedocs.io/en/latest/5.x%20upgrade%20guide/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned
Projects
None yet
Development

No branches or pull requests

4 participants