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

Loyalty Points Screen

Points balance counting up inside a real progress-ring arc to the next tier, redeemable reward rows, and a signed earn/spend activity log

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection · success
$ npx lumioui add ecommerce-loyalty-points
import { LoyaltyPointsScreen } from "@/screens/ecommerce/loyalty-points";
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
ecommerce/loyalty-points.tsxsource · yours to edit
import * as React from "react";
import { View, ScrollView } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { AnimatedNumber, Button, Glass, Icon, ProgressRing, Separator, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";

import { LumioMark, MONO, Mount, BLOCK_STAGGER, Press } from "../shared";
export interface LoyaltyReward {
  id: string;
  /** "$10 off your next order". */
  title: string;
  /** Points cost. */
  cost: number;
  /** Terms — "Min. spend $40". */
  detail?: string;
}

export interface PointsEvent {
  id: string;
  /** "Order HL-2094" / " redeemed $10 reward". */
  label: string;
  /** Positive = earned, negative = redeemed. */
  points: number;
  date: string;
}

export interface LoyaltyPointsScreenProps {
  points?: number;
  tier?: string;
  /** Next tier + the points total it unlocks at. */
  nextTier?: string;
  nextTierAt?: number;
  rewards?: LoyaltyReward[];
  activity?: PointsEvent[];
  onRedeem?: (reward: LoyaltyReward) => void;
  onBack?: () => void;
}

const DEFAULT_REWARDS: LoyaltyReward[] = [
  { id: "r1", title: "$10 off your next order", cost: 500, detail: "Min. spend $40" },
  { id: "r2", title: "Free express shipping", cost: 750, detail: "Any order" },
  { id: "r3", title: "$25 off your next order", cost: 1100, detail: "Min. spend $100" },
];

const DEFAULT_ACTIVITY: PointsEvent[] = [
  { id: "a1", label: "Order HL-2094", points: 628, date: "Sep 15" },
  { id: "a2", label: "Review bonus — Wool Overcoat", points: 50, date: "Sep 10" },
  { id: "a3", label: "$10 reward redeemed", points: -500, date: "Aug 28" },
  { id: "a4", label: "Order HL-1982", points: 463, date: "Aug 12" },
];

/** Loyalty — the points balance inside a real progress ring (arc to the
 *  next tier), redeemable rewards, and the earn/spend activity log. */
export function LoyaltyPointsScreen({
  points = 1240,
  tier = "Silver",
  nextTier = "Gold",
  nextTierAt = 1500,
  rewards = DEFAULT_REWARDS,
  activity = DEFAULT_ACTIVITY,
  onRedeem,
  onBack,
}: LoyaltyPointsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const progress = Math.min(100, (points / Math.max(nextTierAt, 1)) * 100);
  const remaining = Math.max(0, nextTierAt - points);

  return (
    <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">
              Rewards
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerClassName="gap-5 px-6"
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 24 }}
      >
        {/* Balance hero — the ring IS the progress-to-next-tier visual. */}
        <Mount className="items-center gap-3 rounded-3xl bg-white p-5 dark:bg-[#1A1A20]">
          <ProgressRing
            value={progress}
            size={148}
            strokeWidth={10}
            color="success"
            accessibilityLabel={`${points} points, ${remaining} to ${nextTier}`}
          >
            <View className="items-center">
              <AnimatedNumber
                value={points}
                className="text-3xl font-bold tabular-nums text-foreground"
                style={{ fontFamily: MONO, fontVariant: ["tabular-nums"] }}
              />
              <Text variant="muted" className="text-xs">
                points
              </Text>
            </View>
          </ProgressRing>
          <View className="items-center gap-1.5">
            <View className="flex-row items-center gap-1.5 rounded-full bg-[#EDF8C4] px-3 py-1 dark:bg-[#1E2410]">
              <Icon name="crown" size="sm" color="#65A30D" />
              <Text className="text-xs font-semibold text-[#1E2410] dark:text-[#EDF8C4]">
                {tier} member
              </Text>
            </View>
            <Text variant="muted">
              {remaining > 0
                ? `${remaining.toLocaleString("en-US")} points to ${nextTier}`
                : `Top tier reached`}
            </Text>
            {/* Expiry — loyalty balances always answer "how long do I have". */}
            <Text variant="muted" className="text-xs">
              320 points expire Dec 31
            </Text>
          </View>
        </Mount>

        {/* Redeemable rewards — full-bleed hairline rows; the Redeem
            button is the trailing action, no card slab. */}
        <Mount delay={BLOCK_STAGGER}>
          <Text
            variant="muted"
            className="px-1 text-xs font-medium uppercase tracking-wider"
            accessibilityRole="header"
          >
            Redeem points
          </Text>
          <View className="rounded-3xl bg-white px-4 dark:bg-[#1A1A20]">
            {rewards.map((r, i) => {
              const affordable = points >= r.cost;
              return (
                <React.Fragment key={r.id}>
                  {i > 0 ? <Separator /> : null}
                  <View className="min-h-11 flex-row items-center gap-3 py-3">
                    <View className="flex-1">
                      <Text variant="small">{r.title}</Text>
                      <Text variant="muted" className="text-xs">
                        {r.cost.toLocaleString("en-US")} pts
                        {r.detail ? ` · ${r.detail}` : ""}
                      </Text>
                    </View>
                    <Button
                      tone="inverse"
                      className="bg-[#1B1B26]"
                      size="sm"
                      disabled={!affordable}
                      onPress={() => {
                        haptics.success();
                        onRedeem?.(r);
                      }}
                      accessibilityLabel={`Redeem ${r.title} for ${r.cost} points`}
                    >
                      Redeem
                    </Button>
                  </View>
                </React.Fragment>
              );
            })}
          </View>
        </Mount>

        {/* Earn/spend log — full-bleed statement rows, signed amounts. */}
        <Mount delay={BLOCK_STAGGER * 2}>
          <Text
            variant="muted"
            className="px-1 text-xs font-medium uppercase tracking-wider"
            accessibilityRole="header"
          >
            Activity
          </Text>
          <View className="rounded-3xl bg-white px-4 dark:bg-[#1A1A20]">
            {activity.map((a, i) => (
              <React.Fragment key={a.id}>
                {i > 0 ? <Separator /> : null}
                <View className="min-h-11 flex-row items-center gap-3 py-3">
                  <View className="flex-1">
                    <Text variant="small">{a.label}</Text>
                    <Text variant="muted" className="text-xs tabular-nums">
                      {a.date}
                    </Text>
                  </View>
                  <Text
                    variant="small"
                    className={cn(
                      "font-semibold tabular-nums",
                      a.points > 0 && "text-success"
                    )}
                  >
                    {a.points > 0 ? "+" : "−"}
                    {Math.abs(a.points).toLocaleString("en-US")}
                  </Text>
                </View>
              </React.Fragment>
            ))}
          </View>
        </Mount>
      </ScrollView>
    </SafeAreaView>
  );
}
LoyaltyPointsScreen.displayName = "LoyaltyPointsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Loyalty Points Screen" screen in React Native using LumioUI.

