Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/src/components/fields/SchemaField.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since our old tests didn't catch this issue, would it be possible to update them so that we don't regress again?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll do that soon. Thanks for the reminder

}

Expand Down