react-jsonschema-form
react-jsonschema-form copied to clipboard
getWidget throws "Unsupported widget definition: undefined" when widget param is a string
Prerequisites
- [X] I have searched the existing issues
- [X] I understand that providing a SSCCE example is tremendously useful to the maintainers.
- [X] I have read the documentation
- [X] Ideally, I'm providing a sample JSFiddle or a shared playground link demonstrating the issue.
What theme are you using?
core
Version
4.1.1
Current Behavior
Create a custom widget like
DateWidget: (props: WidgetProps) => {
const { value, label, onChange, required, readonly, disabled, options, schema } =
props
const widget = utils.getWidget(schema, 'date')
return (
<>{widget}</>
)
},
Even though the widget
parameter passed to the getWidget
function is a string, it will fail throwing "Unsupported widget definition: undefined".
Expected Behavior
Getting the proper Widget given the schema and its key
Steps To Reproduce
Read current behaviour
Environment
- OS: Ubuntu 22
- Node: 16
- npm: 8
Anything else?
No response
Have you added the new widget to the widgets
prop of the Form
?
There is no new widget, I'm just trying to get the default DateWidget here
Which theme?
Bootstrap 3 (default)
using const widget = utils.getWidget(schema, 'date')
will cause this problem if the utils.getSchemaType(schema)
returns something other than string
This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.
This issue was closed because of lack of recent activity. Reopen if you still need assistance.