v0.1 public beta early access on GitHub
Home / Screens / finance-exchange-currency
Screen template

Exchange Currency Screen

Currency swap with rate and fees

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add finance-exchange-currency
import { ExchangeCurrencyScreen } from "@/screens/finance/exchange-currency";
Registry dependencies4
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
finance/exchange-currency.tsxsource · yours to edit
import * as React from "react";
import { ScrollView, View } from "react-native";
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
import { Button, Glass, Icon, Input, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { LumioMark, MONO, Mount, Press, StickyBottomBar } from "../shared";

export interface Currency {
  code: string;
  symbol: string;
  /** Flag-ish single-letter disc label. */
  flag: string;
}

export interface ExchangeCurrencyScreenProps {
  from?: Currency;
  to?: Currency;
  /** Rate shown on the mid row: "1 USD = 0.92 EUR". */
  rate?: string;
  sendAmount?: string;
  receiveAmount?: string;
  onSwap?: () => void;
  onConvert?: () => void;
  onBack?: () => void;
}

/** Exchange — you-send / they-receive pair with a swap control and rate. */
export function ExchangeCurrencyScreen({
  from = { code: "USD", symbol: "$", flag: "🇺🇸" },
  to = { code: "EUR", symbol: "€", flag: "🇪🇺" },
  rate = "1 USD = 0.92 EUR",
  sendAmount = "1,200.00",
  receiveAmount = "1,104.00",
  onSwap,
  onConvert,
  onBack,
}: ExchangeCurrencyScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [amount, setAmount] = React.useState(sendAmount);

  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">
              Exchange
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{
          paddingBottom: insets.bottom + 96,
          paddingTop: insets.top + 60,
        }}
      >
        {/* Send / receive stacked cards with the swap between them — the
            Wise idiom: two amount surfaces, one circular swap button. */}
        <Mount className="mx-4 gap-0">
          <View className="rounded-2xl bg-white p-4 dark:bg-[#1A1A20]">
            <Text variant="small" className="text-muted-foreground">
              You send
            </Text>
            <View className="mt-1 flex-row items-center justify-between">
              <Input
                value={amount}
                onChangeText={setAmount}
                placeholder="0.00"
                keyboardType="decimal-pad"
                accessibilityLabel={`Amount in ${from.code}`}
                containerClassName="flex-1"
                className="border-0 bg-transparent px-0 text-3xl font-semibold"
                style={{ fontFamily: MONO, fontVariant: ["tabular-nums"] }}
              />
              <Button
                variant="ghost"
                haptic="light"
                onPress={() => haptics.light()}
                accessibilityLabel={`Currency ${from.code}`}
                className="flex-row items-center gap-2 rounded-full bg-[#F4F5F9] px-3 py-1.5"
              >
                <Text className="text-base">{from.flag}</Text>
                <Text className="text-sm font-semibold">{from.code}</Text>
                <Icon name="chevron-down" size="sm" color="mutedForeground" />
              </Button>
            </View>
            <Text variant="muted" className="mt-1 text-xs">
              Balance $4,280.50
            </Text>
          </View>

          {/* Swap — the circular connector between the two surfaces. */}
          <View className="z-10 -my-4 items-center">
            <Button
              size="icon"
              haptic="medium"
              onPress={() => {
                haptics.medium();
                onSwap?.();
              }}
              accessibilityLabel={`Swap ${from.code} and ${to.code}`}
              className="h-11 w-11 rounded-full border-4 border-[#F4F5F9] bg-[#1B1B26] p-0"
            >
              <Icon name="refresh" size="sm" color="#BEF04C" />
            </Button>
          </View>

          <View className="rounded-2xl bg-white p-4 pt-6 dark:bg-[#1A1A20]">
            <Text variant="small" className="text-muted-foreground">
              They receive
            </Text>
            <View className="mt-1 flex-row items-center justify-between">
              <Text className="text-3xl font-semibold">
                {to.symbol}
                {receiveAmount}
              </Text>
              <Button
                variant="ghost"
                haptic="light"
                onPress={() => haptics.light()}
                accessibilityLabel={`Currency ${to.code}`}
                className="flex-row items-center gap-2 rounded-full bg-[#F4F5F9] px-3 py-1.5"
              >
                <Text className="text-base">{to.flag}</Text>
                <Text className="text-sm font-semibold">{to.code}</Text>
                <Icon name="chevron-down" size="sm" color="mutedForeground" />
              </Button>
            </View>
          </View>
        </Mount>

        {/* Rate + fees — the receipt line under the pair. */}
        <Mount delay={60} className="mx-4 mt-3 gap-2 rounded-2xl bg-white p-4 dark:bg-[#1A1A20]">
          <View className="flex-row items-center justify-between">
            <Text variant="small" className="text-muted-foreground">
              Rate
            </Text>
            <Text className="text-sm font-medium">{rate}</Text>
          </View>
          <View className="flex-row items-center justify-between">
            <Text variant="small" className="text-muted-foreground">
              Fee
            </Text>
            <Text className="text-sm font-medium text-success">Free</Text>
          </View>
          <View className="flex-row items-center justify-between">
            <Text variant="small" className="text-muted-foreground">
              Arrives
            </Text>
            <Text className="text-sm font-medium">In seconds</Text>
          </View>
        </Mount>
        <Text variant="muted" className="mt-3 px-4 text-center text-xs">
          Rate refreshes every 30 seconds
        </Text>
        {/* Mid-market claim — the reason the rate deserves trust. */}
        <View className="mx-4 mt-2 flex-row items-center justify-center gap-1.5">
          <Icon name="check-circle" size="sm" color="success" />
          <Text variant="muted" className="text-xs">
            Mid-market rate — no markup
          </Text>
        </View>
      </ScrollView>

      <StickyBottomBar>
        <Button
          tone="inverse"
          haptic="light"
          onPress={() => {
            haptics.medium();
            onConvert?.();
          }}
          accessibilityLabel={`Convert ${from.code} to ${to.code}`}
          className="w-full bg-[#1B1B26]"
        >
          Convert
        </Button>
      </StickyBottomBar>
    </SafeAreaView>
  );
}
ExchangeCurrencyScreen.displayName = "ExchangeCurrencyScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Exchange Currency Screen" screen in React Native using LumioUI.

