diff --git a/packages/core/src/components/fields/SchemaField.js b/packages/core/src/components/fields/SchemaField.js index d478cf6565..1f65be0dc2 100644 --- a/packages/core/src/components/fields/SchemaField.js +++ b/packages/core/src/components/fields/SchemaField.js @@ -2,6 +2,7 @@ import { ADDITIONAL_PROPERTY_FLAG } from "../../utils"; import IconButton from "../IconButton"; import React from "react"; import PropTypes from "prop-types"; +import * as ReactIs from "react-is"; import * as types from "../../types"; import { @@ -30,7 +31,7 @@ const COMPONENT_TYPES = { function getFieldComponent(schema, uiSchema, idSchema, fields) { const field = uiSchema["ui:field"]; - if (typeof field === "function") { + if (typeof field !== "string" && ReactIs.isValidElementType(field)) { return field; } if (typeof field === "string" && field in fields) { diff --git a/packages/core/src/utils.js b/packages/core/src/utils.js index ebfaa89dfe..4044e242d0 100644 --- a/packages/core/src/utils.js +++ b/packages/core/src/utils.js @@ -108,11 +108,7 @@ export function getWidget(schema, widget, registeredWidgets = {}) { return Widget.MergedWidget; } - if ( - typeof widget === "function" || - ReactIs.isForwardRef(React.createElement(widget)) || - ReactIs.isMemo(widget) - ) { + if (typeof widget !== "string" && ReactIs.isValidElementType(widget)) { return mergeOptions(widget); }