Physical gift-card face carrying the running balance, a redeem-a-code field, the saved-cards balance list, and a buy-a-card row
import * as React from "react";
import { useState } from "react";
import { View, ScrollView, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, Input, Separator, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { LumioMark, MONO, Mount, BLOCK_STAGGER, Press } from "../shared";
export interface GiftCard {
id: string;
/** Last four of the card number — "7821". */
last4: string;
balance: number;
/** "Added Aug 3" / "Purchased Jun 18". */
addedAt?: string;
}
export interface GiftCardsScreenProps {
cards?: GiftCard[];
currency?: string;
/** Store wordmark on the hero card face. */
brand?: string;
onRedeem?: (code: string) => void;
onBuy?: () => void;
onCardPress?: (card: GiftCard) => void;
onBack?: () => void;
}
const DEFAULT_CARDS: GiftCard[] = [
{ id: "g1", last4: "7821", balance: 75.0, addedAt: "Birthday gift · Added Aug 3" },
{ id: "g2", last4: "3094", balance: 20.0, addedAt: "Added Jun 18" },
{ id: "g3", last4: "5510", balance: 5.5, addedAt: "Added Mar 2" },
];
const fmt = (n: number, currency = "$") =>
`${currency}${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
/** Gift cards — the wallet balance as a physical gift-card face, a redeem
* field, the saved-card list, and a buy-a-card row. */
export function GiftCardsScreen({
cards = DEFAULT_CARDS,
currency = "$",
brand = "LUMIO",
onRedeem,
onBuy,
onCardPress,
onBack,
}: GiftCardsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [code, setCode] = useState("");
const hero = cards[0];
const totalBalance = cards.reduce((s, c) => s + c.balance, 0);
const redeem = () => {
const c = code.trim();
if (!c) return;
haptics.success();
onRedeem?.(c);
setCode("");
};
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">
Gift cards
</Text>
</View>
</View>
</View>
<ScrollView
className="flex-1"
showsVerticalScrollIndicator={false}
contentContainerClassName="gap-5 px-6"
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 24 }}
keyboardShouldPersistTaps="handled"
>
{/* Gift-card face — brand face, running balance, masked number.
No gradient dep: translucent discs stand in for the sheen. */}
{hero ? (
<Mount>
<View
accessible
accessibilityRole="text"
accessibilityLabel={`${brand} gift card ending in ${hero.last4}, balance ${fmt(totalBalance, currency)}`}
className="aspect-[1.586] w-full overflow-hidden rounded-3xl bg-[#1B1B26] p-5"
>
<Glass interactive effect="regular" sheen={0.45} tintColor="#FFFFFF14" className="absolute inset-0 rounded-3xl" pointerEvents="none" />
<View className="absolute -right-10 -top-16 h-48 w-48 rounded-full bg-white/10" accessible={false} />
<View className="absolute -bottom-20 -left-12 h-44 w-44 rounded-full bg-white/[0.07]" accessible={false} />
<View className="flex-1 justify-between">
<View className="flex-row items-start justify-between">
<View className="gap-1">
<View className="flex-row items-center gap-1.5">
<LumioMark size={18} />
<Text className="text-base font-bold tracking-widest text-white">
{brand}
</Text>
</View>
<Text className="text-xs text-white/60">
Gift card
</Text>
</View>
<Text className="text-xs tabular-nums text-white/60">
•••• {hero.last4}
</Text>
</View>
<View>
<Text className="text-[10px] uppercase tracking-wider text-white/50">
Total balance
</Text>
<Text className="text-3xl font-bold tabular-nums text-white" style={{ fontFamily: MONO, fontVariant: ["tabular-nums"] }}>
{fmt(totalBalance, currency)}
</Text>
</View>
</View>
</View>
</Mount>
) : null}
{/* Redeem — a typed code swaps the field for a success line. */}
<Mount delay={BLOCK_STAGGER}>
<View className="flex-row gap-2">
<View className="flex-1">
<Input
glass
placeholder="Enter gift card code"
value={code}
onChangeText={setCode}
autoCapitalize="characters"
accessibilityLabel="Gift card code"
/>
</View>
<Button
tone="inverse"
className="bg-[#1B1B26]"
disabled={code.trim().length === 0}
onPress={redeem}
accessibilityLabel="Redeem gift card code"
>
Redeem
</Button>
</View>
{/* Balance check — the other thing people do with a code. */}
<View className="pt-2">
<Text variant="small" className="font-medium text-[#65A30D]">
Check a card's balance without redeeming
</Text>
</View>
</Mount>
{/* Saved cards — compact balance rows under the hero. */}
{cards.length > 0 ? (
<Mount delay={BLOCK_STAGGER * 2} className="gap-2">
<Text
variant="muted"
className="px-1 text-xs font-medium uppercase tracking-wider"
accessibilityRole="header"
>
Your cards
</Text>
<View className="overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
{cards.map((card, i) => (
<React.Fragment key={card.id}>
{i > 0 ? <Separator className="mx-4" /> : null}
<Pressable
onPress={
onCardPress
? () => {
haptics.light();
onCardPress(card);
}
: undefined
}
accessibilityRole={onCardPress ? "button" : "text"}
accessibilityLabel={`Gift card ending in ${card.last4}, balance ${fmt(card.balance, currency)}`}
className="min-h-11 flex-row items-center gap-3 px-4 py-3"
>
<View
className="h-8 w-12 items-center justify-center rounded-md bg-[#1B1B26]"
accessibilityElementsHidden
importantForAccessibility="no"
>
<Text className="text-[8px] font-bold tracking-widest text-white">
{brand}
</Text>
</View>
<View className="flex-1">
<Text variant="small" className="tabular-nums">
•••• {card.last4}
</Text>
{card.addedAt ? (
<Text variant="muted" className="text-xs">
{card.addedAt}
</Text>
) : null}
</View>
<Text variant="small" className="font-semibold tabular-nums">
{fmt(card.balance, currency)}
</Text>
</Pressable>
</React.Fragment>
))}
</View>
</Mount>
) : null}
{/* Buy a card — the other half of every gift-card screen. */}
{onBuy ? (
<Mount delay={BLOCK_STAGGER * 3}>
<Pressable
onPress={() => {
haptics.light();
onBuy();
}}
accessibilityRole="button"
accessibilityLabel="Buy a gift card"
className={cn(
"min-h-14 flex-row items-center justify-between overflow-hidden rounded-3xl",
"bg-white px-4 dark:bg-[#1A1A20]"
)}
>
<View>
<Text variant="small" className="font-semibold">
Buy a gift card
</Text>
<Text variant="muted" className="text-xs">
Send to a friend — delivered by email
</Text>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</Pressable>
</Mount>
) : null}
</ScrollView>
</SafeAreaView>
);
}
GiftCardsScreen.displayName = "GiftCardsScreen";
Recreate the "Gift Cards Screen" screen in React Native using LumioUI.
Goal: Physical gift-card face carrying the running balance, a redeem-a-code field, the saved-cards balance list, and a buy-a-card row 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-gift-cards
```
Or pull just the components: `npx lumioui add button icon input 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
### `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
### `input` — Labeled field with focus ring, error shake and success check.
- `<Input>` ×1
### `separator` — Hairline rule with orientation and spacing control.
- `<Separator>` ×1
### `text` — Themed type scale from caption to display.
- `<Text>` ×14
## 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/gift-cards.tsx` exporting GiftCardsScreen. 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, Pressable } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, Input, Separator, Text } from "@lumioui/ui";
import { cn, useHaptic } from "@lumioui/core";
import { LumioMark, MONO, Mount, BLOCK_STAGGER, Press } from "../shared";
export interface GiftCard {
id: string;
/** Last four of the card number — "7821". */
last4: string;
balance: number;
/** "Added Aug 3" / "Purchased Jun 18". */
addedAt?: string;
}
export interface GiftCardsScreenProps {
cards?: GiftCard[];
currency?: string;
/** Store wordmark on the hero card face. */
brand?: string;
onRedeem?: (code: string) => void;
onBuy?: () => void;
onCardPress?: (card: GiftCard) => void;
onBack?: () => void;
}
const DEFAULT_CARDS: GiftCard[] = [
{ id: "g1", last4: "7821", balance: 75.0, addedAt: "Birthday gift · Added Aug 3" },
{ id: "g2", last4: "3094", balance: 20.0, addedAt: "Added Jun 18" },
{ id: "g3", last4: "5510", balance: 5.5, addedAt: "Added Mar 2" },
];
const fmt = (n: number, currency = "$") =>
`${currency}${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
/** Gift cards — the wallet balance as a physical gift-card face, a redeem
* field, the saved-card list, and a buy-a-card row. */
export function GiftCardsScreen({
cards = DEFAULT_CARDS,
currency = "$",
brand = "LUMIO",
onRedeem,
onBuy,
onCardPress,
onBack,
}: GiftCardsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [code, setCode] = useState("");
const hero = cards[0];
const totalBalance = cards.reduce((s, c) => s + c.balance, 0);
const redeem = () => {
const c = code.trim();
if (!c) return;
haptics.success();
onRedeem?.(c);
setCode("");
};
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">
Gift cards
</Text>
</View>
</View>
</View>
<ScrollView
className="flex-1"
showsVerticalScrollIndicator={false}
contentContainerClassName="gap-5 px-6"
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 24 }}
keyboardShouldPersistTaps="handled"
>
{/* Gift-card face — brand face, running balance, masked number.
No gradient dep: translucent discs stand in for the sheen. */}
{hero ? (
<Mount>
<View
accessible
accessibilityRole="text"
accessibilityLabel={`${brand} gift card ending in ${hero.last4}, balance ${fmt(totalBalance, currency)}`}
className="aspect-[1.586] w-full overflow-hidden rounded-3xl bg-[#1B1B26] p-5"
>
<Glass interactive effect="regular" sheen={0.45} tintColor="#FFFFFF14" className="absolute inset-0 rounded-3xl" pointerEvents="none" />
<View className="absolute -right-10 -top-16 h-48 w-48 rounded-full bg-white/10" accessible={false} />
<View className="absolute -bottom-20 -left-12 h-44 w-44 rounded-full bg-white/[0.07]" accessible={false} />
<View className="flex-1 justify-between">
<View className="flex-row items-start justify-between">
<View className="gap-1">
<View className="flex-row items-center gap-1.5">
<LumioMark size={18} />
<Text className="text-base font-bold tracking-widest text-white">
{brand}
</Text>
</View>
<Text className="text-xs text-white/60">
Gift card
</Text>
</View>
<Text className="text-xs tabular-nums text-white/60">
•••• {hero.last4}
</Text>
</View>
<View>
<Text className="text-[10px] uppercase tracking-wider text-white/50">
Total balance
</Text>
<Text className="text-3xl font-bold tabular-nums text-white" style={{ fontFamily: MONO, fontVariant: ["tabular-nums"] }}>
{fmt(totalBalance, currency)}
</Text>
</View>
</View>
</View>
</Mount>
) : null}
{/* Redeem — a typed code swaps the field for a success line. */}
<Mount delay={BLOCK_STAGGER}>
<View className="flex-row gap-2">
<View className="flex-1">
<Input
glass
placeholder="Enter gift card code"
value={code}
onChangeText={setCode}
autoCapitalize="characters"
accessibilityLabel="Gift card code"
/>
</View>
<Button
tone="inverse"
className="bg-[#1B1B26]"
disabled={code.trim().length === 0}
onPress={redeem}
accessibilityLabel="Redeem gift card code"
>
Redeem
</Button>
</View>
{/* Balance check — the other thing people do with a code. */}
<View className="pt-2">
<Text variant="small" className="font-medium text-[#65A30D]">
Check a card's balance without redeeming
</Text>
</View>
</Mount>
{/* Saved cards — compact balance rows under the hero. */}
{cards.length > 0 ? (
<Mount delay={BLOCK_STAGGER * 2} className="gap-2">
<Text
variant="muted"
className="px-1 text-xs font-medium uppercase tracking-wider"
accessibilityRole="header"
>
Your cards
</Text>
<View className="overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
{cards.map((card, i) => (
<React.Fragment key={card.id}>
{i > 0 ? <Separator className="mx-4" /> : null}
<Pressable
onPress={
onCardPress
? () => {
haptics.light();
onCardPress(card);
}
: undefined
}
accessibilityRole={onCardPress ? "button" : "text"}
accessibilityLabel={`Gift card ending in ${card.last4}, balance ${fmt(card.balance, currency)}`}
className="min-h-11 flex-row items-center gap-3 px-4 py-3"
>
<View
className="h-8 w-12 items-center justify-center rounded-md bg-[#1B1B26]"
accessibilityElementsHidden
importantForAccessibility="no"
>
<Text className="text-[8px] font-bold tracking-widest text-white">
{brand}
</Text>
</View>
<View className="flex-1">
<Text variant="small" className="tabular-nums">
•••• {card.last4}
</Text>
{card.addedAt ? (
<Text variant="muted" className="text-xs">
{card.addedAt}
</Text>
) : null}
</View>
<Text variant="small" className="font-semibold tabular-nums">
{fmt(card.balance, currency)}
</Text>
</Pressable>
</React.Fragment>
))}
</View>
</Mount>
) : null}
{/* Buy a card — the other half of every gift-card screen. */}
{onBuy ? (
<Mount delay={BLOCK_STAGGER * 3}>
<Pressable
onPress={() => {
haptics.light();
onBuy();
}}
accessibilityRole="button"
accessibilityLabel="Buy a gift card"
className={cn(
"min-h-14 flex-row items-center justify-between overflow-hidden rounded-3xl",
"bg-white px-4 dark:bg-[#1A1A20]"
)}
>
<View>
<Text variant="small" className="font-semibold">
Buy a gift card
</Text>
<Text variant="muted" className="text-xs">
Send to a friend — delivered by email
</Text>
</View>
<Icon name="chevron-right" size="sm" color="mutedForeground" />
</Pressable>
</Mount>
) : null}
</ScrollView>
</SafeAreaView>
);
}
GiftCardsScreen.displayName = "GiftCardsScreen";
```
Screen: https://lumioui.dev/screens/ecommerce-gift-cards