Card visuals with freeze and settings
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, List, Switch, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, CardBrandMark, LumioMark, Mount, Press, RowIcon, SEPARATOR_INSET } from "../shared";
export interface ManagedCard {
id: string;
label: string;
/** "4821" */
last4: string;
network: string;
/** Printed cardholder name — "AMARA CHEN". */
holder: string;
/** "09/28" */
expires: string;
/** Dark hero card vs light — the visual is the card itself. */
dark?: boolean;
frozen?: boolean;
}
export interface ManageCardsScreenProps {
cards?: ManagedCard[];
onFreeze?: (id: string, frozen: boolean) => void;
onCardPress?: (id: string) => void;
onAddCard?: () => void;
onBack?: () => void;
}
const DEFAULT_CARDS: ManagedCard[] = [
{
id: "k1",
label: "Everyday",
last4: "4821",
network: "Visa",
holder: "AMARA CHEN",
expires: "09/28",
dark: true,
},
{
id: "k2",
label: "Travel",
last4: "0937",
network: "Mastercard",
holder: "AMARA CHEN",
expires: "03/29",
},
];
/** Manage cards — card visuals with per-card freeze + settings rows. */
export function ManageCardsScreen({
cards = DEFAULT_CARDS,
onFreeze,
onCardPress,
onAddCard,
onBack,
}: ManageCardsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [frozen, setFrozen] = React.useState<Record<string, boolean>>(() =>
Object.fromEntries(cards.map((c) => [c.id, !!c.frozen]))
);
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<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">
Cards · {cards.length}
</Text>
</View>
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Fleet health — how many are usable right now. */}
<Text variant="muted" className="px-6 pb-2 text-xs">
{Object.values(frozen).filter((f) => !f).length} active
</Text>
{cards.map((c, i) => {
const isFrozen = !!frozen[c.id];
const dark = !!c.dark;
// On-card ink — background is foreground's inverse pair, so both
// card paints stay legible in both schemes (no raw text-white).
const fg = dark ? "text-white" : "text-[#1B1B26]";
const fgDim = dark ? "text-white/60" : "text-[#1B1B26]/60";
const tint = dark ? "bg-white" : "bg-[#1B1B26]";
const chip = "bg-amber-200/90";
const iconColor = dark ? "#FFF" : "#1B1B26";
return (
<Mount
key={c.id}
delay={BLOCK_STAGGER * (i + 1)}
className="mx-4 mb-4"
>
{/* Card face — credit-card aspect, masked PAN, tonal sheen
discs clipped by overflow-hidden (no gradient dep). */}
<Press
haptic="light"
onPress={() => onCardPress?.(c.id)}
accessibilityLabel={`${c.label} ${c.network} card ending ${c.last4}${isFrozen ? ", frozen" : ""}`}
accessibilityRole="button"
className={`aspect-[1.586] w-full overflow-hidden rounded-2xl p-5 ${
dark ? "bg-[#1B1B26]" : "border border-border bg-white"
} ${isFrozen ? "opacity-60" : ""}`}
>
<View
className={`absolute -right-10 -top-16 h-48 w-48 rounded-full ${tint}/10`}
accessible={false}
/>
<View
className={`absolute -bottom-20 -left-12 h-44 w-44 rounded-full ${tint}/[0.07]`}
accessible={false}
/>
<View className="flex-1 justify-between">
<View className="flex-row items-center justify-between">
{/* Chip + rotated wifi — the near-field mark every
card render uses. */}
<View className="flex-row items-center gap-2">
<View className={`h-7 w-10 rounded-md ${chip}`} />
<View className="rotate-90">
<Icon name="wifi" size="sm" color={iconColor} />
</View>
</View>
<View className="flex-row items-center gap-2">
{isFrozen ? (
<View
className={`flex-row items-center gap-1 rounded-full ${tint}/15 px-2.5 py-1`}
>
<Icon name="lock" size="sm" color={iconColor} />
<Text
className={`text-xs font-semibold ${fg}`}
>
Frozen
</Text>
</View>
) : null}
<Text className={`text-sm font-medium ${fgDim}`}>
{c.label}
</Text>
</View>
</View>
<Text
className={`font-mono text-xl font-semibold tracking-[0.18em] ${fg}`}
accessibilityElementsHidden
>
•••• •••• •••• {c.last4}
</Text>
<View className="flex-row items-end justify-between">
<View>
<Text
className={`text-[10px] uppercase tracking-wider ${fgDim}`}
>
Card holder
</Text>
<Text
className={`text-sm font-semibold uppercase tracking-wide ${fg}`}
>
{c.holder}
</Text>
</View>
<View className="items-end">
<Text
className={`text-[10px] uppercase tracking-wider ${fgDim}`}
>
Expires
</Text>
<Text
className={`text-sm font-semibold tabular-nums ${fg}`}
>
{c.expires}
</Text>
</View>
<CardBrandMark
network={c.network}
size={26}
ink={c.dark ? "#FFF" : "#1A1F71"}
/>
</View>
</View>
</Press>
{/* Controls under the card. */}
<View className="mt-3 rounded-2xl bg-white dark:bg-[#1A1A20]">
<View className="flex-row items-center gap-3 px-4 py-3">
<View className="h-8 w-8 items-center justify-center rounded-2xl bg-chart-2/15">
<Icon name="lock" size="sm" color="chart2" />
</View>
<Text className="flex-1 text-sm">Freeze card</Text>
<Switch
checked={isFrozen}
onCheckedChange={(v) => {
haptics.selection();
setFrozen((p) => ({ ...p, [c.id]: v }));
onFreeze?.(c.id, v);
}}
accessibilityLabel={`Freeze ${c.label} card`}
/>
</View>
</View>
</Mount>
);
})}
{/* Card actions. */}
<Mount delay={BLOCK_STAGGER * (cards.length + 1)}>
<List inset>
<List.Section>
<List.Item
title="Set spending limit"
leading={<RowIcon name="shield" tone="blue" />}
showChevron
haptic="light"
onPress={() => haptics.light()}
/>
<List.Separator className={SEPARATOR_INSET} />
<List.Item
title="PIN & security"
leading={<RowIcon name="fingerprint" tone="purple" />}
showChevron
haptic="light"
onPress={() => haptics.light()}
/>
<List.Separator className={SEPARATOR_INSET} />
<List.Item
title="Add card"
leading={<RowIcon name="plus" tone="green" />}
showChevron
haptic="light"
onPress={() => onAddCard?.()}
/>
</List.Section>
</List>
</Mount>
</ScrollView>
</SafeAreaView>
);
}
ManageCardsScreen.displayName = "ManageCardsScreen";
Recreate the "Manage Cards Screen" screen in React Native using LumioUI.
Goal: Card visuals with freeze and settings 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 finance-manage-cards
```
Or pull just the components: `npx lumioui add button icon list switch 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.
- imported but not rendered directly — likely used through a sibling or as a utility
### `icon` — Lucide icon set mapped to theme colors and sizes.
- `<Icon>` ×4
### `list` — Settings-style rows with separators and press feedback.
- `<List>` ×1
### `switch` — iOS-size toggle with spring thumb and haptics.
- `<Switch>` ×1
### `text` — Themed type scale from caption to display.
- `<Text>` ×10
## 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/finance/manage-cards.tsx` exporting ManageCardsScreen. 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 { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, List, Switch, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, CardBrandMark, LumioMark, Mount, Press, RowIcon, SEPARATOR_INSET } from "../shared";
export interface ManagedCard {
id: string;
label: string;
/** "4821" */
last4: string;
network: string;
/** Printed cardholder name — "AMARA CHEN". */
holder: string;
/** "09/28" */
expires: string;
/** Dark hero card vs light — the visual is the card itself. */
dark?: boolean;
frozen?: boolean;
}
export interface ManageCardsScreenProps {
cards?: ManagedCard[];
onFreeze?: (id: string, frozen: boolean) => void;
onCardPress?: (id: string) => void;
onAddCard?: () => void;
onBack?: () => void;
}
const DEFAULT_CARDS: ManagedCard[] = [
{
id: "k1",
label: "Everyday",
last4: "4821",
network: "Visa",
holder: "AMARA CHEN",
expires: "09/28",
dark: true,
},
{
id: "k2",
label: "Travel",
last4: "0937",
network: "Mastercard",
holder: "AMARA CHEN",
expires: "03/29",
},
];
/** Manage cards — card visuals with per-card freeze + settings rows. */
export function ManageCardsScreen({
cards = DEFAULT_CARDS,
onFreeze,
onCardPress,
onAddCard,
onBack,
}: ManageCardsScreenProps) {
const haptics = useHaptic();
const insets = useSafeAreaInsets();
const [frozen, setFrozen] = React.useState<Record<string, boolean>>(() =>
Object.fromEntries(cards.map((c) => [c.id, !!c.frozen]))
);
return (
<SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
<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">
Cards · {cards.length}
</Text>
</View>
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{ paddingTop: insets.top + 60, paddingBottom: insets.bottom + 32 }}
>
{/* Fleet health — how many are usable right now. */}
<Text variant="muted" className="px-6 pb-2 text-xs">
{Object.values(frozen).filter((f) => !f).length} active
</Text>
{cards.map((c, i) => {
const isFrozen = !!frozen[c.id];
const dark = !!c.dark;
// On-card ink — background is foreground's inverse pair, so both
// card paints stay legible in both schemes (no raw text-white).
const fg = dark ? "text-white" : "text-[#1B1B26]";
const fgDim = dark ? "text-white/60" : "text-[#1B1B26]/60";
const tint = dark ? "bg-white" : "bg-[#1B1B26]";
const chip = "bg-amber-200/90";
const iconColor = dark ? "#FFF" : "#1B1B26";
return (
<Mount
key={c.id}
delay={BLOCK_STAGGER * (i + 1)}
className="mx-4 mb-4"
>
{/* Card face — credit-card aspect, masked PAN, tonal sheen
discs clipped by overflow-hidden (no gradient dep). */}
<Press
haptic="light"
onPress={() => onCardPress?.(c.id)}
accessibilityLabel={`${c.label} ${c.network} card ending ${c.last4}${isFrozen ? ", frozen" : ""}`}
accessibilityRole="button"
className={`aspect-[1.586] w-full overflow-hidden rounded-2xl p-5 ${
dark ? "bg-[#1B1B26]" : "border border-border bg-white"
} ${isFrozen ? "opacity-60" : ""}`}
>
<View
className={`absolute -right-10 -top-16 h-48 w-48 rounded-full ${tint}/10`}
accessible={false}
/>
<View
className={`absolute -bottom-20 -left-12 h-44 w-44 rounded-full ${tint}/[0.07]`}
accessible={false}
/>
<View className="flex-1 justify-between">
<View className="flex-row items-center justify-between">
{/* Chip + rotated wifi — the near-field mark every
card render uses. */}
<View className="flex-row items-center gap-2">
<View className={`h-7 w-10 rounded-md ${chip}`} />
<View className="rotate-90">
<Icon name="wifi" size="sm" color={iconColor} />
</View>
</View>
<View className="flex-row items-center gap-2">
{isFrozen ? (
<View
className={`flex-row items-center gap-1 rounded-full ${tint}/15 px-2.5 py-1`}
>
<Icon name="lock" size="sm" color={iconColor} />
<Text
className={`text-xs font-semibold ${fg}`}
>
Frozen
</Text>
</View>
) : null}
<Text className={`text-sm font-medium ${fgDim}`}>
{c.label}
</Text>
</View>
</View>
<Text
className={`font-mono text-xl font-semibold tracking-[0.18em] ${fg}`}
accessibilityElementsHidden
>
•••• •••• •••• {c.last4}
</Text>
<View className="flex-row items-end justify-between">
<View>
<Text
className={`text-[10px] uppercase tracking-wider ${fgDim}`}
>
Card holder
</Text>
<Text
className={`text-sm font-semibold uppercase tracking-wide ${fg}`}
>
{c.holder}
</Text>
</View>
<View className="items-end">
<Text
className={`text-[10px] uppercase tracking-wider ${fgDim}`}
>
Expires
</Text>
<Text
className={`text-sm font-semibold tabular-nums ${fg}`}
>
{c.expires}
</Text>
</View>
<CardBrandMark
network={c.network}
size={26}
ink={c.dark ? "#FFF" : "#1A1F71"}
/>
</View>
</View>
</Press>
{/* Controls under the card. */}
<View className="mt-3 rounded-2xl bg-white dark:bg-[#1A1A20]">
<View className="flex-row items-center gap-3 px-4 py-3">
<View className="h-8 w-8 items-center justify-center rounded-2xl bg-chart-2/15">
<Icon name="lock" size="sm" color="chart2" />
</View>
<Text className="flex-1 text-sm">Freeze card</Text>
<Switch
checked={isFrozen}
onCheckedChange={(v) => {
haptics.selection();
setFrozen((p) => ({ ...p, [c.id]: v }));
onFreeze?.(c.id, v);
}}
accessibilityLabel={`Freeze ${c.label} card`}
/>
</View>
</View>
</Mount>
);
})}
{/* Card actions. */}
<Mount delay={BLOCK_STAGGER * (cards.length + 1)}>
<List inset>
<List.Section>
<List.Item
title="Set spending limit"
leading={<RowIcon name="shield" tone="blue" />}
showChevron
haptic="light"
onPress={() => haptics.light()}
/>
<List.Separator className={SEPARATOR_INSET} />
<List.Item
title="PIN & security"
leading={<RowIcon name="fingerprint" tone="purple" />}
showChevron
haptic="light"
onPress={() => haptics.light()}
/>
<List.Separator className={SEPARATOR_INSET} />
<List.Item
title="Add card"
leading={<RowIcon name="plus" tone="green" />}
showChevron
haptic="light"
onPress={() => onAddCard?.()}
/>
</List.Section>
</List>
</Mount>
</ScrollView>
</SafeAreaView>
);
}
ManageCardsScreen.displayName = "ManageCardsScreen";
```
Screen: https://lumioui.dev/screens/finance-manage-cards