import React, { FunctionComponent } from 'react'; import { View, Text, Image } from 'react-native'; import Price from '../price'; import Tag from '../tag'; import cardStyles from './styles'; import { useConfig } from '../configprovider'; export interface CardProps { imgUrl: string; title: string; price: string; vipPrice: string; shopDesc: string; delivery: string; shopName: string; className: string; style: any; prolistTpl: React.ReactNode; shopTagTpl: React.ReactNode; originTpl: React.ReactNode; footerTpl: React.ReactNode; } const defaultProps = {} as CardProps; export const Card: FunctionComponent< Partial & React.HTMLAttributes > = (props) => { const { className, style, imgUrl, title, price, vipPrice, shopDesc, delivery, shopName, shopTagTpl, originTpl, prolistTpl, footerTpl, ...rest } = { ...defaultProps, ...props, }; const { theme } = useConfig(); const styles = cardStyles(theme); return ( {title} {prolistTpl} {originTpl || } {shopTagTpl || ( <> {shopDesc} {delivery} )} {shopName} {footerTpl} ); }; Card.defaultProps = defaultProps; Card.displayName = 'NutCard';