v0.1 public beta early access on GitHub
Home / Screens / travel-flight-results
Screen template

Flight Results Screen

Flight cards with times and prices

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add travel-flight-results
import { FlightResultsScreen } from "@/screens/travel/flight-results";
Registry dependencies3
Native packages installed6
@lumioui/ui@latestreact-native-safe-area-context@*@lumioui/core@latestreact-native-reanimated@*react-native-svg@*nativewind@*
travel/flight-results.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, Text } from "@lumioui/ui";
import { Mount, Press, World } from "../shared";

export interface Flight {
  id: string;
  airline: string;
  depart: string;
  arrive: string;
  duration: string;
  stops: string;
  price: string;
  /** "Direct" / "Best value" badge. */
  badge?: string;
}

export interface FlightResultsScreenProps {
  route?: string;
  date?: string;
  flights?: Flight[];
  onFlightPress?: (id: string) => void;
  onFilter?: () => void;
  onBack?: () => void;
}

const DEFAULT_FLIGHTS: Flight[] = [
  { id: "f1", airline: "TAP Air Portugal", depart: "8:15 PM", arrive: "2:40 PM +1", duration: "12h 25m", stops: "Direct", price: "$642", badge: "Best value" },
  { id: "f2", airline: "United", depart: "6:05 PM", arrive: "1:15 PM +1", duration: "13h 10m", stops: "Direct", price: "$688" },
  { id: "f3", airline: "Lufthansa", depart: "4:30 PM", arrive: "11:55 AM +1", duration: "15h 25m", stops: "1 stop · FRA", price: "$574" },
  { id: "f4", airline: "Iberia", depart: "9:40 PM", arrive: "6:05 PM +1", duration: "11h 25m", stops: "1 stop · MAD", price: "$611" },
  { id: "f5", airline: "British Airways", depart: "3:20 PM", arrive: "1:45 PM +1", duration: "13h 25m", stops: "1 stop · LHR", price: "$702" },
];

/** Flight results — route header + flight cards with times/price. */
export function FlightResultsScreen({
  route = "SFO → LIS",
  date = "Sat, Oct 3",
  flights = DEFAULT_FLIGHTS,
  onFlightPress,
  onFilter,
  onBack,
}: FlightResultsScreenProps) {
  const insets = useSafeAreaInsets();

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <View className="flex-row items-center gap-2 px-4 pb-2 pt-2">
        <Button
          variant="ghost"
          size="icon"
          haptic="light"
          onPress={() => onBack?.()}
          accessibilityLabel="Go back"
          className="-ml-2 h-10 w-10"
        >
          <Icon name="chevron-left" size="md" color="foreground" />
        </Button>
        <Mount className="flex-1">
          <Text variant="h2" accessibilityRole="header" className="tracking-tight">
            {route}
          </Text>
          <Text variant="small" className="text-muted-foreground">
            {date}
          </Text>
          {/* Result count — flight lists lead with inventory. */}
          <Text variant="small" className="text-muted-foreground/80">
            24 flights · cheapest first
          </Text>
        </Mount>
        <Button
          variant="ghost"
          size="icon"
          haptic="light"
          onPress={() => onFilter?.()}
          accessibilityLabel="Filter results"
          className="h-10 w-10"
        >
          <Icon name="settings" size="sm" color="foreground" />
        </Button>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
      >
        {flights.map((f) => (
          <Press
            key={f.id}
            haptic="light"
            onPress={() => onFlightPress?.(f.id)}
            accessibilityLabel={`${f.airline}, ${f.price}`}
            accessibilityRole="button"
            className="mx-4 mb-3 overflow-hidden rounded-3xl bg-white p-5 dark:bg-[#1A1A20]"
          >
            <View className="flex-row items-center justify-between pb-1">
              <Text className="text-sm font-medium">{f.airline}</Text>
              {f.badge && (
                <View className="rounded-full bg-success/15 px-2 py-0.5">
                  <Text className="text-xs font-medium text-success">
                    {f.badge}
                  </Text>
                </View>
              )}
            </View>
            <View className="flex-row items-center gap-3">
              <View>
                <Text className="text-lg font-semibold">{f.depart}</Text>
                <Text className="text-xs text-muted-foreground">SFO</Text>
              </View>
              {/* Route arc — line + plane, the flight-app convention. */}
              <View className="flex-1 items-center">
                <Text className="text-xs text-muted-foreground">
                  {f.duration}
                </Text>
                <View className="w-full flex-row items-center gap-1">
                  <View className="h-px flex-1 bg-border" />
                  <Icon name="plane" size="sm" color="mutedForeground" />
                  <View className="h-px flex-1 bg-border" />
                </View>
                <Text className="text-xs text-muted-foreground">{f.stops}</Text>
              </View>
              <View className="items-end">
                <Text className="text-lg font-semibold">{f.arrive}</Text>
                <Text className="text-xs text-muted-foreground">LIS</Text>
              </View>
            </View>
            <View className="flex-row items-center justify-between border-t border-border pt-2 mt-2">
              <Text className="text-xs text-muted-foreground">Economy</Text>
              <Text className="text-lg font-semibold">{f.price}</Text>
            </View>
          </Press>
        ))}
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
FlightResultsScreen.displayName = "FlightResultsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Flight Results Screen" screen in React Native using LumioUI.

Goal: Flight cards with times and prices 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 travel-flight-results
```

Or pull just the components: `npx lumioui add button icon text`

Native packages:
- @lumioui/ui@latest
- react-native-safe-area-context@*
- @lumioui/core@latest
- 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

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

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

## 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/travel/flight-results.tsx` exporting FlightResultsScreen. 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, Text } from "@lumioui/ui";
import { Mount, Press, World } from "../shared";

