@@ -22,8 +22,13 @@ import { forwardRef } from '../../utils/forwardRef';
2222import hasTouchHandler from '../../utils/hasTouchHandler' ;
2323import { splitStyles } from '../../utils/splitStyles' ;
2424import Surface from '../Surface' ;
25- // eslint-disable-next-line @typescript-eslint/no-unused-vars
26- // eslint-disable-next-line @typescript-eslint/no-unused-vars
25+
26+ type CardComposition = {
27+ Content : typeof CardContent ;
28+ Actions : typeof CardActions ;
29+ Cover : typeof CardCover ;
30+ Title : typeof CardTitle ;
31+ } ;
2732
2833type OutlinedCardProps = {
2934 mode : 'outlined' ;
@@ -131,7 +136,8 @@ export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
131136 * export default MyComponent;
132137 * ```
133138 */
134- const CardComponent = (
139+
140+ const Card = (
135141 {
136142 elevation : cardElevation = 1 ,
137143 delayLongPress,
@@ -330,24 +336,19 @@ const CardComponent = (
330336 ) ;
331337} ;
332338
333- const Component = forwardRef ( CardComponent ) ;
334- Component . displayName = ' Card' ;
339+ Card . displayName = 'Card' ;
340+ const Component = forwardRef ( Card ) ;
335341
336- const Card = Component as typeof Component & {
337- Content : typeof CardContent ;
338- Actions : typeof CardActions ;
339- Cover : typeof CardCover ;
340- Title : typeof CardTitle ;
341- } ;
342+ const CardComponent = Component as typeof Component & CardComposition ;
342343
343344// @component ./CardContent.tsx
344- Card . Content = CardContent ;
345+ CardComponent . Content = CardContent ;
345346// @component ./CardActions.tsx
346- Card . Actions = CardActions ;
347+ CardComponent . Actions = CardActions ;
347348// @component ./CardCover.tsx
348- Card . Cover = CardCover ;
349+ CardComponent . Cover = CardCover ;
349350// @component ./CardTitle.tsx
350- Card . Title = CardTitle ;
351+ CardComponent . Title = CardTitle ;
351352
352353const styles = StyleSheet . create ( {
353354 innerContainer : {
@@ -365,4 +366,4 @@ const styles = StyleSheet.create({
365366 } ,
366367} ) ;
367368
368- export default Card ;
369+ export default CardComponent ;
0 commit comments