v0.1 public beta early access on GitHub
Home / Screens / ecommerce-order-cancel
Screen template

Order Cancel Screen

Recap card with item thumbs and refund destination, a radio-row reason picker with optional note, and a keep-vs-destructive-confirm sticky bar

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection · warning
$ npx lumioui add ecommerce-order-cancel
import { OrderCancelScreen } from "@/screens/ecommerce/order-cancel";
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
ecommerce/order-cancel.tsxsource · yours to edit
import * as React from "react";
import { useState } from "react";
import { View, ScrollView } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Card, Glass, Icon, Image, RadioGroup, RadioGroupItem, Text, Textarea } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, catalogImg, LumioMark, Mount, Press, StickyBottomBar, World } from "../shared";

export interface CancelReason {
  id: string;
  label: string;
}

export interface OrderCancelScreenProps {
  orderId?: string;
  itemThumbs?: { name: string; imageUrl?: string }[];
  total?: number;
  currency?: string;
  /** Refund destination — "Mastercard •••• 5577". */
  refundMethod?: string;
  /** "5–7 business days". */
  refundTiming?: string;
  reasons?: CancelReason[];
  onConfirm?: (reasonId: string, note: string) => void;
  onKeepOrder?: () => void;
  onBack?: () => void;
}

const img = (p: Parameters<typeof catalogImg>[0]) => catalogImg(p, 120, 150);

const DEFAULT_REASONS: CancelReason[] = [
  { id: "mistake", label: "Ordered by mistake" },
  { id: "better-price", label: "Found a better price elsewhere" },
  { id: "too-slow", label: "Shipping takes too long" },
  { id: "changed-mind", label: "Changed my mind" },
  { id: "other", label: "Other" },
];

const DEFAULT_THUMBS = [
  { name: "Court Leather Sneakers", imageUrl: img("sneakers") },
];

