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

Flight Search Screen

From/to flight search with cabin

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add travel-flight-search
import { FlightSearchScreen } from "@/screens/travel/flight-search";
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
travel/flight-search.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, Chip, Icon, List, SegmentedControl, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, Mount, RowIcon, SEPARATOR_INSET, StickyBottomBar, World } from "../shared";

export interface FlightSearchScreenProps {
  from?: string;
  to?: string;
  depart?: string;
  returnDate?: string;
  travelers?: string;
  onSwap?: () => void;
  onSearch?: () => void;
  onBack?: () => void;
}

/** Flight search — from/to swap pair, dates, travelers, cabin, Search. */
export function FlightSearchScreen({
  from = "San Francisco",
  to = "Lisbon",
  depart = "Oct 3",
  returnDate = "Oct 11",
  travelers = "4 travelers",
  onSwap,
  onSearch,
  onBack,
}: FlightSearchScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [trip, setTrip] = React.useState("Round trip");
  const [cabin, setCabin] = React.useState("Economy");

  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>
        </View>

      <Mount>
        <Text variant="h2" accessibilityRole="header" className="px-6 pb-1 tracking-tight">
          Flights
        </Text>
        {/* Price-watch line — search pages hint at deals waiting. */}
        <Text variant="muted" className="px-6 pb-1 text-xs">
          Prices to Lisbon are down 12% this week
        </Text>
      </Mount>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{ paddingBottom: insets.bottom + 96 }}
      >
        {/* Trip type. */}
        <View className="px-4 pb-3">
          <SegmentedControl
            value={trip}
            onValueChange={(v) => {
              haptics.selection();
              setTrip(v);
            }}
            options={["Round trip", "One way", "Multi-city"]}
          />
        </View>

        {/* From/to — stacked surfaces with the swap between them. */}
        <View className="mx-4">
          <Button
            variant="ghost"
            haptic="light"
            onPress={() => haptics.light()}
            accessibilityLabel={`From ${from}`}
            className="w-full rounded-t-3xl rounded-b-none bg-white p-4 dark:bg-[#1A1A20]"
          >
            <View className="flex-row items-center gap-3">
              <Icon name="map-pin" size="sm" color="mutedForeground" />
              <View className="flex-1 items-start">
                <Text variant="small" className="text-muted-foreground">
                  From
                </Text>
                <Text className="text-base font-semibold">{from}</Text>
              </View>
            </View>
          </Button>
          <View className="z-10 -my-2.5 items-end pr-4">
            <Button
              size="icon"
              haptic="medium"
              onPress={() => {
                haptics.medium();
                onSwap?.();
              }}
              accessibilityLabel="Swap origin and destination"
              className="h-10 w-10 rounded-full border-2 border-background bg-[#BEF04C] p-0"
            >
              <Icon name="repeat" size="sm" color="#1B1B26" />
            </Button>
          </View>
          <Button
            variant="ghost"
            haptic="light"
            onPress={() => haptics.light()}
            accessibilityLabel={`To ${to}`}
            className="w-full rounded-b-3xl rounded-t-none bg-white p-4 pt-5 dark:bg-[#1A1A20]"
          >
            <View className="flex-row items-center gap-3">
              <Icon name="map-pin" size="sm" color="#65A30D" />
              <View className="flex-1 items-start">
                <Text variant="small" className="text-muted-foreground">
                  To
                </Text>
                <Text className="text-base font-semibold">{to}</Text>
              </View>
            </View>
          </Button>
        </View>

        {/* Dates + travelers — row list, like airline apps. */}
        <Mount delay={BLOCK_STAGGER} className="mx-4 mt-4 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
              <List.Item
                title="Depart"
                trailing={<Text className="font-medium">{depart}</Text>}
                leading={<RowIcon name="calendar" tone="blue" />}
                showChevron
                haptic="light"
                onPress={() => haptics.light()}
              />
              <List.Separator className={SEPARATOR_INSET} />
              <List.Item
                title="Return"
                trailing={<Text className="font-medium">{returnDate}</Text>}
                leading={<RowIcon name="calendar" tone="teal" />}
                showChevron
                haptic="light"
                onPress={() => haptics.light()}
              />
              <List.Separator className={SEPARATOR_INSET} />
              <List.Item
                title="Travelers"
                trailing={<Text className="font-medium">{travelers}</Text>}
                leading={<RowIcon name="users" tone="green" />}
                showChevron
                haptic="light"
                onPress={() => haptics.light()}
              />
        </Mount>

        {/* Cabin — chips. */}
        <View className="mt-4 px-4">
          <Text variant="small" className="pb-2 text-muted-foreground">
            Cabin
          </Text>
          <View className="flex-row gap-2">
            {["Economy", "Premium", "Business"].map((c) => (
              <Chip
                key={c}
                variant="filter"
                selected={cabin === c}
                onPress={() => {
                  haptics.selection();
                  setCabin(c);
                }}
              >
                {c}
              </Chip>
            ))}
          </View>
        </View>

        {/* Recent searches — resume a past query in one tap. */}
        <Mount delay={BLOCK_STAGGER * 2} className="mx-4 mt-6 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
          <List.Item
            title="San Francisco → Lisbon"
            subtitle="Oct 3 – Oct 11 · 2 travelers"
            leading={<RowIcon name="clock" tone="gray" />}
            showChevron
            haptic="light"
            onPress={() => haptics.light()}
          />
          <List.Separator className={SEPARATOR_INSET} />
          <List.Item
            title="San Francisco → Tokyo"
            subtitle="Nov 14 – Nov 20 · 4 travelers"
            leading={<RowIcon name="clock" tone="gray" />}
            showChevron
            haptic="light"
            onPress={() => haptics.light()}
          />
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <View className="rounded-3xl bg-white p-3 shadow-sm dark:bg-[#1A1A20]">
        <Button
          haptic="light"
          onPress={() => {
            haptics.light();
            onSearch?.();
          }}
          accessibilityLabel="Search flights"
          tone="inverse"
          className="w-full bg-[#1B1B26]"
        >
          Search flights
        </Button>
        </View>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
FlightSearchScreen.displayName = "FlightSearchScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Flight Search Screen" screen in React Native using LumioUI.

Goal: From/to flight search with cabin 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-search
```

Or pull just the components: `npx lumioui add button chip icon list segmented-control 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>` ×5

### `chip` — Compact selectable pill with press scale and ink overlay.
- `<Chip>` ×1

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

### `list` — Settings-style rows with separators and press feedback.
- imported but not rendered directly — likely used through a sibling or as a utility

### `segmented-control` — iOS 26 segmented picker — glass capsule track with a gliding liquid indicator pill, spring motion + haptics
- `<SegmentedControl>` ×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/travel/flight-search.tsx` exporting FlightSearchScreen. 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, Chip, Icon, List, SegmentedControl, Text } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { BLOCK_STAGGER, Mount, RowIcon, SEPARATOR_INSET, StickyBottomBar, World } from "../shared";

export interface FlightSearchScreenProps {
  from?: string;
  to?: string;
  depart?: string;
  returnDate?: string;
  travelers?: string;
  onSwap?: () => void;
  onSearch?: () => void;
  onBack?: () => void;
}

/** Flight search — from/to swap pair, dates, travelers, cabin, Search. */
export function FlightSearchScreen({
  from = "San Francisco",
  to = "Lisbon",
  depart = "Oct 3",
  returnDate = "Oct 11",
  travelers = "4 travelers",
  onSwap,
  onSearch,
  onBack,
}: FlightSearchScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [trip, setTrip] = React.useState("Round trip");
  const [cabin, setCabin] = React.useState("Economy");

  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>
        </View>

      <Mount>
        <Text variant="h2" accessibilityRole="header" className="px-6 pb-1 tracking-tight">
          Flights
        </Text>
        {/* Price-watch line — search pages hint at deals waiting. */}
        <Text variant="muted" className="px-6 pb-1 text-xs">
          Prices to Lisbon are down 12% this week
        </Text>
      </Mount>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{ paddingBottom: insets.bottom + 96 }}
      >
        {/* Trip type. */}
        <View className="px-4 pb-3">
          <SegmentedControl
            value={trip}
            onValueChange={(v) => {
              haptics.selection();
              setTrip(v);
            }}
            options={["Round trip", "One way", "Multi-city"]}
          />
        </View>

        {/* From/to — stacked surfaces with the swap between them. */}
        <View className="mx-4">
          <Button
            variant="ghost"
            haptic="light"
            onPress={() => haptics.light()}
            accessibilityLabel={`From ${from}`}
            className="w-full rounded-t-3xl rounded-b-none bg-white p-4 dark:bg-[#1A1A20]"
          >
            <View className="flex-row items-center gap-3">
              <Icon name="map-pin" size="sm" color="mutedForeground" />
              <View className="flex-1 items-start">
                <Text variant="small" className="text-muted-foreground">
                  From
                </Text>
                <Text className="text-base font-semibold">{from}</Text>
              </View>
            </View>
          </Button>
          <View className="z-10 -my-2.5 items-end pr-4">
            <Button
              size="icon"
              haptic="medium"
              onPress={() => {
                haptics.medium();
                onSwap?.();
              }}
              accessibilityLabel="Swap origin and destination"
              className="h-10 w-10 rounded-full border-2 border-background bg-[#BEF04C] p-0"
            >
              <Icon name="repeat" size="sm" color="#1B1B26" />
            </Button>
          </View>
          <Button
            variant="ghost"
            haptic="light"
            onPress={() => haptics.light()}
            accessibilityLabel={`To ${to}`}
            className="w-full rounded-b-3xl rounded-t-none bg-white p-4 pt-5 dark:bg-[#1A1A20]"
          >
            <View className="flex-row items-center gap-3">
              <Icon name="map-pin" size="sm" color="#65A30D" />
              <View className="flex-1 items-start">
                <Text variant="small" className="text-muted-foreground">
                  To
                </Text>
                <Text className="text-base font-semibold">{to}</Text>
              </View>
            </View>
          </Button>
        </View>

        {/* Dates + travelers — row list, like airline apps. */}
        <Mount delay={BLOCK_STAGGER} className="mx-4 mt-4 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
              <List.Item
                title="Depart"
                trailing={<Text className="font-medium">{depart}</Text>}
                leading={<RowIcon name="calendar" tone="blue" />}
                showChevron
                haptic="light"
                onPress={() => haptics.light()}
              />
              <List.Separator className={SEPARATOR_INSET} />
              <List.Item
                title="Return"
                trailing={<Text className="font-medium">{returnDate}</Text>}
                leading={<RowIcon name="calendar" tone="teal" />}
                showChevron
                haptic="light"
                onPress={() => haptics.light()}
              />
              <List.Separator className={SEPARATOR_INSET} />
              <List.Item
                title="Travelers"
                trailing={<Text className="font-medium">{travelers}</Text>}
                leading={<RowIcon name="users" tone="green" />}
                showChevron
                haptic="light"
                onPress={() => haptics.light()}
              />
        </Mount>

        {/* Cabin — chips. */}
        <View className="mt-4 px-4">
          <Text variant="small" className="pb-2 text-muted-foreground">
            Cabin
          </Text>
          <View className="flex-row gap-2">
            {["Economy", "Premium", "Business"].map((c) => (
              <Chip
                key={c}
                variant="filter"
                selected={cabin === c}
                onPress={() => {
                  haptics.selection();
                  setCabin(c);
                }}
              >
                {c}
              </Chip>
            ))}
          </View>
        </View>

        {/* Recent searches — resume a past query in one tap. */}
        <Mount delay={BLOCK_STAGGER * 2} className="mx-4 mt-6 overflow-hidden rounded-3xl bg-white dark:bg-[#1A1A20]">
          <List.Item
            title="San Francisco → Lisbon"
            subtitle="Oct 3 – Oct 11 · 2 travelers"
            leading={<RowIcon name="clock" tone="gray" />}
            showChevron
            haptic="light"
            onPress={() => haptics.light()}
          />
          <List.Separator className={SEPARATOR_INSET} />
          <List.Item
            title="San Francisco → Tokyo"
            subtitle="Nov 14 – Nov 20 · 4 travelers"
            leading={<RowIcon name="clock" tone="gray" />}
            showChevron
            haptic="light"
            onPress={() => haptics.light()}
          />
        </Mount>
      </ScrollView>

      <StickyBottomBar>
        <View className="rounded-3xl bg-white p-3 shadow-sm dark:bg-[#1A1A20]">
        <Button
          haptic="light"
          onPress={() => {
            haptics.light();
            onSearch?.();
          }}
          accessibilityLabel="Search flights"
          tone="inverse"
          className="w-full bg-[#1B1B26]"
        >
          Search flights
        </Button>
        </View>
      </StickyBottomBar>
    </SafeAreaView>
    </World>
  );
}
FlightSearchScreen.displayName = "FlightSearchScreen";
```

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