修改对 children 的调用方式

This commit is contained in:
liaoxuezhi 2019-08-20 23:26:05 +08:00
parent 8c47e84707
commit 3913a77392
1 changed files with 2 additions and 2 deletions

View File

@ -486,12 +486,12 @@ class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
if (Array.isArray(schema)) { if (Array.isArray(schema)) {
return renderChildren($path, schema, rest) as JSX.Element; return renderChildren($path, schema, rest) as JSX.Element;
} else if (schema.children) { } 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, ...rest,
$path: $path, $path: $path,
render: this.renderChild, render: this.renderChild,
ref: this.refFn, ref: this.refFn,
}, schema) : schema.children; });
} else if (!this.renderer) { } else if (!this.renderer) {
return ( return (
<LazyComponent <LazyComponent