const fmt = (n: number, currency = "$") =>
  `${currency}${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;

/** Order cancel — what you're cancelling and what comes back, a reason
 *  picker, optional note, and a destructive confirm bar. */
export function OrderCancelScreen({
  orderId = "HL-2077",
  itemThumbs = DEFAULT_THUMBS,
  total = 145.0,
  currency = "$",
  refundMethod = "Mastercard •••• 5577",
  refundTiming = "5–7 business days",
  reasons = DEFAULT_REASONS,
  onConfirm,
  onKeepOrder,
  onBack,
}: OrderCancelScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [reasonId, setReasonId] = useState(reasons[0]?.id ?? "");
  const [note, setNote] = useState("");
  const showNote = reasonId === "other" || note.length > 0;

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + centered brand/title pill. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <View className="h-11 w-11" />
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Cancel order
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerClassName="gap-4 px-6"
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: 140 }}
        keyboardShouldPersistTaps="handled"
      >
        {/* Recap — the order being cancelled and the refund coming back. */}
        <Mount>
          <Card variant="elevated" className="rounded-3xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="gap-3 p-5">
              <View className="flex-row items-center justify-between">
                <Text variant="small" className="font-semibold">
                  Order {orderId}
                </Text>
                <View className="flex-row items-center gap-2">
                  {itemThumbs.map((it, i) => (
                    <Image
                      key={`${it.name}-${i}`}
                      source={it.imageUrl ? { uri: it.imageUrl } : undefined}
                      rounded="xl"
                      aspectRatio={4 / 5}
                      className="w-9"
                      accessibilityLabel={`Photo of ${it.name}`}
                    />
                  ))}
                </View>
              </View>
              <View className="flex-row items-center gap-2">
                <Icon name="refresh" size="sm" color="success" />
                <Text variant="small" className="flex-1">
                  Refund of {fmt(total, currency)} to {refundMethod}
                </Text>
              </View>
              <Text variant="muted" className="text-xs">
                Refunds post within {refundTiming}.
              </Text>
            </Card.Content>
          </Card>
        </Mount>

        {/* Reasons — radio rows, same idiom as checkout's delivery picker. */}
        <Mount delay={BLOCK_STAGGER} className="gap-2">
          <Text
            variant="muted"
            className="px-1 text-xs font-medium uppercase tracking-wider"
            accessibilityRole="header"
          >
            Why are you cancelling?
          </Text>
          {/* Grace note — the window where cancellation is still free. */}
          <Text variant="muted" className="pb-2 text-xs">
            Free cancellation — this order hasn't shipped yet
          </Text>
          <RadioGroup
            value={reasonId}
            onValueChange={setReasonId}
            accessibilityLabel="Cancellation reason"
            className="gap-2"
          >
            {reasons.map((r) => {
              const selected = r.id === reasonId;
              return (
                <View
                  key={r.id}
                  className={cn(
                    "rounded-2xl border-2",
                    selected ? "border-[#BEF04C] bg-[#EDF8C4] dark:bg-[#1E2410]" : "border-transparent bg-white dark:bg-[#1A1A20]"
                  )}
                >
                  {/* The item is just the ring — the label is overlaid with
                      pointerEvents="none" so the whole row stays one target. */}
                  <RadioGroupItem
                    value={r.id}
                    className="w-full px-4 py-4"
                    accessibilityLabel={r.label}
                  />
                  <View
                    pointerEvents="none"
                    className="absolute inset-0 flex-row items-center pl-14 pr-4"
                  >
                    <Text variant="small">{r.label}</Text>
                  </View>
                </View>
              );
            })}
          </RadioGroup>
        </Mount>

        {/* Optional note — only relevant for "Other". */}
        {showNote ? (
          <Mount delay={BLOCK_STAGGER}>
            <Textarea
              glass
              label="Tell us more (optional)"
              placeholder="Anything we should know?"
              value={note}
              onChangeText={setNote}
              maxLength={280}
              accessibilityLabel="Cancellation note"
            />
          </Mount>
        ) : null}
      </ScrollView>

      {/* Keep vs cancel — the safe action carries the weight (solid pill),
          the destructive action quiets to a text link under it. */}
      <StickyBottomBar>
        <View className="gap-1 rounded-3xl bg-white p-4 shadow-sm dark:bg-[#1A1A20]">
        <Button
          tone="inverse"
          className="bg-[#1B1B26]"
          onPress={() => {
            haptics.light();
            onKeepOrder?.();
          }}
          accessibilityLabel="Keep this order"
        >
          Keep my order
        </Button>
        <Button
          variant="ghost"
          // haptic={false} — the Button's built-in light tap would double the
          // warning fired below; this is a confirm, not a casual tap.
          haptic={false}
          onPress={() => {
            haptics.warning();
            onConfirm?.(reasonId, note.trim());
          }}
          accessibilityLabel={`Confirm cancellation of order ${orderId}`}
          textClassName="font-medium text-destructive"
        >
          Cancel order
        </Button>
        </View>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
OrderCancelScreen.displayName = "OrderCancelScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Order Cancel Screen" screen in React Native using LumioUI.

Goal: Recap card with item thumbs and refund destination, a radio-row reason picker with optional note, and a keep-vs-destructive-confirm sticky bar Match the reference implementation's layout, behavior, and motion exactly — this is a production screen, not a mockup.

## Setup

Fastest path — install the screen plus its component deps:

```bash
npx lumioui add ecommerce-order-cancel
```

Or pull just the components: `npx lumioui add button card icon image radio-group text textarea`

Native packages:
- @lumioui/ui@latest
- @lumioui/core@latest
- react-native-safe-area-context@*
- react-native-reanimated@*
- react-native-svg@*
- nativewind@*

Stack assumptions: Expo SDK 54 / RN 0.81, Reanimated 4, NativeWind v4, TypeScript strict, Expo Go compatible.

## Components — how, where, when

### `button` — Tactile pill button with press spring, ink wash and async loading.
- `<Button>` ×2

### `card` — Compound surface — header, title, content and footer slots.
- `<Card>` ×1

### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×2

### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×1

### `radio-group` — Single-select options with animated indicator.
- `<RadioGroup>` ×1
- `<RadioGroupItem>` ×1 — The item is just the ring — the label is overlaid with pointerEvents="none" so the whole row stays one target.

### `text` — Themed type scale from caption to display.
- `<Text>` ×7

### `textarea` — Multiline field with auto-grow and character count.
- `<Textarea>` ×1

## Conventions (non-negotiable)

- Styling via NativeWind `className` with semantic tokens only: `bg-background`, `text-foreground`, `bg-card`, `text-card-foreground`, `bg-secondary`, `bg-muted`, `text-muted-foreground`, `bg-accent`, `bg-destructive`, `border-border`. Hard-coded colors only inside media overlays (`text-white`, `bg-black/N`).
- Motion via the token presets from `@lumioui/core` (`spring.press`, `spring.surface`, `spring.glide`, `timing.fast`, `timing.slow`, …) — no bespoke spring configs or durations.
- Gate transform motion behind `useReducedMotion()`; keep opacity/color feedback, drop travel and overshoot.
- Haptics via `useHaptic()`: `light` on press, `selection` on toggle/select, `warning` on invalid input. Never import expo-haptics directly.
- Press feedback via `usePressAnimation()` (~0.97 scale), not `activeOpacity` tricks.
- a11y: `accessibilityRole` + `accessibilityLabel` on every control, touch targets ≥44pt.
- Entrance choreography: staggered `Mount` wrappers (delay 0/60/120…) so regions land in sequence instead of popping in at once.
- Wrap the screen in `SafeAreaView`; keep dark mode working via the semantic tokens.

## Deliverable

One file: `screens/ecommerce/order-cancel.tsx` exporting OrderCancelScreen. Preserve the props interface — the host app wires the callbacks (navigation, submit handlers) through them.

## Reference implementation

The LumioUI source for this screen — reproduce it faithfully:

```tsx
import * as React from "react";
import { useState } from "react";
import { View, ScrollView } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Card, Glass, Icon, Image, RadioGroup, RadioGroupItem, Text, Textarea } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, catalogImg, LumioMark, Mount, Press, StickyBottomBar, World } from "../shared";