export interface Flight {
  id: string;
  airline: string;
  depart: string;
  arrive: string;
  duration: string;
  stops: string;
  price: string;
  /** "Direct" / "Best value" badge. */
  badge?: string;
}

export interface FlightResultsScreenProps {
  route?: string;
  date?: string;
  flights?: Flight[];
  onFlightPress?: (id: string) => void;
  onFilter?: () => void;
  onBack?: () => void;
}

const DEFAULT_FLIGHTS: Flight[] = [
  { id: "f1", airline: "TAP Air Portugal", depart: "8:15 PM", arrive: "2:40 PM +1", duration: "12h 25m", stops: "Direct", price: "$642", badge: "Best value" },
  { id: "f2", airline: "United", depart: "6:05 PM", arrive: "1:15 PM +1", duration: "13h 10m", stops: "Direct", price: "$688" },
  { id: "f3", airline: "Lufthansa", depart: "4:30 PM", arrive: "11:55 AM +1", duration: "15h 25m", stops: "1 stop · FRA", price: "$574" },
  { id: "f4", airline: "Iberia", depart: "9:40 PM", arrive: "6:05 PM +1", duration: "11h 25m", stops: "1 stop · MAD", price: "$611" },
  { id: "f5", airline: "British Airways", depart: "3:20 PM", arrive: "1:45 PM +1", duration: "13h 25m", stops: "1 stop · LHR", price: "$702" },
];

/** Flight results — route header + flight cards with times/price. */
export function FlightResultsScreen({
  route = "SFO → LIS",
  date = "Sat, Oct 3",
  flights = DEFAULT_FLIGHTS,
  onFlightPress,
  onFilter,
  onBack,
}: FlightResultsScreenProps) {
  const insets = useSafeAreaInsets();

  return (
    <World primary="#65A30D">
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      <View className="flex-row items-center gap-2 px-4 pb-2 pt-2">
        <Button
          variant="ghost"
          size="icon"
          haptic="light"
          onPress={() => onBack?.()}
          accessibilityLabel="Go back"
          className="-ml-2 h-10 w-10"
        >
          <Icon name="chevron-left" size="md" color="foreground" />
        </Button>
        <Mount className="flex-1">
          <Text variant="h2" accessibilityRole="header" className="tracking-tight">
            {route}
          </Text>
          <Text variant="small" className="text-muted-foreground">
            {date}
          </Text>
          {/* Result count — flight lists lead with inventory. */}
          <Text variant="small" className="text-muted-foreground/80">
            24 flights · cheapest first
          </Text>
        </Mount>
        <Button
          variant="ghost"
          size="icon"
          haptic="light"
          onPress={() => onFilter?.()}
          accessibilityLabel="Filter results"
          className="h-10 w-10"
        >
          <Icon name="settings" size="sm" color="foreground" />
        </Button>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
      >
        {flights.map((f) => (
          <Press
            key={f.id}
            haptic="light"
            onPress={() => onFlightPress?.(f.id)}
            accessibilityLabel={`${f.airline}, ${f.price}`}
            accessibilityRole="button"
            className="mx-4 mb-3 overflow-hidden rounded-3xl bg-white p-5 dark:bg-[#1A1A20]"
          >
            <View className="flex-row items-center justify-between pb-1">
              <Text className="text-sm font-medium">{f.airline}</Text>
              {f.badge && (
                <View className="rounded-full bg-success/15 px-2 py-0.5">
                  <Text className="text-xs font-medium text-success">
                    {f.badge}
                  </Text>
                </View>
              )}
            </View>
            <View className="flex-row items-center gap-3">
              <View>
                <Text className="text-lg font-semibold">{f.depart}</Text>
                <Text className="text-xs text-muted-foreground">SFO</Text>
              </View>
              {/* Route arc — line + plane, the flight-app convention. */}
              <View className="flex-1 items-center">
                <Text className="text-xs text-muted-foreground">
                  {f.duration}
                </Text>
                <View className="w-full flex-row items-center gap-1">
                  <View className="h-px flex-1 bg-border" />
                  <Icon name="plane" size="sm" color="mutedForeground" />
                  <View className="h-px flex-1 bg-border" />
                </View>
                <Text className="text-xs text-muted-foreground">{f.stops}</Text>
              </View>
              <View className="items-end">
                <Text className="text-lg font-semibold">{f.arrive}</Text>
                <Text className="text-xs text-muted-foreground">LIS</Text>
              </View>
            </View>
            <View className="flex-row items-center justify-between border-t border-border pt-2 mt-2">
              <Text className="text-xs text-muted-foreground">Economy</Text>
              <Text className="text-lg font-semibold">{f.price}</Text>
            </View>
          </Press>
        ))}
      </ScrollView>
    </SafeAreaView>
    </World>
  );
}
FlightResultsScreen.displayName = "FlightResultsScreen";
```

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