import React from 'react'; import { View, Text, Image, StyleSheet, TouchableOpacity } from 'react-native'; import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen'; import { HeartIcon } from 'react-native-heroicons/outline'; import { HeartIcon as SolidHeartIcon, StarIcon } from 'react-native-heroicons/solid'; import { useNavigation } from '@react-navigation/native'; const ItemCard = ({ item, isFavorite, onToggleFavorite }) => { const navigation = useNavigation(); return ( navigation.navigate('ProductDetails', { id: item.id })} className="relative" style={{ width: wp('45%') }} > { e.stopPropagation(); onToggleFavorite(item); }} className="absolute right-4 top-4 bg-white/50 p-2 rounded-full" > {isFavorite ? ( ) : ( )} {item.name || item.title} {item.rating || 0} Rs {item.price || 0} ); } const styles = StyleSheet.create({ card: { backgroundColor: '#fff', margin: 10, borderRadius: 10, elevation: 2, flex: 1, alignItems: 'center', padding: 10, }, image: { width: '100%', height: 150, borderRadius: 8, }, heartButton: { position: 'absolute', top: 10, right: 10, padding: 5, }, title: { fontSize: 16, fontWeight: 'bold', marginTop: 8, }, price: { fontWeight: 'bold', fontSize: 16, color: '#555', marginTop: 4, }, ratingContainer: { flexDirection: 'row', alignItems: 'center', marginTop: 4, }, rating: { fontSize: 14, marginRight: 4, color: '#f5a623', }, }); export default ItemCard;