({ index, total, siblings, style, ...rest }: Props)
| 42 | * ``` |
| 43 | */ |
| 44 | const 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 | |
| 82 | CardContent.displayName = 'Card.Content'; |
| 83 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…