# React Native e-commerce store template (Pro)

> A complete React Native boutique store for iOS, Android and the web: an editorial front page with a carousel, search and sort, product pages with swatches, gallery and reviews, a bag with swipe actions and promo codes, a four-step checkout, order tracking, saved items and the account.

# Boutique store: Ouro Pro

Ouro sells handmade home goods. Product pictures are drawn in the swatch you pick, so the demo needs no photos; swap in your images through ProductCard's `renderImage`. Try the promo code SLOW10 in the bag.

See it live, on any device

## Use the whole app

```tsx
import { StoreApp } from '@patine-ui/pro';

<StoreApp />;
```

| Prop | Type | Default |
| --- | --- | --- |
| `initialRoute` | 'discover' \| 'shop' \| 'product' \| 'bag' \| 'checkout' \| 'order' \| 'saved' \| 'account' | 'discover' |
| `demo` | `'ready'` \| `'loading'` \| `'empty'` \| `'error'` | `'ready'` |
| `insets` | `{ top, bottom }` | None |
| `platform` | `'ios'` \| `'android'` \| `'web'` | `Platform.OS` |

Screens move the platform's way: on iOS a pushed screen slides in from the trailing edge, on Android they fade through, on the web and between tabs they fade in. Reduce motion turns it off.

## Screens

| Screen | What it does |
| --- | --- |
| `DiscoverScreen` | Collections in an autoplaying Carousel, categories, new arrivals and bestsellers on Pro's ProductCard |
| `ShopScreen` | SearchField, category chips, a sort Select and a grid that grows to four columns |
| `ProductScreen` | A Pager gallery with dots, swatches, a quantity stepper, Add to bag that becomes View bag, an Accordion of details, ReviewList, pairings |
| `BagScreen` | Free-delivery progress, SwipeableRow to save or remove, a promo code, totals, Checkout pinned |
| `StoreCheckoutScreen` | Pro's Wizard: address with validation, delivery RadioGroup, payment with brand logos, review |
| `OrderScreen` | Pro's OrderTracker with courier scans, the items, help |
| `SavedScreen` | The wishlist with Add to bag on the card and an empty state |
| `StoreAccountScreen` | A members card with points, orders with status badges, settings |

Every screen is exported on its own, takes its data as props, and has sample data as defaults. `bagTotals(lines, products, discount, delivery)` works out items, promo, delivery (free past €75) and how far from free delivery; `filterProducts` searches, filters and sorts.

## Built with

The free components, from `patine-ui`:

[Accordion](/docs/components/accordion) · [Avatar](/docs/components/avatar) · [Badge](/docs/components/badge) · [Button](/docs/components/button) · [Carousel, PageIndicator, Pager](/docs/components/carousel) · [ChipGroup](/docs/components/chip-group) · [DescriptionList](/docs/components/description-list) · [Heading, Text](/docs/components/text) · [List, ListItem](/docs/components/list) · [Progress](/docs/components/progress) · [RadioGroup, RadioGroupItem](/docs/components/radio-group) · [Rating](/docs/components/rating) · [SearchField](/docs/components/search-field) · [Select](/docs/components/select) · [Separator](/docs/components/separator) · [SwipeableRow](/docs/components/swipeable-row) · [TextField](/docs/components/text-field)

And from Patine Pro:

- [App shell and layout](/docs/pro/layout) PRO
- [Brand logos](/docs/components/brand-icons) PRO
- [Order tracker](/docs/blocks/order-tracker) PRO
- [Product card](/docs/blocks/product-card) PRO
- [Review list](/docs/blocks/review-list) PRO
- [Wizard](/docs/blocks/wizard) PRO

## Files

```text
store/
├── components/
│   └── StoreProductCard.tsx
├── hooks/
│   ├── useStoreApp.ts
│   └── useStoreScreens.ts
├── BagScreen.tsx
├── BrowseScreen.tsx
├── DiscoverScreen.tsx
├── index.ts
├── OrderScreen.tsx
├── ProductScreen.tsx
├── SavedScreen.tsx
├── store.constants.ts
├── store.types.ts
├── store.utils.ts
├── StoreAccountScreen.tsx
├── StoreApp.tsx
└── StoreCheckoutScreen.tsx
```

It also uses `shared/`, the theme, money formatting and screen transitions every Pro app shares.

## A look at the code

The bag’s totals, promo and free-delivery threshold, from `store.utils.ts`:

```tsx
/**
 * What the bag comes to: the items, a promo off them, delivery (free past the threshold for standard), and how far from free
 * shipping it still is.
 */
export const bagTotals = (lines: readonly BagLine[], products: readonly Product[], discount = 0, delivery: number = SHIPPING_FEE) => {
  const subtotal = lines.reduce((sum, l) => sum + (productById(products, l.productId)?.price ?? 0) * l.quantity, 0);
  const off = Math.round(subtotal * discount);
  const shipping = subtotal === 0 || (delivery === SHIPPING_FEE && subtotal - off >= FREE_SHIPPING) ? 0 : delivery;
  return {
    count: lines.reduce((n, l) => n + l.quantity, 0),
    subtotal,
    discount: off,
    shipping,
    total: subtotal - off + shipping,
    toFreeShipping: Math.max(0, FREE_SHIPPING - (subtotal - off)),
  };
};
```

Get the source with Pro
