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} ); }