Goal: Currency swap with rate and fees 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-exchange-currency
```

Or pull just the components: `npx lumioui add button icon input 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>` ×4

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

### `input` — Labeled field with focus ring, error shake and success check.
- `<Input>` ×1

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

## 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/exchange-currency.tsx` exporting ExchangeCurrencyScreen. 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, Input, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { LumioMark, MONO, Mount, Press, StickyBottomBar } from "../shared";

export interface Currency {
  code: string;
  symbol: string;
  /** Flag-ish single-letter disc label. */
  flag: string;
}

export interface ExchangeCurrencyScreenProps {
  from?: Currency;
  to?: Currency;
  /** Rate shown on the mid row: "1 USD = 0.92 EUR". */
  rate?: string;
  sendAmount?: string;
  receiveAmount?: string;
  onSwap?: () => void;
  onConvert?: () => void;
  onBack?: () => void;
}

/** Exchange — you-send / they-receive pair with a swap control and rate. */
export function ExchangeCurrencyScreen({
  from = { code: "USD", symbol: "$", flag: "🇺🇸" },
  to = { code: "EUR", symbol: "€", flag: "🇪🇺" },
  rate = "1 USD = 0.92 EUR",
  sendAmount = "1,200.00",
  receiveAmount = "1,104.00",
  onSwap,
  onConvert,
  onBack,
}: ExchangeCurrencyScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [amount, setAmount] = React.useState(sendAmount);

  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">
              Exchange
            </Text>
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{
          paddingBottom: insets.bottom + 96,
          paddingTop: insets.top + 60,
        }}
      >
        {/* Send / receive stacked cards with the swap between them — the
            Wise idiom: two amount surfaces, one circular swap button. */}
        <Mount className="mx-4 gap-0">
          <View className="rounded-2xl bg-white p-4 dark:bg-[#1A1A20]">
            <Text variant="small" className="text-muted-foreground">
              You send
            </Text>
            <View className="mt-1 flex-row items-center justify-between">
              <Input
                value={amount}
                onChangeText={setAmount}
                placeholder="0.00"
                keyboardType="decimal-pad"
                accessibilityLabel={`Amount in ${from.code}`}
                containerClassName="flex-1"
                className="border-0 bg-transparent px-0 text-3xl font-semibold"
                style={{ fontFamily: MONO, fontVariant: ["tabular-nums"] }}
              />
              <Button
                variant="ghost"
                haptic="light"
                onPress={() => haptics.light()}
                accessibilityLabel={`Currency ${from.code}`}
                className="flex-row items-center gap-2 rounded-full bg-[#F4F5F9] px-3 py-1.5"
              >
                <Text className="text-base">{from.flag}</Text>
                <Text className="text-sm font-semibold">{from.code}</Text>
                <Icon name="chevron-down" size="sm" color="mutedForeground" />
              </Button>
            </View>
            <Text variant="muted" className="mt-1 text-xs">
              Balance $4,280.50
            </Text>
          </View>

          {/* Swap — the circular connector between the two surfaces. */}
          <View className="z-10 -my-4 items-center">
            <Button
              size="icon"
              haptic="medium"
              onPress={() => {
                haptics.medium();
                onSwap?.();
              }}
              accessibilityLabel={`Swap ${from.code} and ${to.code}`}
              className="h-11 w-11 rounded-full border-4 border-[#F4F5F9] bg-[#1B1B26] p-0"
            >
              <Icon name="refresh" size="sm" color="#BEF04C" />
            </Button>
          </View>

          <View className="rounded-2xl bg-white p-4 pt-6 dark:bg-[#1A1A20]">
            <Text variant="small" className="text-muted-foreground">
              They receive
            </Text>
            <View className="mt-1 flex-row items-center justify-between">
              <Text className="text-3xl font-semibold">
                {to.symbol}
                {receiveAmount}
              </Text>
              <Button
                variant="ghost"
                haptic="light"
                onPress={() => haptics.light()}
                accessibilityLabel={`Currency ${to.code}`}
                className="flex-row items-center gap-2 rounded-full bg-[#F4F5F9] px-3 py-1.5"
              >
                <Text className="text-base">{to.flag}</Text>
                <Text className="text-sm font-semibold">{to.code}</Text>
                <Icon name="chevron-down" size="sm" color="mutedForeground" />
              </Button>
            </View>
          </View>
        </Mount>

        {/* Rate + fees — the receipt line under the pair. */}
        <Mount delay={60} className="mx-4 mt-3 gap-2 rounded-2xl bg-white p-4 dark:bg-[#1A1A20]">
          <View className="flex-row items-center justify-between">
            <Text variant="small" className="text-muted-foreground">
              Rate
            </Text>
            <Text className="text-sm font-medium">{rate}</Text>
          </View>
          <View className="flex-row items-center justify-between">
            <Text variant="small" className="text-muted-foreground">
              Fee
            </Text>
            <Text className="text-sm font-medium text-success">Free</Text>
          </View>
          <View className="flex-row items-center justify-between">
            <Text variant="small" className="text-muted-foreground">
              Arrives
            </Text>
            <Text className="text-sm font-medium">In seconds</Text>
          </View>
        </Mount>
        <Text variant="muted" className="mt-3 px-4 text-center text-xs">
          Rate refreshes every 30 seconds
        </Text>
        {/* Mid-market claim — the reason the rate deserves trust. */}
        <View className="mx-4 mt-2 flex-row items-center justify-center gap-1.5">
          <Icon name="check-circle" size="sm" color="success" />
          <Text variant="muted" className="text-xs">
            Mid-market rate — no markup
          </Text>
        </View>
      </ScrollView>

      <StickyBottomBar>
        <Button
          tone="inverse"
          haptic="light"
          onPress={() => {
            haptics.medium();
            onConvert?.();
          }}
          accessibilityLabel={`Convert ${from.code} to ${to.code}`}
          className="w-full bg-[#1B1B26]"
        >
          Convert
        </Button>
      </StickyBottomBar>
    </SafeAreaView>
  );
}
ExchangeCurrencyScreen.displayName = "ExchangeCurrencyScreen";
```

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