修改对 children 的调用方式

This commit is contained in:
liaoxuezhi 2019-08-20 23:26:05 +08:00 committed by catchonme
parent 1c8455382e
commit 9276216e72

View File

@ -486,12 +486,12 @@ class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
if (Array.isArray(schema)) {
return renderChildren($path, schema, rest) as JSX.Element;
} else if (schema.children) {
return typeof schema.children === 'function' ? schema.children({
return React.isValidElement(schema.children) ? schema.children : React.createElement(schema.children as any, {
...rest,
$path: $path,
render: this.renderChild,
ref: this.refFn,
}, schema) : schema.children;
});
} else if (!this.renderer) {
return (
<LazyComponent