Skip to content

Commit

Permalink
fix(next): fix children not rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Nov 13, 2020
1 parent 598303d commit 52ece39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions packages/antd/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export const Form: React.FC<IAntdFormProps &
const onReset = () => {
form.reset({ validate: false, forceClear: false })
}
const renderedChildren = isFn(children)
? children(form)
: cloneChlildren(children)
return (
<PreviewText.ConfigProvider value={props}>
<FormItemDeepProvider {...props}>
Expand All @@ -79,11 +82,7 @@ export const Form: React.FC<IAntdFormProps &
wrapperCol={normalizeCol(props.wrapperCol)}
layout={inline ? 'inline' : props.layout}
>
{() => {
return isFn(children)
? children(form)
: cloneChlildren(children)
}}
{renderedChildren}
</AntdForm>
</div>
</FormItemDeepProvider>
Expand Down
9 changes: 4 additions & 5 deletions packages/next/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export const Form: React.FC<INextFormProps &
}}
>
{form => {
const renderedChildren = isFn(children)
? children(form)
: cloneChlildren(children)
return (
<PreviewText.ConfigProvider value={props}>
<FormItemDeepProvider {...props}>
Expand All @@ -65,11 +68,7 @@ export const Form: React.FC<INextFormProps &
form.reset({ validate: false, forceClear: false })
}}
>
{() => {
return isFn(children)
? children(form)
: cloneChlildren(children)
}}
{renderedChildren}
</NextForm>
</div>
</FormItemDeepProvider>
Expand Down

0 comments on commit 52ece39

Please sign in to comment.