import { memo } from 'react'; import { FlatList, ListRenderItemInfo, Pressable, StyleProp, StyleSheet, Text, View, ViewStyle, } from 'react-native'; import { Image } from 'expo-image'; import { Ionicons } from '@expo/vector-icons'; export type CommunityItem = { id: string; title: string; image: string; chip: string; actionLabel: string; }; type CommunityGridProps = { items: CommunityItem[]; onPressCard?: (item: CommunityItem) => void; onPressAction?: (item: CommunityItem) => void; }; export function CommunityGrid({ items, onPressCard, onPressAction }: CommunityGridProps) { const renderItem = ({ item, index }: ListRenderItemInfo) => { const isLeftColumn = index % 2 === 0; return ( ); }; return ( item.id} numColumns={2} scrollEnabled={false} columnWrapperStyle={styles.row} contentContainerStyle={styles.contentContainer} /> ); } type CommunityCardProps = { item: CommunityItem; style?: StyleProp; onPressCard?: (item: CommunityItem) => void; onPressAction?: (item: CommunityItem) => void; }; const CommunityCard = memo(({ item, style, onPressCard, onPressAction }: CommunityCardProps) => { return ( onPressCard?.(item)} style={[styles.card, style]}> {item.title} onPressAction?.(item)} /> ); }); CommunityCard.displayName = 'CommunityCard'; type ChipProps = { label: string; }; const Chip = memo(({ label }: ChipProps) => { return ( {label} ); }); Chip.displayName = 'CommunityChip'; type ActionButtonProps = { label: string; onPress: () => void; }; const ActionButton = memo(({ label, onPress }: ActionButtonProps) => { return ( [styles.button, pressed && styles.buttonPressed]}> {label} ); }); ActionButton.displayName = 'CommunityActionButton'; const styles = StyleSheet.create({ contentContainer: { paddingBottom: 24, }, row: { justifyContent: 'space-between', marginBottom: 18, }, cardWrapper: { flex: 1, }, cardLeft: { marginRight: 8, }, cardRight: { marginLeft: 8, }, card: { backgroundColor: '#101115', borderRadius: 20, padding: 14, borderWidth: 1, borderColor: '#1C1D22', }, cardImage: { width: '100%', height: 148, borderRadius: 16, marginBottom: 14, }, cardTitle: { fontSize: 13, letterSpacing: 0.8, color: '#F5F8FF', marginBottom: 12, }, chip: { position: 'absolute', top: 12, right: 12, backgroundColor: 'rgba(5, 5, 5, 0.72)', borderRadius: 14, paddingHorizontal: 12, paddingVertical: 4, flexDirection: 'row', alignItems: 'center', }, chipIcon: { marginRight: 6, }, chipText: { color: '#C7FF00', fontSize: 11, fontWeight: '700', }, button: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', paddingVertical: 10, borderRadius: 14, backgroundColor: '#B7FF2F', }, buttonPressed: { opacity: 0.9, }, buttonIcon: { marginRight: 4, }, buttonText: { fontSize: 14, fontWeight: '700', color: '#050505', }, });