import { Product } from "@/lib/product" import { ImageBackground, StyleProp, StyleSheet, Text, TouchableHighlight, View, ViewStyle } from "react-native"; import { AnimatedStyle } from "react-native-reanimated"; export type OnProductSelectedFunc = (product : Product) => any; type MyStyle = StyleProp>>; export type ProductTileProps = { product: (Product), onProductSelected?: OnProductSelectedFunc, isActive: boolean, style?: { default?: { highlight?: MyStyle, text?: MyStyle, image?: MyStyle, } active?: { highlight?: MyStyle, text?: MyStyle, image?: MyStyle, } } } const FALLBACK_IMAGE = ""; export function ProductTile ({product, onProductSelected, isActive, style} : ProductTileProps) { const _style = (isActive ? style?.active : style?.default) || {}; return ( onProductSelected && onProductSelected(product)}> {product.attributes.name || `Product ${product.id}`} ({product.pricePerUnitDisplay}) ); } const styles = StyleSheet.create({ highlight: { }, image: { }, text: { }, tile: { }, })