MCPcopy Create free account
hub / github.com/callstack/react-native-paper / CardContent

Function CardContent

src/components/Card/CardContent.tsx:44–80  ·  view source on GitHub ↗
({ index, total, siblings, style, ...rest }: Props)

Source from the content-addressed store, hash-verified

42 * ```
43 */
44const CardContent = ({ index, total, siblings, style, ...rest }: Props) => {
45 const cover = 'withInternalTheme(CardCover)';
46 const title = 'withInternalTheme(CardTitle)';
47
48 let contentStyle, prev, next;
49
50 if (typeof index === 'number' && siblings) {
51 prev = siblings[index - 1];
52 next = siblings[index + 1];
53 }
54
55 if (
56 (prev === cover && next === cover) ||
57 (prev === title && next === title) ||
58 total === 1
59 ) {
60 contentStyle = styles.only;
61 } else if (index === 0) {
62 if (next === cover || next === title) {
63 contentStyle = styles.only;
64 } else {
65 contentStyle = styles.first;
66 }
67 } else if (typeof total === 'number' && index === total - 1) {
68 if (prev === cover || prev === title) {
69 contentStyle = styles.only;
70 } else {
71 contentStyle = styles.last;
72 }
73 } else if (prev === cover || prev === title) {
74 contentStyle = styles.first;
75 } else if (next === cover || next === title) {
76 contentStyle = styles.last;
77 }
78
79 return <View {...rest} style={[styles.container, contentStyle, style]} />;
80};
81
82CardContent.displayName = 'Card.Content';
83

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…