Goal: Points balance counting up inside a real progress-ring arc to the next tier, redeemable reward rows, and a signed earn/spend activity log 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-loyalty-points
```

Or pull just the components: `npx lumioui add animated-number badge button icon progress-ring separator text`

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

### `animated-number` — Number that tweens between values with reduced-motion support.
- `<AnimatedNumber>` ×1

### `badge` — Compact status pill with variants, icons and pulse option.
- imported but not rendered directly — likely used through a sibling or as a utility

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

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

### `progress-ring` — Circular progress ring with animated stroke arc, center slot and indeterminate spin.
- `<ProgressRing>` ×1

### `separator` — Hairline rule with orientation and spacing control.
- `<Separator>` ×2

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

## 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/loyalty-points.tsx` exporting LoyaltyPointsScreen. 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 { View, ScrollView } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { AnimatedNumber, Button, Glass, Icon, ProgressRing, Separator, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";

import { LumioMark, MONO, Mount, BLOCK_STAGGER, Press } from "../shared";
export interface LoyaltyReward {
  id: string;
  /** "$10 off your next order". */
  title: string;
  /** Points cost. */
  cost: number;
  /** Terms — "Min. spend $40". */
  detail?: string;
}

export interface PointsEvent {
  id: string;
  /** "Order HL-2094" / " redeemed $10 reward". */
  label: string;
  /** Positive = earned, negative = redeemed. */
  points: number;
  date: string;
}

export interface LoyaltyPointsScreenProps {
  points?: number;
  tier?: string;
  /** Next tier + the points total it unlocks at. */
  nextTier?: string;
  nextTierAt?: number;
  rewards?: LoyaltyReward[];
  activity?: PointsEvent[];
  onRedeem?: (reward: LoyaltyReward) => void;
  onBack?: () => void;
}

const DEFAULT_REWARDS: LoyaltyReward[] = [
  { id: "r1", title: "$10 off your next order", cost: 500, detail: "Min. spend $40" },
  { id: "r2", title: "Free express shipping", cost: 750, detail: "Any order" },
  { id: "r3", title: "$25 off your next order", cost: 1100, detail: "Min. spend $100" },
];

const DEFAULT_ACTIVITY: PointsEvent[] = [
  { id: "a1", label: "Order HL-2094", points: 628, date: "Sep 15" },
  { id: "a2", label: "Review bonus — Wool Overcoat", points: 50, date: "Sep 10" },
  { id: "a3", label: "$10 reward redeemed", points: -500, date: "Aug 28" },
  { id: "a4", label: "Order HL-1982", points: 463, date: "Aug 12" },
];

/** Loyalty — the points balance inside a real progress ring (arc to the
 *  next tier), redeemable rewards, and the earn/spend activity log. */
export function LoyaltyPointsScreen({
  points = 1240,
  tier = "Silver",
  nextTier = "Gold",
  nextTierAt = 1500,
  rewards = DEFAULT_REWARDS,
  activity = DEFAULT_ACTIVITY,
  onRedeem,
  onBack,
}: LoyaltyPointsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const progress = Math.min(100, (points / Math.max(nextTierAt, 1)) * 100);
  const remaining = Math.max(0, nextTierAt - points);

  return (
    <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">
              Rewards
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        className="flex-1"
        showsVerticalScrollIndicator={false}
        contentContainerClassName="gap-5 px-6"
        contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 24 }}
      >
        {/* Balance hero — the ring IS the progress-to-next-tier visual. */}
        <Mount className="items-center gap-3 rounded-3xl bg-white p-5 dark:bg-[#1A1A20]">
          <ProgressRing
            value={progress}
            size={148}
            strokeWidth={10}
            color="success"
            accessibilityLabel={`${points} points, ${remaining} to ${nextTier}`}
          >
            <View className="items-center">
              <AnimatedNumber
                value={points}
                className="text-3xl font-bold tabular-nums text-foreground"
                style={{ fontFamily: MONO, fontVariant: ["tabular-nums"] }}
              />
              <Text variant="muted" className="text-xs">
                points
              </Text>
            </View>
          </ProgressRing>
          <View className="items-center gap-1.5">
            <View className="flex-row items-center gap-1.5 rounded-full bg-[#EDF8C4] px-3 py-1 dark:bg-[#1E2410]">
              <Icon name="crown" size="sm" color="#65A30D" />
              <Text className="text-xs font-semibold text-[#1E2410] dark:text-[#EDF8C4]">
                {tier} member
              </Text>
            </View>
            <Text variant="muted">
              {remaining > 0
                ? `${remaining.toLocaleString("en-US")} points to ${nextTier}`
                : `Top tier reached`}
            </Text>
            {/* Expiry — loyalty balances always answer "how long do I have". */}
            <Text variant="muted" className="text-xs">
              320 points expire Dec 31
            </Text>
          </View>
        </Mount>

        {/* Redeemable rewards — full-bleed hairline rows; the Redeem
            button is the trailing action, no card slab. */}
        <Mount delay={BLOCK_STAGGER}>
          <Text
            variant="muted"
            className="px-1 text-xs font-medium uppercase tracking-wider"
            accessibilityRole="header"
          >
            Redeem points
          </Text>
          <View className="rounded-3xl bg-white px-4 dark:bg-[#1A1A20]">
            {rewards.map((r, i) => {
              const affordable = points >= r.cost;
              return (
                <React.Fragment key={r.id}>
                  {i > 0 ? <Separator /> : null}
                  <View className="min-h-11 flex-row items-center gap-3 py-3">
                    <View className="flex-1">
                      <Text variant="small">{r.title}</Text>
                      <Text variant="muted" className="text-xs">
                        {r.cost.toLocaleString("en-US")} pts
                        {r.detail ? ` · ${r.detail}` : ""}
                      </Text>
                    </View>
                    <Button
                      tone="inverse"
                      className="bg-[#1B1B26]"
                      size="sm"
                      disabled={!affordable}
                      onPress={() => {
                        haptics.success();
                        onRedeem?.(r);
                      }}
                      accessibilityLabel={`Redeem ${r.title} for ${r.cost} points`}
                    >
                      Redeem
                    </Button>
                  </View>
                </React.Fragment>
              );
            })}
          </View>
        </Mount>

        {/* Earn/spend log — full-bleed statement rows, signed amounts. */}
        <Mount delay={BLOCK_STAGGER * 2}>
          <Text
            variant="muted"
            className="px-1 text-xs font-medium uppercase tracking-wider"
            accessibilityRole="header"
          >
            Activity
          </Text>
          <View className="rounded-3xl bg-white px-4 dark:bg-[#1A1A20]">
            {activity.map((a, i) => (
              <React.Fragment key={a.id}>
                {i > 0 ? <Separator /> : null}
                <View className="min-h-11 flex-row items-center gap-3 py-3">
                  <View className="flex-1">
                    <Text variant="small">{a.label}</Text>
                    <Text variant="muted" className="text-xs tabular-nums">
                      {a.date}
                    </Text>
                  </View>
                  <Text
                    variant="small"
                    className={cn(
                      "font-semibold tabular-nums",
                      a.points > 0 && "text-success"
                    )}
                  >
                    {a.points > 0 ? "+" : "−"}
                    {Math.abs(a.points).toLocaleString("en-US")}
                  </Text>
                </View>
              </React.Fragment>
            ))}
          </View>
        </Mount>
      </ScrollView>
    </SafeAreaView>
  );
}
LoyaltyPointsScreen.displayName = "LoyaltyPointsScreen";
```

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