瀏覽代碼

fix: render issue of Modal (#58)

* fix: render issue of Modal

the renderDialogWithTransition function hasn't bee called in Modal if it's mergedMotion

* fix: unify the function call style in "moda.tsx"

Co-authored-by: pointhalo <[email protected]>
Jim Liu 宝玉 4 年之前
父節點
當前提交
01a8894177
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 2 2
      packages/semi-ui/modal/Modal.tsx
  2. 2 2
      packages/semi-ui/modal/ModalTransition.tsx

+ 2 - 2
packages/semi-ui/modal/Modal.tsx

@@ -411,7 +411,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
         if (mergedMotion) {
             return (
                 <ContentTransition motion={mergedMotion} controlled={keepDOM} visible={visible}>
-                    {shouldRender ? this.renderDialogWithTransition : null}
+                    {shouldRender ? (...animationState) => this.renderDialogWithTransition(...animationState) : null}
                 </ContentTransition>
             );
         }
@@ -427,4 +427,4 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
 }
 
 
-export default Modal;
+export default Modal;

+ 2 - 2
packages/semi-ui/modal/ModalTransition.tsx

@@ -1,12 +1,12 @@
 // @ts-ignore Temporarily do not proceed  the action package ts
 import { Transition } from '@douyinfe/semi-animation-react';
-import React, { JSXElementConstructor, ReactChildren } from 'react';
+import React, { JSXElementConstructor } from 'react';
 import { Motion } from '../_base/base';
 
 interface ContentTransitionProps {
     // eslint-disable-next-line max-len
     motion?: Motion<ContentTransitionProps>;
-    children?: ReactChildren | JSXElementConstructor<any>;
+    children?: React.ReactNode | JSXElementConstructor<any>;
     controlled?: boolean;
     visible?: boolean;
 }