diff --git a/components/_util/reactNode.ts b/components/_util/reactNode.ts index 872948d94f..ccdc8015be 100644 --- a/components/_util/reactNode.ts +++ b/components/_util/reactNode.ts @@ -13,7 +13,10 @@ export function replaceElement( ): React.ReactNode { if (!isValidElement(element)) return replacement; - return React.cloneElement(element, typeof props === 'function' ? props(element.props) : props); + return React.cloneElement( + element, + typeof props === 'function' ? props(element.props || {}) : props, + ); } export function cloneElement(element: React.ReactNode, props?: RenderProps): React.ReactElement { diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index d81b973e67..17254c77f0 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -37674,27 +37674,63 @@ exports[`ConfigProvider components Upload configProvider 1`] = ` class="config-upload-list config-upload-list-text" >