import { faStar } from "@fortawesome/free-solid-svg-icons"; import { faMessage } from "@fortawesome/free-regular-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome"; import { useNavigation } from "@react-navigation/native"; import React, { useEffect, useState } from "react"; import { Image, Platform, StyleSheet, Text, TouchableOpacity, View, } from "react-native"; const ShopCard = ({ product, prod }) => { const navigation = useNavigation(); const [shopProd, setshopProd] = useState([]); useEffect(() => { const purch = prod?.filter((item) => item.vendor_api_id === product._id); setshopProd(purch.slice(0, 3)); }, []); return ( navigation.navigate("Shop", { product })} > {product.user_login} {product.rate ? ( <> Rating: {product.rate} ({product.raterTotal}) ) : ( No rating )} Average Response Time: {product.respoTime ? ( <> {product.respoTime}hrs ) : ( )} Main Products: {product.respoTime ? ( <> {product.tags.map((e, i) => ( {e},{" "} ))} ) : ( )} {shopProd?.map((e, i) => ( ))} ); }; const styles = StyleSheet.create({ container: { width: "98%", margin: 5, borderRadius: 6, borderColor: "#dddd", overflow: "hidden", }, wrapper: { width: "100%", alignItems: "center", justifyContent: "center", }, top: { width: "100%", justifyContent: "space-between", alignItems: "center", height: 150, flexDirection: "row", backgroundColor: "#FFFFFF", }, imgWrap: { width: 100, height: 80, alignItems: "center", justifyContent: "center", marginLeft: 10, }, btnWrap: { width: 80, height: 80, // backgroundColor: "#ffaa00", alignItems: "center", justifyContent: "center", }, btnmess: { backgroundColor: "#74fab2", padding: 15, borderRadius: 10, }, details: { height: "100%", width: "50%", justifyContent: "center", // alignItems:'center' }, header: { fontSize: 14, fontWeight: "700", textTransform: "uppercase", }, text: { fontSize: 15, fontWeight: "900", textTransform: "uppercase", color: "#333", letterSpacing: 0.5, }, priceCon: { flexDirection: "row", paddingVertical: 4, }, textPrice: { fontSize: 16, fontWeight: "600", textTransform: "capitalize", color: "#ffaa00", }, textPricePromo: { fontSize: 16, fontWeight: "600", textTransform: "capitalize", textDecorationLine: "line-through", color: "#ffaa00", }, textMin: { fontSize: 11, fontWeight: "600", color: "#bdbdbd", }, textSold: { fontSize: 11, fontWeight: "600", color: "#bdbdbd", }, rateCon: { flexDirection: "row", alignItems: "center", paddingVertical: 3, }, textHead: { fontSize: 11, color: "#292929", }, textRate: { fontSize: 12, color: "#838383", textTransform: "capitalize", }, img: { width: 400, height: 200, resizeMode: "cover", margin: "auto", borderRadius: 10, }, bot: { justifyContent: "center", alignItems: "center", backgroundColor: "#fff", paddingVertical: 10, }, botWrap: { width: "100%", flexDirection: "row", justifyContent: "space-around", }, footer: { flexDirection: "row", justifyContent: "space-between", }, }); export default ShopCard;