Skip to content

Commit

Permalink
fix(react): fix x-content is not work with array type (#1719)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jul 6, 2021
1 parent 4f4be6a commit 2cd60d3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/react/src/components/RecursionField.tsx
Expand Up @@ -32,6 +32,8 @@ export const RecursionField: React.FC<IRecursionFieldProps> = (props) => {
return props.basePath || parent?.address
}
const basePath = getBasePath()
const children =
fieldSchema['x-content'] || fieldSchema['x-component-props']?.['children']
const renderProperties = (field?: Formily.Core.Types.GeneralField) => {
if (props.onlyRenderSelf) return
return (
Expand Down Expand Up @@ -59,7 +61,7 @@ export const RecursionField: React.FC<IRecursionFieldProps> = (props) => {
/>
)
})}
{fieldSchema['x-content']}
{children}
</Fragment>
)
}
Expand All @@ -75,7 +77,9 @@ export const RecursionField: React.FC<IRecursionFieldProps> = (props) => {
)
} else if (fieldSchema.type === 'array') {
return (
<ArrayField {...fieldProps} name={props.name} basePath={basePath} />
<ArrayField {...fieldProps} name={props.name} basePath={basePath}>
{children}
</ArrayField>
)
} else if (fieldSchema.type === 'void') {
if (props.onlyRenderProperties) return renderProperties()
Expand All @@ -87,8 +91,7 @@ export const RecursionField: React.FC<IRecursionFieldProps> = (props) => {
}
return (
<Field {...fieldProps} name={props.name} basePath={basePath}>
{fieldSchema['x-content'] ||
fieldSchema['x-component-props']?.['children']}
{children}
</Field>
)
}
Expand Down

0 comments on commit 2cd60d3

Please sign in to comment.