BOLO - Zanegerous/CopperToGold GitHub Wiki
this portion of the code initializes temporary placeholder data to simulate items retrieved from eBay.
const placeholderItems = [
{
id: "1",
title: "Vintage Camera",
price: "$12.99",
condition: "Used",
image: images.Camera,
},
{
id: "2",
title: "Retro Video Game",
price: "$24.99",
condition: "Used",
image: images.Retro,
},
{
id: "3",
title: "Designer Shoes",
price: "$45.00",
condition: "Pre-owned",
image: images.Shoes,
},
{
id: "4",
title: "Collectible Figurine",
price: "$19.50",
condition: "New",
image: images.Figurine,
},
{
id: "5",
title: "Smartphone",
price: "$199.99",
condition: "Refurbished",
image: images.Smartphone,
},
];
This part of the code implements the swipeable card interface. The component uses the react-native-deck-swiper library to create interactive, gesture-based functionality where users can swipe left or right on individual cards.
const onSwipedLeft = (index: number) => {
console.log("Swiped left on:", placeholderItems[index].title);
};
// Called whenever a user swipes right
const onSwipedRight = (index: number) => {
console.log("Swiped right on:", placeholderItems[index].title);
};
const { t } = useTranslation();
return (
<SafeAreaView style={styles.container}>
<Text style={styles.header}>{t("BoloItems")}</Text>
<DeckSwiper
cards={placeholderItems}
cardIndex={cardIndex}
onSwipedLeft={onSwipedLeft}
onSwipedRight={onSwipedRight}
onSwiped={(index) => setCardIndex(index + 1)}
renderCard={(item) => {
if (!item) return null;
return (
<View style={styles.card}>
<Image source={item.image} style={styles.image} />
<Text style={styles.title}>{item.title}</Text>
<Text style={styles.detail}>Price: {item.price}</Text>
<Text style={styles.detail}>Condition: {item.condition}</Text>
</View>
);
}}
backgroundColor={"transparent"}
stackSize={3}
/>
</SafeAreaView>