export interface CancelReason {
  id: string;
  label: string;
}

export interface OrderCancelScreenProps {
  orderId?: string;
  itemThumbs?: { name: string; imageUrl?: string }[];
  total?: number;
  currency?: string;
  /** Refund destination — "Mastercard •••• 5577". */
  refundMethod?: string;
  /** "5–7 business days". */
  refundTiming?: string;
  reasons?: CancelReason[];
  onConfirm?: (reasonId: string, note: string) => void;
  onKeepOrder?: () => void;
  onBack?: () => void;
}

const img = (p: Parameters<typeof catalogImg>[0]) => catalogImg(p, 120, 150);

const DEFAULT_REASONS: CancelReason[] = [
  { id: "mistake", label: "Ordered by mistake" },
  { id: "better-price", label: "Found a better price elsewhere" },
  { id: "too-slow", label: "Shipping takes too long" },
  { id: "changed-mind", label: "Changed my mind" },
  { id: "other", label: "Other" },
];

const DEFAULT_THUMBS = [
  { name: "Court Leather Sneakers", imageUrl: img("sneakers") },
];

const fmt = (n: number, currency = "$") =>
  `${currency}${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;

/** Order cancel — what you're cancelling and what comes back, a reason
 *  picker, optional note, and a destructive confirm bar. */
export function OrderCancelScreen({
  orderId = "HL-2077",
  itemThumbs = DEFAULT_THUMBS,
  total = 145.0,
  currency = "$",
  refundMethod = "Mastercard •••• 5577",
  refundTiming = "5–7 business days",
  reasons = DEFAULT_REASONS,
  onConfirm,
  onKeepOrder,
  onBack,
}: OrderCancelScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [reasonId, setReasonId] = useState(reasons[0]?.id ?? "");
  const [note, setNote] = useState("");
  const showNote = reasonId === "other" || note.length > 0;

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + centered brand/title pill. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center justify-between">
          <Glass interactive effect="regular" className="h-11 w-11 items-center justify-center rounded-full">
            <Press
              haptic="light"
              onPress={() => onBack?.()}
              accessibilityRole="button"
              accessibilityLabel="Go back"
              className="h-9 w-9 items-center justify-center"
            >
              <Icon name="chevron-left" size="md" color="foreground" />
            </Press>
          </Glass>
          <View className="h-11 w-11" />
        </View>
        <View pointerEvents="none" className="absolute inset-0 items-center justify-center">
          <View className="h-11 flex-row items-center justify-center gap-2 rounded-full pl-3.5 pr-5">
            <Glass effect="regular" className="absolute inset-0 rounded-full" />
            <LumioMark size={18} />
            <Text accessibilityRole="header" className="text-sm font-bold tracking-tight">
              Cancel order
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerClassName="gap-4 px-6"
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: 140 }}
        keyboardShouldPersistTaps="handled"
      >
        {/* Recap — the order being cancelled and the refund coming back. */}
        <Mount>
          <Card variant="elevated" className="rounded-3xl bg-white dark:bg-[#1A1A20]">
            <Card.Content className="gap-3 p-5">
              <View className="flex-row items-center justify-between">
                <Text variant="small" className="font-semibold">
                  Order {orderId}
                </Text>
                <View className="flex-row items-center gap-2">
                  {itemThumbs.map((it, i) => (
                    <Image
                      key={`${it.name}-${i}`}
                      source={it.imageUrl ? { uri: it.imageUrl } : undefined}
                      rounded="xl"
                      aspectRatio={4 / 5}
                      className="w-9"
                      accessibilityLabel={`Photo of ${it.name}`}
                    />
                  ))}
                </View>
              </View>
              <View className="flex-row items-center gap-2">
                <Icon name="refresh" size="sm" color="success" />
                <Text variant="small" className="flex-1">
                  Refund of {fmt(total, currency)} to {refundMethod}
                </Text>
              </View>
              <Text variant="muted" className="text-xs">
                Refunds post within {refundTiming}.
              </Text>
            </Card.Content>
          </Card>
        </Mount>

        {/* Reasons — radio rows, same idiom as checkout's delivery picker. */}
        <Mount delay={BLOCK_STAGGER} className="gap-2">
          <Text
            variant="muted"
            className="px-1 text-xs font-medium uppercase tracking-wider"
            accessibilityRole="header"
          >
            Why are you cancelling?
          </Text>
          {/* Grace note — the window where cancellation is still free. */}
          <Text variant="muted" className="pb-2 text-xs">
            Free cancellation — this order hasn't shipped yet
          </Text>
          <RadioGroup
            value={reasonId}
            onValueChange={setReasonId}
            accessibilityLabel="Cancellation reason"
            className="gap-2"
          >
            {reasons.map((r) => {
              const selected = r.id === reasonId;
              return (
                <View
                  key={r.id}
                  className={cn(
                    "rounded-2xl border-2",
                    selected ? "border-[#BEF04C] bg-[#EDF8C4] dark:bg-[#1E2410]" : "border-transparent bg-white dark:bg-[#1A1A20]"
                  )}
                >
                  {/* The item is just the ring — the label is overlaid with
                      pointerEvents="none" so the whole row stays one target. */}
                  <RadioGroupItem
                    value={r.id}
                    className="w-full px-4 py-4"
                    accessibilityLabel={r.label}
                  />
                  <View
                    pointerEvents="none"
                    className="absolute inset-0 flex-row items-center pl-14 pr-4"
                  >
                    <Text variant="small">{r.label}</Text>
                  </View>
                </View>
              );
            })}
          </RadioGroup>
        </Mount>

        {/* Optional note — only relevant for "Other". */}
        {showNote ? (
          <Mount delay={BLOCK_STAGGER}>
            <Textarea
              glass
              label="Tell us more (optional)"
              placeholder="Anything we should know?"
              value={note}
              onChangeText={setNote}
              maxLength={280}
              accessibilityLabel="Cancellation note"
            />
          </Mount>
        ) : null}
      </ScrollView>

      {/* Keep vs cancel — the safe action carries the weight (solid pill),
          the destructive action quiets to a text link under it. */}
      <StickyBottomBar>
        <View className="gap-1 rounded-3xl bg-white p-4 shadow-sm dark:bg-[#1A1A20]">
        <Button
          tone="inverse"
          className="bg-[#1B1B26]"
          onPress={() => {
            haptics.light();
            onKeepOrder?.();
          }}
          accessibilityLabel="Keep this order"
        >
          Keep my order
        </Button>
        <Button
          variant="ghost"
          // haptic={false} — the Button's built-in light tap would double the
          // warning fired below; this is a confirm, not a casual tap.
          haptic={false}
          onPress={() => {
            haptics.warning();
            onConfirm?.(reasonId, note.trim());
          }}
          accessibilityLabel={`Confirm cancellation of order ${orderId}`}
          textClassName="font-medium text-destructive"
        >
          Cancel order
        </Button>
        </View>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
OrderCancelScreen.displayName = "OrderCancelScreen";
```

Screen: https://lumioui.dev/screens/ecommerce-order-cancel
iPhone 17 · iOS
9:41
Live preview — the real screen via Expo Web · open full ↗