Part 2 - Build a Cute Cup Product Catalog with React Native Paper
Build a typed, searchable MugMori product catalog with categories, featured cups, sale prices, and React Native Paper cards.
Build a Cute Cup Product Catalog with React Native Paper
The MugMori foundation is ready. Now we build the catalog customers use to browse cups and print designs. Local data keeps this lesson focused on UI and state before network requests.
Define the product contract
export type CupCategory = 'cats' | 'plants' | 'food' | 'seasonal';
export type Cup = {
id: string;
name: string;
description: string;
price: number;
salePrice?: number;
category: CupCategory;
color: string;
size: string;
imageUrl: string;
inStock: boolean;
};
The optional salePrice tells the component that some products are discounted while others are not.
Build a reusable card
type CupCardProps = {
cup: Cup;
onPress: (cup: Cup) => void;
};
export function CupCard({ cup, onPress }: CupCardProps) {
const displayPrice = cup.salePrice ?? cup.price;
return (
<Card onPress={() => onPress(cup)}>
<Card.Cover source={{ uri: cup.imageUrl }} />
<Card.Content>
<Text variant="titleMedium">{cup.name}</Text>
<Text variant="bodyMedium">{cup.description}</Text>
<Text variant="titleSmall">{displayPrice.toFixed(2)}</Text>
</Card.Content>
</Card>
);
}
The card accepts a callback rather than owning navigation. This keeps it reusable and easier to test.
Add filters
const visibleCups = cups.filter((cup) => {
const matchesCategory = selectedCategory === 'all'
|| cup.category === selectedCategory;
const matchesSearch = cup.name
.toLowerCase()
.includes(search.toLowerCase());
return matchesCategory && matchesSearch;
});
Use a Paper Searchbar and horizontal Chip components for categories. Keep filter state local to the catalog screen.
Treat empty states as part of the design
When a search returns no products, explain what happened and offer a way back. The same principle applies to loading, unavailable images, and out-of-stock products.