import React, { useMemo } from "react"; import { View, type StyleProp, type ViewStyle } from "react-native"; import { useTheme } from "@react-navigation/native"; import Icon, { IconType } from "react-native-dynamic-vector-icons"; import RNBounceable from "@freakycoder/react-native-bounceable"; import type { ICardItem } from "@services/models"; import Text from "@shared-components/text-wrapper/TextWrapper"; import createStyles from "./CardItem.style"; type CustomStyleProp = StyleProp | Array>; interface ICardItemProps { style?: CustomStyleProp; data: ICardItem; onPress: () => void; } const CardItem: React.FC = ({ style, data, onPress }) => { const theme = useTheme(); const { colors } = theme; const styles = useMemo(() => createStyles(theme), [theme]); const { name, description, language, star, fork } = data; const renderHeader = () => ( <> {name} {description} ); const renderLanguage = () => ( {language} ); const renderStar = () => ( {star} ); const renderFork = () => ( {fork} ); return ( {renderHeader()} {renderLanguage()} {renderStar()} {renderFork()} ); }; export default CardItem;