From 9c1d33e1a4843a385819bf79c7f1c9937a513b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=9D=B0?= Date: Thu, 30 Nov 2023 17:09:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Card=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=87=AA=E5=AE=9A=E4=B9=89=20header=20=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/few-rats-move.md | 5 +++++ packages/react-native/src/card/index.tsx | 12 +++--------- 2 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 .changeset/few-rats-move.md diff --git a/.changeset/few-rats-move.md b/.changeset/few-rats-move.md new file mode 100644 index 0000000000..3736ee7e6d --- /dev/null +++ b/.changeset/few-rats-move.md @@ -0,0 +1,5 @@ +--- +'@td-design/react-native': patch +--- + +修复 Card 组件自定义 header 的bug diff --git a/packages/react-native/src/card/index.tsx b/packages/react-native/src/card/index.tsx index a215fb976c..279ad69c25 100644 --- a/packages/react-native/src/card/index.tsx +++ b/packages/react-native/src/card/index.tsx @@ -55,7 +55,7 @@ const Card: FC = ({ borderRadius={'x2'} style={containerStyle} > -
+ {renderHeader ? renderHeader() :
} {children} {!!footer && {footer}} @@ -66,13 +66,7 @@ Card.displayName = 'Card'; export default Card; const Header = memo( - ({ - hideHeader, - icon, - title, - extra, - renderHeader, - }: Pick) => { + ({ hideHeader, icon, title, extra }: Pick) => { if (hideHeader) return null; const Header = ( @@ -115,7 +109,7 @@ const Header = memo( paddingVertical={'x2'} justifyContent="center" > - {renderHeader ? renderHeader() : Header} + {Header} ); }