A store search that reshapes as you type: matching text is emphasised in each row, quick filter chips fill in, and rows fade out and glide into their new order when you sort or filter. A filter sheet slides up with price pills, categories, tappable stars and switches, and its button counts the results live; recent searches slide away when removed.

Details
Using gluestack-ui?
Optional. The screen is plain React Native; these components can stand in for its primitives.
1import { useEffect, useMemo, useRef, useState, type ComponentRef, type ReactNode } from 'react';2import { Image, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, View, useColorScheme, useWindowDimensions, type LayoutChangeEvent } from 'react-native';3import Animated, {4 cancelAnimation,5 Easing,6 FadeIn,7 FadeInDown,8 FadeOut,9 FadeOutLeft,10 LinearTransition,11 ZoomIn,12 ZoomOut,13 interpolate,14 interpolateColor,15 useAnimatedRef,16 useAnimatedScrollHandler,17 useAnimatedStyle,18 useSharedValue,19 withRepeat,20 withSequence,21 withSpring,22 withTiming,23} from 'react-native-reanimated';24import { useSafeAreaInsets } from 'react-native-safe-area-context';25import { ArrowUpDown, Clock, Heart, House, Search, SearchX, ShoppingBag, SlidersHorizontal, Star, TrendingUp, Truck, UserRound, X } from 'lucide-react-native';2627// ─── Brand ──────────────────────────────────────────────────────────────────28// The screen's accent and name. Every accent colour below derives from these, so changing them rebrands the screen.2930const ACCENT = '#E11D48';31const ACCENT_DARK = '#FB4169'; // the accent on dark backgrounds32const ON_ACCENT = '#FFFFFF'; // text and icons on an accent fill33const APP_NAME = 'Hartley & Co.'; // the store's name3435/** `hex` at `alpha` opacity, as rgba(). */36function tint(hex: string, alpha: number) {37 const n = parseInt(hex.slice(1), 16);38 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;39}4041// ─── Sample data ────────────────────────────────────────────────────────────4243const photo = (id: string, w = 600) => `https://images.unsplash.com/photo-${id}?w=${w}&q=80&fit=crop`;4445type Category = 'Furniture' | 'Decor' | 'Tech' | 'Style';46const CATEGORIES: Category[] = ['Furniture', 'Decor', 'Tech', 'Style'];4748/** A source photo and how to crop it into a square: its width over height, the point to centre on (0 to 1), and a zoom. */49type Shot = { image: string; alt: string; ratio: number; fx: number; fy: number; zoom?: number; tint: string };5051type Product = Shot & {52 id: string;53 name: string;54 category: Category;55 finish: string;56 price: number;57 was?: number;58 rating: number;59 reviews: number;60 freeShipping: boolean;61 inStock: boolean;62};6364const ROOM = photo('1586023492125-27b2c045efd7', 900);65const SUCCULENT = photo('1485955900006-10f4d324d411');6667// In "Relevance" order.68const PRODUCTS: Product[] = [69 { id: 'derby', name: 'Green Suede Derby', category: 'Style', finish: 'Brogue, leather sole', price: 159, was: 199, rating: 4.8, reviews: 212, freeShipping: true, inStock: true, image: photo('1560343090-f0409e92791a'), alt: 'Green suede derby shoe', ratio: 0.8, fx: 0.5, fy: 0.62, tint: '#EAD8CE' },70 { id: 'sofa', name: 'Emerald Green Sofa', category: 'Furniture', finish: 'Velvet, 3 seat', price: 899, was: 1049, rating: 4.6, reviews: 318, freeShipping: false, inStock: true, image: photo('1555041469-a586c61ea9bc'), alt: 'Emerald green velvet sofa', ratio: 1.5, fx: 0.5, fy: 0.55, tint: '#DDD3CE' },71 { id: 'planter', name: 'Mint Green Planter', category: 'Decor', finish: 'Glazed ceramic, 12 cm', price: 28, rating: 4.5, reviews: 97, freeShipping: false, inStock: true, image: SUCCULENT, alt: 'Mint green ceramic planter holding a succulent', ratio: 1.5, fx: 0.5, fy: 0.5, tint: '#EEEEEE' },72 { id: 'flask', name: 'Forest Green Flask', category: 'Style', finish: 'Steel, 500 ml', price: 34, rating: 4.7, reviews: 164, freeShipping: true, inStock: true, image: photo('1602143407151-7111542de6e8'), alt: 'Forest green steel flask', ratio: 0.667, fx: 0.5, fy: 0.56, tint: '#E6EAE5' },73 { id: 'zebra', name: 'Evergreen Zebra Plant', category: 'Decor', finish: 'Live haworthia, potted', price: 22, rating: 4.2, reviews: 58, freeShipping: false, inStock: true, image: SUCCULENT, alt: 'Close view of a zebra haworthia', ratio: 1.5, fx: 0.5, fy: 0.3, zoom: 2, tint: '#EEEEEE' },74 { id: 'dome', name: 'Dome Floor Lamp', category: 'Furniture', finish: 'Graphite steel', price: 129, rating: 3.9, reviews: 203, freeShipping: true, inStock: true, image: photo('1507473885765-e6ed057f782c'), alt: 'Graphite floor lamp with a dome shade', ratio: 0.667, fx: 0.45, fy: 0.42, tint: '#E3E5E3' },75 { id: 'lounge', name: 'Mustard Lounge Chair', category: 'Furniture', finish: 'Wool blend, oak legs', price: 349, was: 429, rating: 4.7, reviews: 141, freeShipping: true, inStock: true, image: ROOM, alt: 'Mustard yellow lounge chair', ratio: 1.134, fx: 0.5, fy: 0.7, zoom: 2, tint: '#D8D2C8' },76 { id: 'studio', name: 'Studio Headphones', category: 'Tech', finish: 'Over-ear, matte black', price: 189, rating: 4.7, reviews: 1238, freeShipping: true, inStock: true, image: photo('1505740420928-5e560c06d30e'), alt: 'Black over-ear headphones', ratio: 1.5, fx: 0.66, fy: 0.5, tint: '#F6C415' },77 { id: 'pulse', name: 'Pulse Smart Watch', category: 'Tech', finish: 'Black sport band', price: 199, was: 249, rating: 4.6, reviews: 2041, freeShipping: true, inStock: true, image: photo('1546868871-7041f2a55e12'), alt: 'Smart watch with a black band', ratio: 0.8, fx: 0.5, fy: 0.445, tint: '#ECECEC' },78 { id: 'arc', name: 'Brass Arc Floor Lamp', category: 'Furniture', finish: 'Brushed brass', price: 219, rating: 4.4, reviews: 76, freeShipping: true, inStock: false, image: ROOM, alt: 'Slim brass floor lamp beside a chair', ratio: 1.134, fx: 0.3, fy: 0.5, zoom: 1.6, tint: '#D8D2C8' },79 { id: 'halo', name: 'Halo Watch', category: 'Style', finish: 'White, 36 mm', price: 145, rating: 4.1, reviews: 88, freeShipping: true, inStock: true, image: photo('1523275335684-37898b6baf30'), alt: 'White minimalist watch', ratio: 1.376, fx: 0.45, fy: 0.45, zoom: 1.25, tint: '#DCDCDC' },80 { id: 'eclipse', name: 'Eclipse Framed Print', category: 'Decor', finish: 'Black frame, 50 × 70 cm', price: 64, rating: 3.8, reviews: 41, freeShipping: false, inStock: false, image: ROOM, alt: 'Framed abstract print with a black circle', ratio: 1.134, fx: 0.545, fy: 0.31, zoom: 3, tint: '#D8D2C8' },81];8283const RECENT_SEARCHES = ['lounge chair', 'flask', 'framed print', 'suede derby'];84const TRENDING = ['green', 'floor lamp', 'smart watch', 'velvet sofa', 'headphones', 'planter'];8586const PRICES = [87 { key: 'low', label: 'Under $50', test: (n: number) => n < 50 },88 { key: 'mid', label: '$50 to $150', test: (n: number) => n >= 50 && n <= 150 },89 { key: 'high', label: '$150+', test: (n: number) => n > 150 },90] as const;91type PriceKey = (typeof PRICES)[number]['key'];9293const SORTS = [94 { key: 'relevance', label: 'Relevance' },95 { key: 'low', label: 'Price: low to high' },96 { key: 'rated', label: 'Top rated' },97] as const;98type SortKey = (typeof SORTS)[number]['key'];99100const TABS = [101 { label: 'Home', icon: House },102 { label: 'Search', icon: Search },103 { label: 'Saved', icon: Heart },104 { label: 'Bag', icon: ShoppingBag },105 { label: 'Profile', icon: UserRound },106];107const BAG_COUNT = 2;108109// ─── Searching and filtering ────────────────────────────────────────────────110111type Filters = { price: PriceKey | null; categories: Category[]; rating: number; sale: boolean; shipping: boolean; stock: boolean };112const NO_FILTERS: Filters = { price: null, categories: [], rating: 0, sale: false, shipping: false, stock: false };113type Quick = 'sale' | 'shipping' | 'rating' | 'stock';114const QUICK: { key: Quick; label: string }[] = [115 { key: 'sale', label: 'On sale' },116 { key: 'shipping', label: 'Free shipping' },117 { key: 'rating', label: '4 stars and up' },118 { key: 'stock', label: 'In stock' },119];120121const activeCount = (f: Filters) => (f.price ? 1 : 0) + (f.categories.length ? 1 : 0) + (f.rating ? 1 : 0) + (f.sale ? 1 : 0) + (f.shipping ? 1 : 0) + (f.stock ? 1 : 0);122const quickOn = (f: Filters, key: Quick) => (key === 'rating' ? f.rating >= 4 : f[key]);123const toggleQuick = (f: Filters, key: Quick): Filters => (key === 'rating' ? { ...f, rating: f.rating >= 4 ? 0 : 4 } : { ...f, [key]: !f[key] });124125const wordsOf = (query: string) => query.trim().toLowerCase().split(/\s+/).filter(Boolean);126127/** Every word must appear in the name, category or finish. An empty query matches the whole catalog. */128function search(words: string[], f: Filters, sort: SortKey = 'relevance'): Product[] {129 const price = PRICES.find((p) => p.key === f.price);130 const list = PRODUCTS.filter((p) => {131 const text = `${p.name} ${p.category} ${p.finish}`.toLowerCase();132 if (!words.every((w) => text.includes(w))) return false;133 if (price && !price.test(p.price)) return false;134 if (f.categories.length && !f.categories.includes(p.category)) return false;135 return p.rating >= f.rating && (!f.sale || !!p.was) && (!f.shipping || p.freeShipping) && (!f.stock || p.inStock);136 });137 if (sort === 'low') return list.sort((a, b) => a.price - b.price);138 if (sort === 'rated') return list.sort((a, b) => b.rating - a.rating || b.reviews - a.reviews);139 // Relevance: matches in the name come first, otherwise the catalog's own order.140 const inName = (p: Product) => (words.every((w) => p.name.toLowerCase().includes(w)) ? 0 : 1);141 return list.sort((a, b) => inName(a) - inName(b));142}143144/** Splits text around the searched words so the matching parts can be emphasised. */145function segments(text: string, words: string[]) {146 if (!words.length) return [{ text, hit: false }];147 const pattern = new RegExp(`(${words.map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})`, 'ig');148 return text149 .split(pattern)150 .filter(Boolean)151 .map((part) => ({ text: part, hit: words.includes(part.toLowerCase()) }));152}153154const money = (n: number) => `$${n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;155const comma = (n: number) => n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');156const plural = (n: number, word: string) => `${n} ${word}${n === 1 ? '' : 's'}`;157158// ─── Palette ────────────────────────────────────────────────────────────────159160const INK = '#0A0A0A';161const STAR = '#F59E0B';162const SPRING = { damping: 18, stiffness: 260, mass: 0.7 };163const TABULAR = { fontVariant: ['tabular-nums' as const] };164const TAB_H = 56;165const CHIPS_H = 50;166const THUMB = 88;167const MOVE = LinearTransition.duration(300);168169function usePalette() {170 const dark = useColorScheme() === 'dark';171 return {172 dark,173 bg: dark ? '#0A0A0A' : '#FAFAF9',174 fg: dark ? '#FAFAFA' : INK,175 inverse: dark ? INK : '#FAFAFA',176 muted: dark ? '#A1A1AA' : '#71717A',177 faint: dark ? '#5A5A60' : '#A8A29E',178 chip: dark ? '#1A1A1D' : '#F0EFEC',179 line: dark ? '#242428' : '#E7E5E4',180 accent: dark ? ACCENT_DARK : ACCENT,181 // The tint behind matched text and the sale tag.182 wash: dark ? tint(ACCENT_DARK, 0.24) : tint(ACCENT, 0.12),183 sheet: dark ? '#151517' : '#FFFFFF',184 pill: dark ? '#232327' : '#F0EFEC',185 track: dark ? '#34343A' : '#D9D6D2',186 // A hairline around photos in light mode, and the dim behind the filter sheet.187 hairline: dark ? 'transparent' : 'rgba(0,0,0,0.07)',188 scrim: dark ? 'rgba(0,0,0,0.66)' : 'rgba(10,10,10,0.44)',189 };190}191type Palette = ReturnType<typeof usePalette>;192193// Scale up past the target, then settle: used by the heart, the stars and the filter badge.194const pop = (peak: number) =>195 withSequence(withTiming(peak, { duration: 140, easing: Easing.out(Easing.back(2.4)) }), withTiming(1, { duration: 190, easing: Easing.out(Easing.cubic) }));196197// ─── Small pieces ───────────────────────────────────────────────────────────198199function Tap({ children, label, onPress, to = 0.92, role = 'button' }: { children: ReactNode; label: string; onPress?: () => void; to?: number; role?: 'button' | 'link' }) {200 const scale = useSharedValue(1);201 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));202 return (203 <Pressable role={role} aria-label={label} onPress={onPress} hitSlop={6} onPressIn={() => (scale.value = withSpring(to, SPRING))} onPressOut={() => (scale.value = withSpring(1, SPRING))}>204 <Animated.View style={style}>{children}</Animated.View>205 </Pressable>206 );207}208209/** A square crop of a photo that fades in over a tinted, pulsing placeholder. */210function Photo({ shot, size }: { shot: Shot; size: number }) {211 const shown = useSharedValue(0);212 const pulse = useSharedValue(0.15);213 useEffect(() => {214 pulse.value = withRepeat(withSequence(withTiming(0.5, { duration: 700 }), withTiming(0.15, { duration: 700 })), -1);215 return () => cancelAnimation(pulse);216 }, [pulse]);217 const image = useAnimatedStyle(() => ({ opacity: shown.value }));218 const placeholder = useAnimatedStyle(() => ({ opacity: (1 - shown.value) * pulse.value }));219 // Cover the square, scale by the zoom, then slide so the focus point sits in the centre.220 const zoom = shot.zoom ?? 1;221 const w = size * zoom * Math.max(1, shot.ratio);222 const h = (size * zoom) / Math.min(1, shot.ratio);223 const left = Math.min(0, Math.max(size - w, size / 2 - shot.fx * w));224 const top = Math.min(0, Math.max(size - h, size / 2 - shot.fy * h));225 return (226 <View style={[styles.photo, { width: size, height: size, backgroundColor: shot.tint }]}>227 <Animated.View style={[StyleSheet.absoluteFill, styles.photoPlaceholder, placeholder]} />228 <Animated.View style={[styles.photoFrame, { left, top, width: w, height: h }, image]}>229 <Image230 source={{ uri: shot.image }}231 alt={shot.alt}232 resizeMode="cover"233 style={{ width: w, height: h }}234 onLoad={() => {235 cancelAnimation(pulse);236 shown.value = withTiming(1, { duration: 320 });237 }}238 />239 </Animated.View>240 </View>241 );242}243244/** The number of active filters. It pops whenever the number changes, and the new digit rolls in. */245function CountBadge({ count, ring, color }: { count: number; ring: string; color: string }) {246 const scale = useSharedValue(1);247 const last = useRef(count);248 useEffect(() => {249 if (last.current === count) return;250 last.current = count;251 scale.value = pop(1.45);252 }, [count, scale]);253 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));254 return (255 <Animated.View pointerEvents="none" entering={ZoomIn.duration(180)} exiting={ZoomOut.duration(140)} style={styles.countBadgeSlot}>256 <Animated.View style={[styles.countBadge, { backgroundColor: color, borderColor: ring }, style]}>257 <Animated.Text key={count} entering={FadeInDown.duration(180)} style={[styles.countBadgeText, TABULAR]}>258 {count}259 </Animated.Text>260 </Animated.View>261 </Animated.View>262 );263}264265/** A pill that toggles: the fill grows in from the centre while the label swaps to the inverse colour. */266function Pill({ label, selected, onPress, base, grow, stars, pal }: { label: string; selected: boolean; onPress: () => void; base: string; grow?: boolean; stars?: number; pal: Palette }) {267 const on = useSharedValue(selected ? 1 : 0);268 useEffect(() => {269 on.value = withTiming(selected ? 1 : 0, { duration: 220, easing: Easing.out(Easing.cubic) });270 }, [selected, on]);271 const fill = useAnimatedStyle(() => ({ opacity: on.value, transform: [{ scale: 0.8 + on.value * 0.2 }] }));272 const text = useAnimatedStyle(() => ({ color: interpolateColor(on.value, [0, 1], [pal.fg, pal.inverse]) }));273 return (274 <Pressable275 role="checkbox"276 aria-checked={selected}277 aria-label={label}278 onPress={onPress}279 style={[styles.pill, { backgroundColor: base }, grow ? styles.pillGrow : null]}280 >281 <Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, styles.pillFill, { backgroundColor: pal.fg }, fill]} />282 {stars ? (283 <>284 <Animated.Text style={[styles.pillLabel, TABULAR, text]}>{stars}</Animated.Text>285 {/* In a view of its own so it stacks above the fill on web. */}286 <View>287 <Star size={13} color={STAR} fill={STAR} />288 </View>289 <Animated.Text style={[styles.pillLabel, text]}>and up</Animated.Text>290 </>291 ) : (292 <Animated.Text numberOfLines={1} style={[styles.pillLabel, text]}>293 {label}294 </Animated.Text>295 )}296 </Pressable>297 );298}299300function SectionTitle({ children, action, pal }: { children: ReactNode; action?: ReactNode; pal: Palette }) {301 return (302 <View style={styles.sectionTitle}>303 <Text style={[styles.sectionTitleText, { color: pal.fg }]}>{children}</Text>304 {action}305 </View>306 );307}308309// ─── Search field and filter button ─────────────────────────────────────────310311function SearchField({ value, onChange, onSubmit, onClear, clearable, inputRef, pal }: { value: string; onChange: (v: string) => void; onSubmit: () => void; onClear: () => void; clearable: boolean; inputRef: React.RefObject<ComponentRef<typeof TextInput> | null>; pal: Palette }) {312 const [focused, setFocused] = useState(false);313 const ring = useSharedValue(0);314 useEffect(() => {315 ring.value = withTiming(focused ? 1 : 0, { duration: 180 });316 }, [focused, ring]);317 const box = useAnimatedStyle(() => ({ borderColor: interpolateColor(ring.value, [0, 1], [pal.chip, pal.fg]) }));318 return (319 <Animated.View style={[styles.searchField, { backgroundColor: pal.chip }, box]}>320 <Search size={18} color={focused || value ? pal.fg : pal.muted} strokeWidth={2.2} />321 <TextInput322 ref={inputRef}323 value={value}324 onChangeText={onChange}325 onSubmitEditing={onSubmit}326 onFocus={() => setFocused(true)}327 onBlur={() => setFocused(false)}328 placeholder={`Search ${APP_NAME}`}329 placeholderTextColor={pal.muted}330 selectionColor={pal.accent}331 aria-label="Search products"332 autoCapitalize="none"333 autoCorrect={false}334 returnKeyType="search"335 style={[styles.searchInput, { color: pal.fg }, Platform.OS === 'web' ? ({ outlineStyle: 'none' } as object) : null]}336 />337 {clearable && (338 <Animated.View entering={ZoomIn.duration(160)} exiting={ZoomOut.duration(120)}>339 <Pressable340 role="button"341 aria-label="Clear search"342 hitSlop={8}343 onPress={() => {344 onClear();345 inputRef.current?.focus();346 }}347 style={[styles.clearButton, { backgroundColor: pal.faint }]}348 >349 <X size={14} color={pal.chip} strokeWidth={3} />350 </Pressable>351 </Animated.View>352 )}353 </Animated.View>354 );355}356357function FilterButton({ count, open, onPress, pal }: { count: number; open: boolean; onPress: () => void; pal: Palette }) {358 const scale = useSharedValue(1);359 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));360 return (361 <Pressable362 role="button"363 aria-label={count ? `Filters, ${count} active` : 'Filters'}364 aria-expanded={open}365 onPress={onPress}366 onPressIn={() => (scale.value = withSpring(0.92, SPRING))}367 onPressOut={() => (scale.value = withSpring(1, SPRING))}368 >369 <Animated.View style={[styles.filterButton, { backgroundColor: count ? pal.fg : pal.chip }, style]}>370 <SlidersHorizontal size={19} color={count ? pal.inverse : pal.fg} strokeWidth={2.2} />371 {count > 0 && <CountBadge count={count} ring={pal.bg} color={pal.accent} />}372 </Animated.View>373 </Pressable>374 );375}376377// ─── Before you type: recent searches, trending, categories ─────────────────378379function RecentRow({ term, onPick, onRemove, pal }: { term: string; onPick: () => void; onRemove: () => void; pal: Palette }) {380 return (381 <View style={styles.recentRow}>382 <Pressable role="button" aria-label={`Search for ${term}`} onPress={onPick} style={styles.recentPick}>383 <View style={[styles.recentIcon, { backgroundColor: pal.chip }]}>384 <Clock size={16} color={pal.muted} strokeWidth={2.1} />385 </View>386 <Text numberOfLines={1} style={[styles.recentTerm, { color: pal.fg }]}>387 {term}388 </Text>389 </Pressable>390 <Pressable role="button" aria-label={`Remove ${term} from recent searches`} hitSlop={8} onPress={onRemove} style={styles.recentRemove}>391 <X size={17} color={pal.faint} strokeWidth={2.3} />392 </Pressable>393 </View>394 );395}396397function Discover({ recents, onPick, onRemove, onClearAll, pal }: { recents: string[]; onPick: (term: string) => void; onRemove: (term: string) => void; onClearAll: () => void; pal: Palette }) {398 const { width } = useWindowDimensions();399 const tile = (width - 40 - 12) / 2;400 return (401 <Animated.View entering={FadeIn.duration(240)} style={styles.discover}>402 {recents.length > 0 && (403 <Animated.View exiting={FadeOut.duration(160)}>404 <SectionTitle405 pal={pal}406 action={407 <Pressable role="button" aria-label="Clear all recent searches" hitSlop={10} onPress={onClearAll}>408 <Text style={[styles.clearAll, { color: pal.muted }]}>Clear all</Text>409 </Pressable>410 }411 >412 Recent searches413 </SectionTitle>414 </Animated.View>415 )}416 {recents.map((term) => (417 // Removed rows slide out to the left; the ones below glide up.418 <Animated.View key={term} layout={MOVE} entering={FadeIn.duration(220)} exiting={FadeOutLeft.duration(220)}>419 <RecentRow term={term} onPick={() => onPick(term)} onRemove={() => onRemove(term)} pal={pal} />420 </Animated.View>421 ))}422423 <Animated.View layout={MOVE} style={{ marginTop: recents.length ? 18 : 0 }}>424 <SectionTitle pal={pal} action={<TrendingUp size={18} color={pal.accent} strokeWidth={2.4} />}>425 Trending426 </SectionTitle>427 <View style={styles.trending}>428 {TRENDING.map((term) => (429 <Tap key={term} label={`Search for ${term}`} onPress={() => onPick(term)} to={0.94}>430 <View style={[styles.trendChip, { backgroundColor: pal.chip }]}>431 <Text style={[styles.chipLabel, { color: pal.fg }]}>{term}</Text>432 </View>433 </Tap>434 ))}435 </View>436437 <View style={styles.categorySection}>438 <SectionTitle pal={pal}>Shop by category</SectionTitle>439 <View style={styles.categoryGrid}>440 {CATEGORIES.map((category) => {441 const items = PRODUCTS.filter((p) => p.category === category);442 return (443 <Tap key={category} label={`${category}, ${plural(items.length, 'item')}`} onPress={() => onPick(category.toLowerCase())} to={0.96}>444 <View style={[styles.categoryTile, { width: tile, backgroundColor: pal.chip }]}>445 <View style={styles.categoryPhoto}>446 <Photo shot={items[0]} size={52} />447 </View>448 <View style={styles.fill}>449 <Text numberOfLines={1} style={[styles.categoryName, { color: pal.fg }]}>450 {category}451 </Text>452 <Text style={[styles.categoryCount, { color: pal.muted }, TABULAR]}>{plural(items.length, 'item')}</Text>453 </View>454 </View>455 </Tap>456 );457 })}458 </View>459 </View>460 </Animated.View>461 </Animated.View>462 );463}464465// ─── A result row ───────────────────────────────────────────────────────────466467function SaveButton({ saved, onPress, name, pal }: { saved: boolean; onPress: () => void; name: string; pal: Palette }) {468 const scale = useSharedValue(1);469 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));470 return (471 <Pressable472 role="button"473 aria-label={saved ? `Remove ${name} from saved` : `Save ${name}`}474 aria-pressed={saved}475 hitSlop={6}476 onPress={() => {477 scale.value = pop(1.4);478 onPress();479 }}480 style={styles.saveButton}481 >482 <Animated.View style={style}>483 <Heart size={20} color={saved ? pal.accent : pal.faint} fill={saved ? pal.accent : 'transparent'} strokeWidth={2.1} />484 </Animated.View>485 </Pressable>486 );487}488489function ResultRow({ product, words, saved, onSave, pal }: { product: Product; words: string[]; saved: boolean; onSave: () => void; pal: Palette }) {490 const scale = useSharedValue(1);491 const press = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));492 const off = product.was ? Math.round((1 - product.price / product.was) * 100) : 0;493 return (494 <View>495 <Animated.View style={press}>496 {/* Open the product from here. The heart sits beside it, not inside it. */}497 <Pressable498 role="link"499 aria-label={`${product.name}, ${product.finish}, ${money(product.price)}${product.inStock ? '' : ', sold out'}`}500 onPressIn={() => (scale.value = withSpring(0.975, SPRING))}501 onPressOut={() => (scale.value = withSpring(1, SPRING))}502 style={styles.resultRow}503 >504 <View style={styles.resultPhoto}>505 <Photo shot={product} size={THUMB} />506 {!product.inStock && <View pointerEvents="none" style={[StyleSheet.absoluteFill, styles.soldOutVeil, { backgroundColor: pal.bg }]} />}507 {/* A hairline keeps white studio shots from melting into the light background. */}508 <View pointerEvents="none" style={[StyleSheet.absoluteFill, styles.resultHairline, { borderColor: pal.hairline }]} />509 </View>510511 <View style={styles.fill}>512 <Text numberOfLines={1} style={[styles.resultName, { color: pal.fg }]}>513 {segments(product.name, words).map((part, i) =>514 part.hit ? (515 <Text key={i} style={[styles.resultHit, { backgroundColor: pal.wash }]}>516 {part.text}517 </Text>518 ) : (519 part.text520 )521 )}522 </Text>523 <Text numberOfLines={1} style={[styles.resultMeta, { color: pal.muted }]}>524 {product.category} · {product.finish}525 </Text>526 <View style={styles.resultRating}>527 <Star size={13} color={STAR} fill={STAR} />528 <Text style={[styles.ratingValue, { color: pal.fg }, TABULAR]}>{product.rating.toFixed(1)}</Text>529 <Text style={[styles.ratingCount, { color: pal.muted }, TABULAR]}>({comma(product.reviews)})</Text>530 {product.freeShipping && (531 <View style={styles.shipping}>532 <Truck size={13} color={pal.muted} strokeWidth={2.1} />533 <Text style={[styles.ratingCount, { color: pal.muted }]}>Free shipping</Text>534 </View>535 )}536 </View>537 <View style={styles.priceRow}>538 <Text style={[styles.price, { color: product.was ? pal.accent : pal.fg }, TABULAR]}>{money(product.price)}</Text>539 {product.was ? <Text style={[styles.was, { color: pal.faint }, TABULAR]}>{money(product.was)}</Text> : null}540 {off ? (541 <View style={[styles.offTag, { backgroundColor: pal.wash }]}>542 <Text style={[styles.offText, { color: pal.accent }, TABULAR]}>−{off}%</Text>543 </View>544 ) : null}545 <View style={styles.fill} />546 {!product.inStock && (547 <View style={[styles.soldOut, { backgroundColor: pal.chip }]}>548 <Text style={[styles.soldOutText, { color: pal.muted }]}>Sold out</Text>549 </View>550 )}551 </View>552 </View>553 </Pressable>554 </Animated.View>555 <SaveButton saved={saved} onPress={onSave} name={product.name} pal={pal} />556 </View>557 );558}559560// ─── Empty state ────────────────────────────────────────────────────────────561562function NoResults({ term, hidden, onClearFilters, onClearSearch, onPick, pal }: { term: string; hidden: number; onClearFilters: () => void; onClearSearch: () => void; onPick: (term: string) => void; pal: Palette }) {563 const ideas = TRENDING.filter((t) => t !== term).slice(0, 3);564 // Offer "Clear filters" only when the filters are what hides the results.565 const filtered = hidden > 0;566 return (567 <Animated.View entering={FadeIn.delay(160).duration(260)} exiting={FadeOut.duration(100)} style={styles.empty}>568 <View style={[styles.emptyIcon, { backgroundColor: pal.chip }]}>569 <SearchX size={29} color={pal.muted} />570 </View>571 <Text numberOfLines={2} style={[styles.emptyTitle, { color: pal.fg }]}>572 {term ? `No results for “${term}”` : 'Nothing matches these filters'}573 </Text>574 <Text style={[styles.emptyBody, { color: pal.muted }]}>575 {filtered ? `${plural(hidden, 'item')} ${hidden === 1 ? 'matches' : 'match'} without your filters.` : 'Check the spelling, or try one of these.'}576 </Text>577578 {filtered ? (579 <View style={styles.emptyAction}>580 <Tap label="Clear filters" onPress={onClearFilters} to={0.96}>581 <View style={[styles.clearFilters, { backgroundColor: pal.fg }]}>582 <Text style={[styles.emptyLink, { color: pal.inverse }]}>Clear filters</Text>583 </View>584 </Tap>585 </View>586 ) : (587 <Pressable role="button" aria-label="Clear search" hitSlop={10} onPress={onClearSearch} style={styles.clearSearch}>588 <Text style={[styles.emptyLink, { color: pal.accent }]}>Clear search</Text>589 </Pressable>590 )}591592 <View style={styles.ideas}>593 {ideas.map((idea) => (594 <Tap key={idea} label={`Search for ${idea}`} onPress={() => onPick(idea)} to={0.94}>595 <View style={[styles.ideaChip, { backgroundColor: pal.chip }]}>596 <Search size={14} color={pal.muted} strokeWidth={2.4} />597 <Text style={[styles.chipLabel, { color: pal.fg }]}>{idea}</Text>598 </View>599 </Tap>600 ))}601 </View>602 </Animated.View>603 );604}605606// ─── Filter sheet: edits a draft, and the button counts what it would show ───607608function Toggle({ label, hint, on, onPress, pal }: { label: string; hint: string; on: boolean; onPress: () => void; pal: Palette }) {609 const t = useSharedValue(on ? 1 : 0);610 useEffect(() => {611 t.value = withTiming(on ? 1 : 0, { duration: 200, easing: Easing.out(Easing.cubic) });612 }, [on, t]);613 const track = useAnimatedStyle(() => ({ backgroundColor: interpolateColor(t.value, [0, 1], [pal.track, pal.fg]) }));614 const thumb = useAnimatedStyle(() => ({ transform: [{ translateX: t.value * 20 }], backgroundColor: interpolateColor(t.value, [0, 1], ['#FFFFFF', pal.sheet]) }));615 return (616 <Pressable role="switch" aria-checked={on} aria-label={label} onPress={onPress} style={styles.toggle}>617 <View style={styles.fill}>618 <Text style={[styles.toggleLabel, { color: pal.fg }]}>{label}</Text>619 <Text style={[styles.toggleHint, { color: pal.muted }]}>{hint}</Text>620 </View>621 <Animated.View style={[styles.toggleTrack, track]}>622 <Animated.View style={[styles.toggleThumb, thumb]} />623 </Animated.View>624 </Pressable>625 );626}627628function RatingStar({ value, filled, selected, onPress, pal }: { value: number; filled: boolean; selected: boolean; onPress: () => void; pal: Palette }) {629 const scale = useSharedValue(1);630 const was = useRef(filled);631 useEffect(() => {632 if (was.current === filled) return;633 was.current = filled;634 if (filled) scale.value = pop(1.3);635 }, [filled, scale]);636 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));637 return (638 <Pressable role="radio" aria-checked={selected} aria-label={`${plural(value, 'star')} and up`} hitSlop={4} onPress={onPress}>639 <Animated.View style={style}>640 <Star size={32} color={filled ? STAR : pal.track} fill={filled ? STAR : 'transparent'} strokeWidth={1.8} />641 </Animated.View>642 </Pressable>643 );644}645646function SheetSection({ title, hint, children, pal }: { title: string; hint?: string; children: ReactNode; pal: Palette }) {647 return (648 <View style={styles.sheetSection}>649 <View style={styles.sheetSectionHead}>650 <Text style={[styles.sheetSectionTitle, { color: pal.fg }]}>{title}</Text>651 {hint ? (652 <Animated.Text key={hint} entering={FadeIn.duration(180)} style={[styles.sheetSectionHint, { color: pal.muted }]}>653 {hint}654 </Animated.Text>655 ) : null}656 </View>657 {children}658 </View>659 );660}661662function FilterSheet({ open, applied, words, onApply, onClose, pal }: { open: boolean; applied: Filters; words: string[]; onApply: (f: Filters) => void; onClose: () => void; pal: Palette }) {663 const insets = useSafeAreaInsets();664 const { height: screen } = useWindowDimensions();665 const [mounted, setMounted] = useState(false);666 const [draft, setDraft] = useState(applied);667 const [sheetH, setSheetH] = useState(660);668 const t = useSharedValue(0);669 const latest = useRef(applied);670 latest.current = applied;671672 useEffect(() => {673 if (open) {674 // Each opening starts from what is applied right now.675 setDraft(latest.current);676 setMounted(true);677 t.value = withTiming(1, { duration: 340, easing: Easing.out(Easing.cubic) });678 return;679 }680 t.value = withTiming(0, { duration: 220, easing: Easing.in(Easing.cubic) });681 const id = setTimeout(() => setMounted(false), 240);682 return () => clearTimeout(id);683 }, [open, t]);684685 const backdrop = useAnimatedStyle(() => ({ opacity: t.value }));686 const slide = useAnimatedStyle(() => ({ transform: [{ translateY: (1 - t.value) * sheetH }] }));687688 const count = useMemo(() => search(words, draft).length, [words, draft]);689 const changes = activeCount(draft);690 const set = (patch: Partial<Filters>) => setDraft((d) => ({ ...d, ...patch }));691 const toggleCategory = (c: Category) => setDraft((d) => ({ ...d, categories: d.categories.includes(c) ? d.categories.filter((v) => v !== c) : [...d.categories, c] }));692693 if (!mounted) return null;694 return (695 <View style={[StyleSheet.absoluteFill, styles.sheetLayer]}>696 <Animated.View style={[StyleSheet.absoluteFill, { backgroundColor: pal.scrim }, backdrop]}>697 <Pressable role="button" aria-label="Close filters" onPress={onClose} style={StyleSheet.absoluteFill} />698 </Animated.View>699700 <Animated.View701 role="dialog"702 aria-label="Filters"703 onLayout={(e: LayoutChangeEvent) => setSheetH(e.nativeEvent.layout.height)}704 style={[styles.sheet, { maxHeight: screen - insets.top - 16, backgroundColor: pal.sheet, paddingBottom: insets.bottom + 10 }, slide]}705 >706 <View style={styles.grabberSlot}>707 <View style={[styles.grabber, { backgroundColor: pal.track }]} />708 </View>709 <View style={styles.sheetHeader}>710 <Text style={[styles.sheetTitle, { color: pal.fg }]}>Filters</Text>711 <Tap label="Close" onPress={onClose}>712 <View style={[styles.sheetClose, { backgroundColor: pal.pill }]}>713 <X size={17} color={pal.fg} strokeWidth={2.4} />714 </View>715 </Tap>716 </View>717718 <ScrollView showsVerticalScrollIndicator={false} style={styles.sheetScroll} contentContainerStyle={styles.sheetContent}>719 <View style={styles.sheetBody}>720 <SheetSection title="Price" pal={pal}>721 <View style={styles.priceRowPills}>722 {PRICES.map((p) => (723 <Pill key={p.key} label={p.label} selected={draft.price === p.key} onPress={() => set({ price: draft.price === p.key ? null : p.key })} base={pal.pill} grow pal={pal} />724 ))}725 </View>726 </SheetSection>727728 <SheetSection title="Category" hint={draft.categories.length ? `${draft.categories.length} selected` : 'All'} pal={pal}>729 <View style={styles.categoryPills}>730 {CATEGORIES.map((c) => (731 <Pill key={c} label={c} selected={draft.categories.includes(c)} onPress={() => toggleCategory(c)} base={pal.pill} pal={pal} />732 ))}733 </View>734 </SheetSection>735736 <SheetSection title="Rating" hint={draft.rating ? (draft.rating === 5 ? '5 stars only' : `${plural(draft.rating, 'star')} and up`) : 'Any rating'} pal={pal}>737 <View role="radiogroup" aria-label="Minimum rating" style={styles.stars}>738 {[1, 2, 3, 4, 5].map((n) => (739 // Tapping the current rating again clears it.740 <RatingStar key={n} value={n} filled={n <= draft.rating} selected={n === draft.rating} onPress={() => set({ rating: draft.rating === n ? 0 : n })} pal={pal} />741 ))}742 </View>743 </SheetSection>744745 <View style={[styles.toggles, { borderTopColor: pal.line }]}>746 <Toggle label="On sale" hint="Only items that are marked down" on={draft.sale} onPress={() => set({ sale: !draft.sale })} pal={pal} />747 <Toggle label="Free shipping" hint="Delivered at no extra cost" on={draft.shipping} onPress={() => set({ shipping: !draft.shipping })} pal={pal} />748 <Toggle label="In stock" hint="Hide items that are sold out" on={draft.stock} onPress={() => set({ stock: !draft.stock })} pal={pal} />749 </View>750 </View>751 </ScrollView>752753 <View style={styles.sheetFooter}>754 <Tap label="Reset filters" onPress={() => setDraft(NO_FILTERS)} to={0.96}>755 <View style={[styles.reset, { backgroundColor: pal.pill, opacity: changes ? 1 : 0.5 }]}>756 <Text style={[styles.resetLabel, { color: pal.fg }]}>Reset</Text>757 </View>758 </Tap>759 <View style={styles.fill}>760 <Tap label={count ? `Show ${plural(count, 'result')}` : 'No results, show anyway'} onPress={() => onApply(draft)} to={0.97}>761 <View style={[styles.apply, { backgroundColor: pal.accent, opacity: count ? 1 : 0.55 }]}>762 {/* The count rolls as the draft changes. */}763 <Animated.Text key={count} entering={FadeInDown.duration(200)} style={[styles.applyLabel, TABULAR]}>764 {count ? `Show ${plural(count, 'result')}` : 'No results'}765 </Animated.Text>766 </View>767 </Tap>768 </View>769 </View>770 </Animated.View>771 </View>772 );773}774775// ─── Tab bar ────────────────────────────────────────────────────────────────776777function TabBar({ onSearch, pal }: { onSearch: () => void; pal: Palette }) {778 const insets = useSafeAreaInsets();779 const [tab, setTab] = useState('Search');780 return (781 <View role="tablist" style={[styles.tabBar, { paddingBottom: insets.bottom, backgroundColor: pal.bg, borderTopColor: pal.line }]}>782 {TABS.map(({ label, icon: Icon }) => {783 const on = tab === label;784 return (785 <Pressable786 key={label}787 role="tab"788 aria-selected={on}789 aria-label={label === 'Bag' ? `Bag, ${BAG_COUNT} items` : `${label} tab`}790 onPress={() => {791 setTab(label);792 if (label === 'Search') onSearch();793 }}794 style={styles.tab}795 >796 <View>797 <Icon size={23} color={on ? pal.fg : pal.muted} strokeWidth={on ? 2.4 : 1.9} />798 {label === 'Bag' ? (799 <View pointerEvents="none" style={[styles.bagBadge, { backgroundColor: pal.accent, borderColor: pal.bg }]}>800 <Text style={[styles.bagBadgeText, TABULAR]}>{BAG_COUNT}</Text>801 </View>802 ) : null}803 </View>804 <Text style={[styles.tabLabel, { fontWeight: on ? '700' : '500', color: on ? pal.fg : pal.muted }]}>{label}</Text>805 </Pressable>806 );807 })}808 </View>809 );810}811812// ─── Screen ─────────────────────────────────────────────────────────────────813814export default function SearchFiltersScreen() {815 const pal = usePalette();816 const insets = useSafeAreaInsets();817818 const [query, setQuery] = useState('green');819 const [filters, setFilters] = useState<Filters>({ ...NO_FILTERS, rating: 4 });820 const [sort, setSort] = useState(0);821 const [recents, setRecents] = useState(RECENT_SEARCHES);822 const [saved, setSaved] = useState<string[]>(['planter']);823 // Applying filters with an empty query browses the whole catalog.824 const [browsing, setBrowsing] = useState(false);825 const [sheetOpen, setSheetOpen] = useState(false);826 const inputRef = useRef<ComponentRef<typeof TextInput>>(null);827 const listRef = useAnimatedRef<Animated.ScrollView>();828829 // Rows stagger in once; anything a search or filter adds after that fades in on its own.830 const [settled, setSettled] = useState(false);831 useEffect(() => {832 const t = setTimeout(() => setSettled(true), 1100);833 return () => clearTimeout(t);834 }, []);835836 const term = query.trim().toLowerCase().replace(/\s+/g, ' ');837 const words = useMemo(() => wordsOf(term), [term]);838 const showResults = words.length > 0 || browsing;839 const results = useMemo(() => search(words, filters, SORTS[sort].key), [words, filters, sort]);840 const unfiltered = useMemo(() => search(words, NO_FILTERS).length, [words]);841 const active = activeCount(filters);842843 // A new search starts at the top of the list.844 useEffect(() => {845 listRef.current?.scrollTo({ y: 0, animated: false });846 }, [term, listRef]);847848 const remember = (text: string) => {849 const clean = text.trim().toLowerCase();850 if (clean) setRecents((r) => [clean, ...r.filter((v) => v !== clean)].slice(0, 5));851 };852 const type = (text: string) => {853 setQuery(text);854 if (!text.trim()) setBrowsing(false);855 };856 const pick = (text: string) => {857 setQuery(text);858 remember(text);859 };860 const clearSearch = () => {861 setQuery('');862 setBrowsing(false);863 };864 const toggleSaved = (id: string) => setSaved((s) => (s.includes(id) ? s.filter((v) => v !== id) : [...s, id]));865866 // The quick filters fold away with the results they belong to.867 const reveal = useSharedValue(showResults ? 1 : 0);868 useEffect(() => {869 reveal.value = withTiming(showResults ? 1 : 0, { duration: 240, easing: Easing.out(Easing.cubic) });870 }, [showResults, reveal]);871 const chips = useAnimatedStyle(() => ({ height: reveal.value * CHIPS_H, opacity: reveal.value }));872873 const scrollY = useSharedValue(0);874 const onScroll = useAnimatedScrollHandler((e) => {875 scrollY.value = e.contentOffset.y;876 });877 // The header's hairline appears once content scrolls under it.878 const hairline = useAnimatedStyle(() => ({ opacity: interpolate(scrollY.value, [0, 20], [0, 1], 'clamp') }));879880 return (881 <View style={[styles.screen, { backgroundColor: pal.bg }]}>882 {/* Header: opaque, under the status bar */}883 <View style={{ paddingTop: insets.top + 8, backgroundColor: pal.bg }}>884 <View style={styles.header}>885 <SearchField value={query} onChange={type} onSubmit={() => remember(query)} onClear={clearSearch} clearable={query.length > 0 || browsing} inputRef={inputRef} pal={pal} />886 <FilterButton count={active} open={sheetOpen} onPress={() => setSheetOpen(true)} pal={pal} />887 </View>888 <Animated.View pointerEvents={showResults ? 'auto' : 'none'} aria-hidden={!showResults} style={[styles.chips, chips]}>889 <ScrollView horizontal showsHorizontalScrollIndicator={false} aria-label="Quick filters" contentContainerStyle={styles.chipsContent}>890 {QUICK.map((q) => (891 <Pill key={q.key} label={q.label} stars={q.key === 'rating' ? 4 : undefined} selected={quickOn(filters, q.key)} onPress={() => setFilters((f) => toggleQuick(f, q.key))} base={pal.chip} pal={pal} />892 ))}893 </ScrollView>894 </Animated.View>895 <Animated.View style={[styles.headerRule, { backgroundColor: pal.line }, hairline]} />896 </View>897898 <Animated.ScrollView ref={listRef} onScroll={onScroll} scrollEventThrottle={16} showsVerticalScrollIndicator={false} keyboardShouldPersistTaps="handled" style={styles.fill} contentContainerStyle={styles.listContent}>899 {showResults ? (900 <View key="results" style={styles.results}>901 {/* Count and sort */}902 <Animated.View entering={FadeIn.duration(240)} style={styles.resultsHead}>903 <View style={styles.resultsCount}>904 <Animated.Text key={results.length} entering={FadeInDown.duration(200)} style={[styles.resultsTotal, { color: pal.fg }, TABULAR]}>905 {plural(results.length, 'result')}906 </Animated.Text>907 <Text numberOfLines={1} style={[styles.resultsFor, { color: pal.muted }]}>908 {term ? `for “${term}”` : 'in all products'}909 </Text>910 </View>911 {results.length > 0 && (912 <Pressable role="button" aria-label={`Sort by ${SORTS[sort].label}. Tap to change.`} hitSlop={10} onPress={() => setSort((s) => (s + 1) % SORTS.length)} style={styles.sort}>913 <ArrowUpDown size={14} color={pal.fg} strokeWidth={2.4} />914 <Animated.Text key={sort} entering={FadeInDown.duration(200)} style={[styles.sortLabel, { color: pal.fg }]}>915 {SORTS[sort].label}916 </Animated.Text>917 </Pressable>918 )}919 </Animated.View>920921 {results.map((p, i) => (922 <Animated.View key={p.id} layout={MOVE} entering={settled ? FadeIn.duration(260) : FadeInDown.delay(100 + i * 60).duration(400)} exiting={FadeOut.duration(160)}>923 <ResultRow product={p} words={words} saved={saved.includes(p.id)} onSave={() => toggleSaved(p.id)} pal={pal} />924 </Animated.View>925 ))}926927 {results.length === 0 && (928 <NoResults term={term} hidden={active ? unfiltered : 0} onClearFilters={() => setFilters(NO_FILTERS)} onClearSearch={clearSearch} onPick={pick} pal={pal} />929 )}930 </View>931 ) : (932 <Discover key="discover" recents={recents} onPick={pick} onRemove={(t) => setRecents((r) => r.filter((v) => v !== t))} onClearAll={() => setRecents([])} pal={pal} />933 )}934 </Animated.ScrollView>935936 <TabBar onSearch={() => inputRef.current?.focus()} pal={pal} />937938 <FilterSheet939 open={sheetOpen}940 applied={filters}941 words={words}942 onClose={() => setSheetOpen(false)}943 onApply={(f) => {944 setFilters(f);945 if (!words.length) setBrowsing(activeCount(f) > 0);946 setSheetOpen(false);947 }}948 pal={pal}949 />950 </View>951 );952}953954// ─── Styles ─────────────────────────────────────────────────────────────────955956const styles = StyleSheet.create({957 screen: { flex: 1 },958 fill: { flex: 1 },959960 // Header961 header: { flexDirection: 'row', alignItems: 'center', gap: 10, paddingHorizontal: 20, paddingBottom: 10 },962 chips: { overflow: 'hidden' },963 chipsContent: { paddingHorizontal: 20, gap: 8 },964 headerRule: { height: 1 },965 searchField: { flex: 1, height: 48, borderRadius: 16, borderWidth: 1.5, flexDirection: 'row', alignItems: 'center', paddingLeft: 13, paddingRight: 9, gap: 9 },966 searchInput: { flex: 1, minWidth: 0, height: '100%', fontSize: 16, fontWeight: '500', paddingVertical: 0 },967 clearButton: { width: 26, height: 26, borderRadius: 13, alignItems: 'center', justifyContent: 'center' },968 filterButton: { width: 48, height: 48, borderRadius: 16, alignItems: 'center', justifyContent: 'center' },969 countBadgeSlot: { position: 'absolute', top: -5, right: -5 },970 countBadge: { minWidth: 21, height: 21, borderRadius: 11, paddingHorizontal: 4, borderWidth: 2, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' },971 countBadgeText: { color: ON_ACCENT, fontSize: 11, fontWeight: '800', lineHeight: 14 },972973 // Pills and photos974 pill: { height: 38, paddingHorizontal: 15, borderRadius: 19, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 4 },975 pillGrow: { flex: 1, paddingHorizontal: 4 },976 pillFill: { borderRadius: 19 },977 pillLabel: { fontSize: 14.5, fontWeight: '600' },978 photo: { overflow: 'hidden' },979 photoPlaceholder: { backgroundColor: '#FFFFFF' },980 photoFrame: { position: 'absolute' },981982 // Before you type983 discover: { paddingHorizontal: 20, paddingTop: 10, paddingBottom: 24 },984 sectionTitle: { height: 30, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },985 sectionTitleText: { fontSize: 18, fontWeight: '700', letterSpacing: -0.4 },986 clearAll: { fontSize: 14, fontWeight: '600' },987 recentRow: { height: 50, flexDirection: 'row', alignItems: 'center' },988 recentPick: { flex: 1, height: '100%', flexDirection: 'row', alignItems: 'center', gap: 12 },989 recentIcon: { width: 34, height: 34, borderRadius: 17, alignItems: 'center', justifyContent: 'center' },990 recentTerm: { flex: 1, fontSize: 16 },991 recentRemove: { width: 34, height: 34, marginRight: -8, alignItems: 'center', justifyContent: 'center' },992 trending: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, marginTop: 10 },993 trendChip: { height: 38, paddingHorizontal: 15, borderRadius: 19, justifyContent: 'center' },994 chipLabel: { fontSize: 14.5, fontWeight: '600' },995 categorySection: { marginTop: 26 },996 categoryGrid: { flexDirection: 'row', flexWrap: 'wrap', gap: 12, marginTop: 10 },997 categoryTile: { padding: 8, borderRadius: 20, flexDirection: 'row', alignItems: 'center', gap: 11 },998 categoryPhoto: { borderRadius: 14, overflow: 'hidden' },999 categoryName: { fontSize: 15, fontWeight: '600', letterSpacing: -0.2 },1000 categoryCount: { fontSize: 12.5, marginTop: 1 },10011002 // Results1003 listContent: { flexGrow: 1 },1004 results: { paddingHorizontal: 20, paddingBottom: 20 },1005 resultsHead: { height: 40, flexDirection: 'row', alignItems: 'center', gap: 12 },1006 resultsCount: { flex: 1, flexDirection: 'row', alignItems: 'baseline', gap: 4 },1007 resultsTotal: { fontSize: 14.5, fontWeight: '700' },1008 resultsFor: { flexShrink: 1, fontSize: 14.5 },1009 sort: { flexDirection: 'row', alignItems: 'center', gap: 5, height: 30 },1010 sortLabel: { fontSize: 14, fontWeight: '600' },1011 resultRow: { flexDirection: 'row', alignItems: 'center', gap: 14, paddingVertical: 9 },1012 resultPhoto: { borderRadius: 20, overflow: 'hidden' },1013 soldOutVeil: { opacity: 0.5 },1014 resultHairline: { borderRadius: 20, borderWidth: 1 },1015 resultName: { fontSize: 16, fontWeight: '500', letterSpacing: -0.2, paddingRight: 30 },1016 resultHit: { fontWeight: '800', borderRadius: 4 },1017 resultMeta: { fontSize: 13.5, marginTop: 2, paddingRight: 30 },1018 resultRating: { flexDirection: 'row', alignItems: 'center', gap: 4, marginTop: 7 },1019 ratingValue: { fontSize: 13, fontWeight: '600' },1020 ratingCount: { fontSize: 13 },1021 shipping: { flexDirection: 'row', alignItems: 'center', gap: 4, marginLeft: 6 },1022 priceRow: { height: 22, flexDirection: 'row', alignItems: 'center', gap: 7, marginTop: 6 },1023 price: { fontSize: 17, fontWeight: '700', letterSpacing: -0.3 },1024 was: { fontSize: 13.5, textDecorationLine: 'line-through' },1025 offTag: { height: 20, paddingHorizontal: 6, borderRadius: 6, justifyContent: 'center' },1026 offText: { fontSize: 11.5, fontWeight: '700' },1027 soldOut: { height: 22, paddingHorizontal: 8, borderRadius: 11, justifyContent: 'center' },1028 soldOutText: { fontSize: 11.5, fontWeight: '600' },1029 saveButton: { position: 'absolute', top: 5, right: -8, width: 36, height: 36, alignItems: 'center', justifyContent: 'center' },10301031 // Empty state1032 empty: { alignItems: 'center', paddingHorizontal: 16, paddingTop: 44, paddingBottom: 24 },1033 emptyIcon: { width: 72, height: 72, borderRadius: 36, alignItems: 'center', justifyContent: 'center' },1034 emptyTitle: { fontSize: 20, fontWeight: '700', letterSpacing: -0.4, textAlign: 'center', marginTop: 18 },1035 emptyBody: { fontSize: 15, lineHeight: 21, textAlign: 'center', marginTop: 6 },1036 emptyAction: { marginTop: 18 },1037 clearFilters: { height: 46, paddingHorizontal: 22, borderRadius: 23, justifyContent: 'center' },1038 emptyLink: { fontSize: 15, fontWeight: '700' },1039 clearSearch: { marginTop: 16 },1040 ideas: { flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'center', gap: 8, marginTop: 26 },1041 ideaChip: { height: 38, paddingLeft: 12, paddingRight: 15, borderRadius: 19, flexDirection: 'row', alignItems: 'center', gap: 6 },10421043 // Filter sheet1044 sheetLayer: { zIndex: 10 },1045 sheet: { position: 'absolute', left: 0, right: 0, bottom: 0, borderTopLeftRadius: 30, borderTopRightRadius: 30 },1046 grabberSlot: { alignItems: 'center', paddingTop: 9 },1047 grabber: { width: 38, height: 5, borderRadius: 3 },1048 sheetHeader: { height: 50, paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },1049 sheetTitle: { fontSize: 22, fontWeight: '800', letterSpacing: -0.7 },1050 sheetClose: { width: 34, height: 34, borderRadius: 17, alignItems: 'center', justifyContent: 'center' },1051 sheetScroll: { flexShrink: 1 },1052 sheetContent: { paddingHorizontal: 20, paddingBottom: 6 },1053 sheetBody: { marginTop: -14 },1054 sheetSection: { marginTop: 20 },1055 sheetSectionHead: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', marginBottom: 10 },1056 sheetSectionTitle: { fontSize: 15, fontWeight: '700', letterSpacing: -0.2 },1057 sheetSectionHint: { fontSize: 13.5 },1058 priceRowPills: { flexDirection: 'row', gap: 8 },1059 categoryPills: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },1060 stars: { flexDirection: 'row', gap: 10 },1061 toggles: { marginTop: 14, borderTopWidth: 1, paddingTop: 4 },1062 toggle: { height: 54, flexDirection: 'row', alignItems: 'center' },1063 toggleLabel: { fontSize: 16, fontWeight: '500' },1064 toggleHint: { fontSize: 13, marginTop: 1 },1065 toggleTrack: { width: 50, height: 30, borderRadius: 15, padding: 3 },1066 toggleThumb: { width: 24, height: 24, borderRadius: 12, shadowColor: '#000', shadowOpacity: 0.18, shadowRadius: 3, shadowOffset: { width: 0, height: 1 } },1067 sheetFooter: { flexDirection: 'row', gap: 10, paddingHorizontal: 20, paddingTop: 12 },1068 reset: { height: 54, paddingHorizontal: 24, borderRadius: 18, justifyContent: 'center' },1069 resetLabel: { fontSize: 16, fontWeight: '600' },1070 apply: { height: 54, borderRadius: 18, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' },1071 applyLabel: { color: ON_ACCENT, fontSize: 16, fontWeight: '700' },10721073 // Tab bar1074 tabBar: { borderTopWidth: 1, flexDirection: 'row' },1075 tab: { flex: 1, height: TAB_H, alignItems: 'center', justifyContent: 'center', gap: 4 },1076 bagBadge: { position: 'absolute', top: -6, right: -8, minWidth: 19, height: 19, borderRadius: 10, paddingHorizontal: 4, borderWidth: 2, alignItems: 'center', justifyContent: 'center' },1077 bagBadgeText: { color: ON_ACCENT, fontSize: 10, fontWeight: '800', lineHeight: 13 },1078 tabLabel: { fontSize: 10.5 },1079});