Skip to content

Instantly share code, notes, and snippets.

@Klerith
Created October 17, 2024 13:48
Show Gist options
  • Save Klerith/56f76981437bf59f3db06b127b456bd5 to your computer and use it in GitHub Desktop.
Save Klerith/56f76981437bf59f3db06b127b456bd5 to your computer and use it in GitHub Desktop.
Tarjeta para mostrar un producto
interface Props {
product: Product;
}
export const ProductCard = ({ product }: Props) => {
return (
<ThemedView
style={{
flex: 1,
backgroundColor: '#F9F9F9',
margin: 3,
borderRadius: 5,
overflow: 'hidden',
padding: 5,
}}
>
<TouchableOpacity onPress={() => router.push(`/product/${product.id}`)}>
{product.images.length === 0 ? (
<Image
source={require('../../../assets/images/no-product-image.png')}
style={{ width: '100%', height: 200 }}
/>
) : (
<Image
source={{ uri: product.images[0] }}
style={{ flex: 1, height: 200, width: '100%' }}
/>
)}
<ThemedText
numberOfLines={2}
style={{ textAlign: 'center' }}
darkColor={'black'}
>
{product.title}
</ThemedText>
</TouchableOpacity>
</ThemedView>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment