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

Search results Screen

Live query field with trending chips and photo result grid.

pro Expo Go ✓ iosandroid gestures: tap · scroll haptics: light · selection
$ npx lumioui add ecommerce-search-results
import { SearchProductsScreen } from "@/screens/ecommerce/search-results";
Native packages installed6
@lumioui/ui@latest@lumioui/core@latestreact-native-safe-area-context@*react-native-reanimated@*react-native-svg@*nativewind@*
ecommerce/search-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 { Chip, Glass, Icon, Image, SearchInput, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { catalogImg, type CatalogPhoto, Press } from "../shared";

export interface SearchProduct {
  id: string;
  title: string;
  price: string;
  photo: CatalogPhoto;
}

export interface SearchProductsScreenProps {
  query?: string;
  results?: SearchProduct[];
  trending?: string[];
  onQueryChange?: (query: string) => void;
  onResultPress?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_RESULTS: SearchProduct[] = [
  { id: "r1", title: "Oversized wool overcoat", price: "$289", photo: "overcoat" },
  { id: "r2", title: "Sherpa denim jacket", price: "$168", photo: "denimJacket" },
  { id: "r3", title: "Quilted puffer coat", price: "$210", photo: "puffer" },
  { id: "r4", title: "Tan bomber jacket", price: "$185", photo: "bomber" },
];

const DEFAULT_TRENDING = ["wool coat", "chelsea boots", "pleated trousers"];
const REFINE = ["Size", "Color", "Price", "Brand"];
const RELATED = ["overcoat", "trench coat", "parka"];

/** Search results — live query field, trending chips, photo result grid. */
export function SearchProductsScreen({
  query = "coat",
  results = DEFAULT_RESULTS,
  trending = DEFAULT_TRENDING,
  onQueryChange,
  onResultPress,
  onBack,
}: SearchProductsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [value, setValue] = React.useState(query);

  // Honest demo filter — the count matches what's on screen.
  const tokens = value.toLowerCase().split(/\s+/).filter(Boolean);
  const shown =
    tokens.length === 0
      ? []
      : results.filter((r) =>
          tokens.some((t) => r.title.toLowerCase().includes(t))
        );
  const grid = shown.length > 0 ? shown : results;
  const [best, ...rest] = grid;

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + white search pill. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center gap-2">
          <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="flex-1">
            <SearchInput
              value={value}
              onChangeText={(t) => {
                setValue(t);
                onQueryChange?.(t);
              }}
              placeholder="Search products"
              accessibilityLabel="Search products"
            />
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{
          paddingTop: insets.top + 60,
          paddingBottom: insets.bottom + 32,
          paddingHorizontal: 16,
        }}
      >
        {value.trim() === "" ? (
          <View className="gap-3 px-2 pt-4">
            <Text variant="small" className="text-muted-foreground">
              Trending
            </Text>
            <View className="flex-row flex-wrap gap-2">
              {trending.map((t) => (
                <Chip
                  key={t}
                  variant="filter"
                  onPress={() => {
                    haptics.selection();
                    setValue(t);
                  }}
                >
                  {t}
                </Chip>
              ))}
            </View>
          </View>
        ) : (
          <>
            {/* Refine rail — the tonal chips every results page has. */}
            <ScrollView
              horizontal
              showsHorizontalScrollIndicator={false}
              contentContainerStyle={{ gap: 8, paddingTop: 12, paddingBottom: 4 }}
            >
              {REFINE.map((r) => (
                <Chip
                  key={r}
                  variant="filter"
                  onPress={() => haptics.selection()}
                  accessibilityLabel={`Refine by ${r}`}
                >
                  {r}
                </Chip>
              ))}
              <Chip
                variant="filter"
                onPress={() => haptics.selection()}
                accessibilityLabel="Sort results"
              >
                Sort: popular
              </Chip>
            </ScrollView>

            <Text variant="small" className="px-2 pb-3 pt-2 text-muted-foreground">
              {grid.length} results for “{value}”
            </Text>
            {/* Related-search hint — result pages teach adjacent vocabulary. */}
            <View className="flex-row flex-wrap gap-2 px-2 pb-3">
              {["wool coat", "overshirt", "chelsea boot"].map((q) => (
                <Text key={q} variant="small" className="rounded-full bg-white px-3 py-1 text-xs text-muted-foreground dark:bg-[#1A1A20]">
                  Also try “{q}”
                </Text>
              ))}
            </View>

            {/* Best match gets the full-width card before the 2-up grid. */}
            {best && (
              <Press
                haptic="light"
                onPress={() => onResultPress?.(best.id)}
                accessibilityLabel={`${best.title}, ${best.price}`}
                className="w-full items-start justify-start p-0 pb-4"
              >
                <View className="w-full overflow-hidden rounded-2xl bg-white dark:bg-[#1A1A20]">
                  <Image
                    source={{ uri: catalogImg(best.photo, 800, 520) }}
                    className="aspect-[3/2] w-full bg-muted"
                    accessibilityLabel={best.title}
                  />
                  <View className="absolute left-3 top-3 rounded-full bg-[#BEF04C] px-2.5 py-1">
                    <Text className="text-[10px] font-semibold text-[#1B1B26]">
                      Best match
                    </Text>
                  </View>
                  <View className="flex-row items-baseline justify-between px-3 py-2.5">
                    <Text variant="small" numberOfLines={1} className="flex-1">
                      {best.title}
                    </Text>
                    <Text variant="small" className="font-semibold">
                      {best.price}
                    </Text>
                  </View>
                </View>
              </Press>
            )}

            <View className="flex-row flex-wrap justify-between gap-y-4">
              {rest.map((item) => (
                <Press
                  key={item.id}
                  haptic="light"
                  onPress={() => onResultPress?.(item.id)}
                  accessibilityLabel={`${item.title}, ${item.price}`}
                  className="w-[48%] items-start justify-start p-0"
                >
                  <View className="w-full">
                    <Image
                      source={{ uri: catalogImg(item.photo, 400, 500) }}
                      className="aspect-[4/5] w-full rounded-2xl bg-muted"
                      accessibilityLabel={item.title}
                    />
                    <View className="items-start gap-0.5 px-1 pt-2">
                      <Text variant="small" numberOfLines={1}>
                        {item.title}
                      </Text>
                      <Text variant="small" className="font-semibold">
                        {item.price}
                      </Text>
                    </View>
                  </View>
                </Press>
              ))}
            </View>

            {/* Related searches — fills the tail and keeps the journey going. */}
            <View className="gap-2 pt-6">
              <Text variant="small" className="px-2 text-muted-foreground">
                Related searches
              </Text>
              <View className="flex-row flex-wrap gap-2">
                {RELATED.map((r) => (
                  <Chip
                    key={r}
                    variant="filter"
                    onPress={() => {
                      haptics.selection();
                      setValue(r);
                    }}
                  >
                    {r}
                  </Chip>
                ))}
              </View>
            </View>
          </>
        )}
      </ScrollView>
    </SafeAreaView>
  );
}
SearchProductsScreen.displayName = "SearchProductsScreen";
agent prompt — paste into Claude Code, Cursor, Devin…
Recreate the "Search results Screen" screen in React Native using LumioUI.

Goal: Live query field with trending chips and photo result grid. 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-search-results
```

Or pull just the components: `npx lumioui add button chip glass icon image search-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.
- imported but not rendered directly — likely used through a sibling or as a utility

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

### `glass` — iOS 26 liquid-glass surface — real glass via expo-glass-effect (Expo Go) or @callstack/liquid-glass (dev builds), SVG refraction + specular rim on web, frosted fallback elsewhere; GlassContainer melts adjacent panes into one blob
- `<Glass>` ×1

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

### `image` — Cached image with placeholder, fallback and aspect handling.
- `<Image>` ×2

### `search-input` — Search field with clear button, debounce, focus halo — plus a glass capsule mode that floats over content like iOS 26
- `<SearchInput>` ×1

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

## 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/search-results.tsx` exporting SearchProductsScreen. 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 { Chip, Glass, Icon, Image, SearchInput, Text, } from "@lumioui/ui";
import { useHaptic } from "@lumioui/core";
import { catalogImg, type CatalogPhoto, Press } from "../shared";

export interface SearchProduct {
  id: string;
  title: string;
  price: string;
  photo: CatalogPhoto;
}

export interface SearchProductsScreenProps {
  query?: string;
  results?: SearchProduct[];
  trending?: string[];
  onQueryChange?: (query: string) => void;
  onResultPress?: (id: string) => void;
  onBack?: () => void;
}

const DEFAULT_RESULTS: SearchProduct[] = [
  { id: "r1", title: "Oversized wool overcoat", price: "$289", photo: "overcoat" },
  { id: "r2", title: "Sherpa denim jacket", price: "$168", photo: "denimJacket" },
  { id: "r3", title: "Quilted puffer coat", price: "$210", photo: "puffer" },
  { id: "r4", title: "Tan bomber jacket", price: "$185", photo: "bomber" },
];

const DEFAULT_TRENDING = ["wool coat", "chelsea boots", "pleated trousers"];
const REFINE = ["Size", "Color", "Price", "Brand"];
const RELATED = ["overcoat", "trench coat", "parka"];

/** Search results — live query field, trending chips, photo result grid. */
export function SearchProductsScreen({
  query = "coat",
  results = DEFAULT_RESULTS,
  trending = DEFAULT_TRENDING,
  onQueryChange,
  onResultPress,
  onBack,
}: SearchProductsScreenProps) {
  const haptics = useHaptic();
  const insets = useSafeAreaInsets();
  const [value, setValue] = React.useState(query);

  // Honest demo filter — the count matches what's on screen.
  const tokens = value.toLowerCase().split(/\s+/).filter(Boolean);
  const shown =
    tokens.length === 0
      ? []
      : results.filter((r) =>
          tokens.some((t) => r.title.toLowerCase().includes(t))
        );
  const grid = shown.length > 0 ? shown : results;
  const [best, ...rest] = grid;

  return (
    <SafeAreaView className="flex-1 bg-[#F4F5F9] dark:bg-[#111114]" edges={["top"]}>
      {/* Floating chrome — back disc + white search pill. */}
      <View pointerEvents="box-none" className="absolute inset-x-4 z-10" style={{ top: insets.top + 8 }}>
        <View className="flex-row items-center gap-2">
          <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="flex-1">
            <SearchInput
              value={value}
              onChangeText={(t) => {
                setValue(t);
                onQueryChange?.(t);
              }}
              placeholder="Search products"
              accessibilityLabel="Search products"
            />
          </View>
        </View>
      </View>

      <ScrollView
        showsVerticalScrollIndicator={false}
        keyboardShouldPersistTaps="handled"
        contentContainerStyle={{
          paddingTop: insets.top + 60,
          paddingBottom: insets.bottom + 32,
          paddingHorizontal: 16,
        }}
      >
        {value.trim() === "" ? (
          <View className="gap-3 px-2 pt-4">
            <Text variant="small" className="text-muted-foreground">
              Trending
            </Text>
            <View className="flex-row flex-wrap gap-2">
              {trending.map((t) => (
                <Chip
                  key={t}
                  variant="filter"
                  onPress={() => {
                    haptics.selection();
                    setValue(t);
                  }}
                >
                  {t}
                </Chip>
              ))}
            </View>
          </View>
        ) : (
          <>
            {/* Refine rail — the tonal chips every results page has. */}
            <ScrollView
              horizontal
              showsHorizontalScrollIndicator={false}
              contentContainerStyle={{ gap: 8, paddingTop: 12, paddingBottom: 4 }}
            >
              {REFINE.map((r) => (
                <Chip
                  key={r}
                  variant="filter"
                  onPress={() => haptics.selection()}
                  accessibilityLabel={`Refine by ${r}`}
                >
                  {r}
                </Chip>
              ))}
              <Chip
                variant="filter"
                onPress={() => haptics.selection()}
                accessibilityLabel="Sort results"
              >
                Sort: popular
              </Chip>
            </ScrollView>

            <Text variant="small" className="px-2 pb-3 pt-2 text-muted-foreground">
              {grid.length} results for “{value}”
            </Text>
            {/* Related-search hint — result pages teach adjacent vocabulary. */}
            <View className="flex-row flex-wrap gap-2 px-2 pb-3">
              {["wool coat", "overshirt", "chelsea boot"].map((q) => (
                <Text key={q} variant="small" className="rounded-full bg-white px-3 py-1 text-xs text-muted-foreground dark:bg-[#1A1A20]">
                  Also try “{q}”
                </Text>
              ))}
            </View>

            {/* Best match gets the full-width card before the 2-up grid. */}
            {best && (
              <Press
                haptic="light"
                onPress={() => onResultPress?.(best.id)}
                accessibilityLabel={`${best.title}, ${best.price}`}
                className="w-full items-start justify-start p-0 pb-4"
              >
                <View className="w-full overflow-hidden rounded-2xl bg-white dark:bg-[#1A1A20]">
                  <Image
                    source={{ uri: catalogImg(best.photo, 800, 520) }}
                    className="aspect-[3/2] w-full bg-muted"
                    accessibilityLabel={best.title}
                  />
                  <View className="absolute left-3 top-3 rounded-full bg-[#BEF04C] px-2.5 py-1">
                    <Text className="text-[10px] font-semibold text-[#1B1B26]">
                      Best match
                    </Text>
                  </View>
                  <View className="flex-row items-baseline justify-between px-3 py-2.5">
                    <Text variant="small" numberOfLines={1} className="flex-1">
                      {best.title}
                    </Text>
                    <Text variant="small" className="font-semibold">
                      {best.price}
                    </Text>
                  </View>
                </View>
              </Press>
            )}

            <View className="flex-row flex-wrap justify-between gap-y-4">
              {rest.map((item) => (
                <Press
                  key={item.id}
                  haptic="light"
                  onPress={() => onResultPress?.(item.id)}
                  accessibilityLabel={`${item.title}, ${item.price}`}
                  className="w-[48%] items-start justify-start p-0"
                >
                  <View className="w-full">
                    <Image
                      source={{ uri: catalogImg(item.photo, 400, 500) }}
                      className="aspect-[4/5] w-full rounded-2xl bg-muted"
                      accessibilityLabel={item.title}
                    />
                    <View className="items-start gap-0.5 px-1 pt-2">
                      <Text variant="small" numberOfLines={1}>
                        {item.title}
                      </Text>
                      <Text variant="small" className="font-semibold">
                        {item.price}
                      </Text>
                    </View>
                  </View>
                </Press>
              ))}
            </View>

            {/* Related searches — fills the tail and keeps the journey going. */}
            <View className="gap-2 pt-6">
              <Text variant="small" className="px-2 text-muted-foreground">
                Related searches
              </Text>
              <View className="flex-row flex-wrap gap-2">
                {RELATED.map((r) => (
                  <Chip
                    key={r}
                    variant="filter"
                    onPress={() => {
                      haptics.selection();
                      setValue(r);
                    }}
                  >
                    {r}
                  </Chip>
                ))}
              </View>
            </View>
          </>
        )}
      </ScrollView>
    </SafeAreaView>
  );
}
SearchProductsScreen.displayName = "SearchProductsScreen";
```

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