Topic picker where each icon chip fills with its own colour, pops and grows a corner check when tapped, with a step bar that fills on load and a staggered chip entrance. A rolling counter and three goal slots track the minimum of three picks, Surprise me deals three topics one after another, and the Continue button floods with colour once the goal is met, then runs spinner to tick.

Details
1import { useEffect, useRef, useState } from 'react';2import { Pressable, StyleSheet, Text, View, useColorScheme, useWindowDimensions, type LayoutChangeEvent } from 'react-native';3import Animated, {4 Easing,5 FadeIn,6 FadeInDown,7 ZoomIn,8 interpolate,9 interpolateColor,10 useAnimatedScrollHandler,11 useAnimatedStyle,12 useSharedValue,13 withDelay,14 withRepeat,15 withSequence,16 withSpring,17 withTiming,18} from 'react-native-reanimated';19import { useSafeAreaInsets } from 'react-native-safe-area-context';20import {21 ArrowRight,22 BookOpen,23 Camera,24 Check,25 ChefHat,26 ChevronLeft,27 Clapperboard,28 Coffee,29 Cpu,30 Dices,31 Dumbbell,32 FlaskConical,33 Gamepad2,34 Leaf,35 Mic,36 Music,37 Palette,38 PenTool,39 Plane,40 Rocket,41 Shirt,42 TrendingUp,43 type LucideIcon,44} from 'lucide-react-native';4546// ─── Brand ──────────────────────────────────────────────────────────────────47// The screen's accent. Every accent colour below derives from these, so changing them rebrands the screen.48// The topic chips keep their own colours: those belong to the topics, not to the brand.4950const ACCENT = '#1064FF';51const ACCENT_DARK = '#3B82F6';52const ON_ACCENT = '#FFFFFF'; // text and icons on an accent fill5354/** `hex` at `alpha` opacity, as rgba(). */55function tint(hex: string, alpha: number) {56 const n = parseInt(hex.slice(1), 16);57 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;58}5960/** `hex` mixed toward black (amount > 0) or white (amount < 0); amount from -1 to 1. */61function spin(hex: string, deg: number, light = 0, sat = 0) {62 const n = parseInt(hex.slice(1), 16);63 const r = ((n >> 16) & 255) / 255;64 const g = ((n >> 8) & 255) / 255;65 const b = (n & 255) / 255;66 const max = Math.max(r, g, b);67 const min = Math.min(r, g, b);68 const d = max - min;69 const s = Math.min(1, Math.max(0, (d === 0 ? 0 : d / (1 - Math.abs(max + min - 1))) + sat));70 const l = Math.min(1, Math.max(0, (max + min) / 2 + light));71 const h0 = d === 0 ? 0 : max === r ? ((g - b) / d + 6) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;72 const h = (((h0 * 60 + deg) % 360) + 360) % 360;73 const a = s * Math.min(l, 1 - l);74 const f = (m: number) => {75 const k = (m + h / 30) % 12;76 return Math.round(255 * (l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)))).toString(16).padStart(2, '0');77 };78 return `#${f(0)}${f(8)}${f(4)}`.toUpperCase();79}8081// ─── Sample data ────────────────────────────────────────────────────────────8283const STEP = { current: 2, total: 4 };84const MIN_PICKS = 3;8586// `color` fills the selected chip (white text passes on all of them) and tints the icon in light mode.87// `glow` tints the icon and the goal dots in dark mode; `colorDark` lifts the two fills that sink into black.88type Topic = { id: string; label: string; icon: LucideIcon; color: string; glow: string; colorDark?: string };8990const TOPICS: Topic[] = [91 { id: 'design', label: 'Design', icon: PenTool, color: '#DB2777', glow: '#F472B6' },92 { id: 'travel', label: 'Travel', icon: Plane, color: '#0379B8', glow: '#38BDF8' },93 { id: 'cooking', label: 'Cooking', icon: ChefHat, color: '#B45309', glow: '#FBBF24' },94 { id: 'photography', label: 'Photography', icon: Camera, color: '#475569', glow: '#94A3B8', colorDark: '#5A6B85' },95 { id: 'film', label: 'Film', icon: Clapperboard, color: '#9333EA', glow: '#C084FC' },96 { id: 'art', label: 'Art', icon: Palette, color: '#E11D48', glow: '#FB7185' },97 { id: 'gaming', label: 'Gaming', icon: Gamepad2, color: '#15803D', glow: '#4ADE80' },98 { id: 'fitness', label: 'Fitness', icon: Dumbbell, color: '#DC2626', glow: '#F87171' },99 { id: 'music', label: 'Music', icon: Music, color: '#B02BC4', glow: '#E879F9' },100 { id: 'books', label: 'Books', icon: BookOpen, color: '#0D8479', glow: '#2DD4BF' },101 { id: 'science', label: 'Science', icon: FlaskConical, color: '#0B7C99', glow: '#22D3EE' },102 { id: 'fashion', label: 'Fashion', icon: Shirt, color: '#A16207', glow: '#FACC15' },103 { id: 'podcasts', label: 'Podcasts', icon: Mic, color: '#D4460F', glow: '#FB923C' },104 { id: 'tech', label: 'Tech', icon: Cpu, color: '#2563EB', glow: '#60A5FA' },105 { id: 'finance', label: 'Finance', icon: TrendingUp, color: '#047857', glow: '#34D399' },106 { id: 'nature', label: 'Nature', icon: Leaf, color: '#4D7C0F', glow: '#A3E635' },107 { id: 'space', label: 'Space', icon: Rocket, color: '#1E40AF', glow: '#93C5FD', colorDark: '#2F55D4' },108 { id: 'coffee', label: 'Coffee', icon: Coffee, color: '#8B5A2B', glow: '#D6A56F' },109];110111const INITIAL_PICKS = ['travel', 'music', 'podcasts'];112113// "Surprise me" walks this fixed order, so the same taps always give the same picks.114const SURPRISE_ORDER = ['science', 'film', 'coffee', 'gaming', 'tech', 'design', 'nature', 'fitness', 'books', 'art', 'space', 'finance', 'photography', 'fashion', 'cooking', 'podcasts', 'music', 'travel'];115116// ─── Palette ────────────────────────────────────────────────────────────────117118const SPRING = { damping: 16, stiffness: 220, mass: 0.7 };119const TABULAR = { fontVariant: ['tabular-nums' as const] };120121function usePalette() {122 const dark = useColorScheme() === 'dark';123 return {124 dark,125 bg: dark ? '#09090B' : '#F6F6F8',126 fg: dark ? '#FAFAFA' : '#0B0B0F',127 muted: dark ? '#9A9AA3' : '#6B6B76',128 line: dark ? '#222227' : '#E4E4EA',129 track: dark ? '#26262C' : '#E2E2E9',130 chip: dark ? '#16161A' : '#FFFFFF',131 chipLine: dark ? '#2A2A30' : '#E3E3E9',132 accent: dark ? ACCENT_DARK : ACCENT,133 accentText: dark ? spin(ACCENT_DARK, 3.5, 0.151, 0.088) : spin(ACCENT, 1.5, -0.083, -0.1),134 accentSoft: dark ? tint(ACCENT_DARK, 0.18) : tint(ACCENT, 0.1),135 buttonOff: dark ? '#1C1C21' : '#E5E5EB',136 buttonOffFg: dark ? '#6C6C76' : '#9696A2',137 // Alpha suffix for the coloured glow under a picked chip, and the ready button's glow opacity.138 chipGlowAlpha: dark ? '80' : '59',139 buttonGlowAlpha: dark ? 0.45 : 0.38,140 };141}142143// ─── Layout ─────────────────────────────────────────────────────────────────144145const HEADER_H = 52;146const CHIP_H = 46;147const ROW_GAP = 12;148const BUTTON_H = 56;149const ROLL_H = 22;150151// ─── Header: the current step's segment fills on load ───────────────────────152153function StepBar() {154 const c = usePalette();155 const fill = useSharedValue(0);156 useEffect(() => {157 fill.value = withDelay(220, withTiming(1, { duration: 620, easing: Easing.out(Easing.cubic) }));158 }, [fill]);159 const style = useAnimatedStyle(() => ({ width: `${fill.value * 100}%` }));160 return (161 <View162 role="progressbar"163 aria-label={`Step ${STEP.current} of ${STEP.total}`}164 aria-valuemin={1}165 aria-valuemax={STEP.total}166 aria-valuenow={STEP.current}167 style={styles.steps}168 >169 {Array.from({ length: STEP.total }, (_, i) => (170 <View key={i} style={[styles.stepTrack, { backgroundColor: c.track }]}>171 {i < STEP.current - 1 ? <View style={[styles.fill, { backgroundColor: c.accent }]} /> : null}172 {i === STEP.current - 1 ? <Animated.View style={[styles.stepFill, { backgroundColor: c.accent }, style]} /> : null}173 </View>174 ))}175 </View>176 );177}178179// ─── Topic chip: fills with its colour, pops, and grows a check ─────────────180181function TopicChip({ topic, index, selected, onToggle }: { topic: Topic; index: number; selected: boolean; onToggle: () => void }) {182 const c = usePalette();183 const fill = c.dark ? (topic.colorDark ?? topic.color) : topic.color;184 const tint = c.dark ? topic.glow : topic.color;185 const Icon = topic.icon;186187 const on = useSharedValue(selected ? 1 : 0);188 const tick = useSharedValue(selected ? 1 : 0);189 const pop = useSharedValue(1);190 const press = useSharedValue(1);191 const was = useRef(selected);192193 useEffect(() => {194 if (was.current === selected) return;195 was.current = selected;196 on.value = withTiming(selected ? 1 : 0, { duration: selected ? 200 : 170, easing: Easing.out(Easing.cubic) });197 tick.value = selected ? withDelay(90, withTiming(1, { duration: 300, easing: Easing.out(Easing.back(3)) })) : withTiming(0, { duration: 120 });198 pop.value = selected199 ? withSequence(withTiming(0.9, { duration: 70 }), withTiming(1, { duration: 380, easing: Easing.out(Easing.back(4.5)) }))200 : withSequence(withTiming(0.95, { duration: 70 }), withTiming(1, { duration: 200, easing: Easing.out(Easing.cubic) }));201 }, [selected, on, tick, pop]);202203 const body = useAnimatedStyle(() => ({204 backgroundColor: interpolateColor(on.value, [0, 1], [c.chip, fill]),205 borderColor: interpolateColor(on.value, [0, 1], [c.chipLine, fill]),206 }));207 const shell = useAnimatedStyle(() => ({ transform: [{ scale: pop.value * press.value }] }));208 const glow = useAnimatedStyle(() => ({ opacity: on.value }));209 const label = useAnimatedStyle(() => ({ color: interpolateColor(on.value, [0, 1], [c.fg, '#FFFFFF']) }));210 const iconOff = useAnimatedStyle(() => ({ opacity: 1 - on.value }));211 const iconOn = useAnimatedStyle(() => ({ opacity: on.value }));212 const badge = useAnimatedStyle(() => ({ opacity: Math.min(1, tick.value * 2), transform: [{ scale: tick.value }] }));213214 return (215 <Animated.View entering={ZoomIn.delay(160 + index * 30).duration(280)} style={styles.chipSlot}>216 <Pressable217 role="checkbox"218 aria-checked={selected}219 aria-label={topic.label}220 onPress={onToggle}221 onPressIn={() => (press.value = withSpring(0.94, SPRING))}222 onPressOut={() => (press.value = withSpring(1, SPRING))}223 >224 <Animated.View style={shell}>225 {/* A glow in the chip's own colour, faded in with the fill */}226 <Animated.View style={[StyleSheet.absoluteFill, styles.chipGlow, { boxShadow: `0px 6px 14px ${fill}${c.chipGlowAlpha}` }, glow]} />227 <Animated.View style={[styles.chip, body]}>228 <View style={styles.chipIcon}>229 <Animated.View style={[StyleSheet.absoluteFill, iconOff]}>230 <Icon size={18} color={tint} strokeWidth={2.2} />231 </Animated.View>232 <Animated.View style={[StyleSheet.absoluteFill, iconOn]}>233 <Icon size={18} color="#FFFFFF" strokeWidth={2.2} />234 </Animated.View>235 </View>236 <Animated.Text style={[styles.chipLabel, label]}>{topic.label}</Animated.Text>237 </Animated.View>238 {/* The check sits on the corner so the chip never changes width and the cloud never reflows */}239 <Animated.View240 pointerEvents="none"241 style={[styles.badge, { borderColor: c.bg }, badge]}242 >243 <Check size={11} color={fill} strokeWidth={4} />244 </Animated.View>245 </Animated.View>246 </Pressable>247 </Animated.View>248 );249}250251// ─── Counter: a strip of numbers that rolls to the current one ──────────────252253function RollingNumber({ value, max, color }: { value: number; max: number; color: string }) {254 const y = useSharedValue(-value * ROLL_H);255 useEffect(() => {256 y.value = withTiming(-value * ROLL_H, { duration: 340, easing: Easing.out(Easing.cubic) });257 }, [value, y]);258 const strip = useAnimatedStyle(() => ({ transform: [{ translateY: y.value }] }));259 const digit = [styles.digit, { color }, TABULAR];260 return (261 <View style={styles.roll}>262 {/* An invisible copy sets the width */}263 <Text style={[digit, styles.invisible]}>{value}</Text>264 <Animated.View style={[styles.rollStrip, strip]}>265 {Array.from({ length: max + 1 }, (_, n) => (266 <Text key={n} style={digit}>267 {n}268 </Text>269 ))}270 </Animated.View>271 </View>272 );273}274275// ─── Goal: three slots, each filled in the colour of the pick that earned it ─276277function GoalSlot({ color }: { color?: string }) {278 const c = usePalette();279 const filled = color !== undefined;280 // Keep the last colour while the fill drains.281 const [shown, setShown] = useState(color);282 if (color !== undefined && color !== shown) setShown(color);283 const fill = useSharedValue(filled ? 1 : 0);284 const pop = useSharedValue(1);285 const was = useRef(filled);286 useEffect(() => {287 if (was.current === filled) return;288 was.current = filled;289 fill.value = withTiming(filled ? 1 : 0, { duration: filled ? 280 : 180, easing: Easing.out(Easing.cubic) });290 if (filled) pop.value = withSequence(withTiming(1.35, { duration: 130 }), withTiming(1, { duration: 300, easing: Easing.out(Easing.back(3)) }));291 }, [filled, fill, pop]);292 const slot = useAnimatedStyle(() => ({ transform: [{ scale: pop.value }] }));293 const bar = useAnimatedStyle(() => ({ width: `${fill.value * 100}%` }));294 return (295 <Animated.View style={[styles.goalSlot, { backgroundColor: c.track }, slot]}>296 <Animated.View style={[styles.goalFill, { backgroundColor: shown }, bar]} />297 </Animated.View>298 );299}300301// ─── Continue: muted until the goal is met, then floods with colour ─────────302303type Status = 'idle' | 'loading' | 'done';304305function Spinner() {306 const r = useSharedValue(0);307 useEffect(() => {308 r.value = withRepeat(withTiming(360, { duration: 800, easing: Easing.linear }), -1);309 }, [r]);310 const style = useAnimatedStyle(() => ({ transform: [{ rotate: `${r.value}deg` }] }));311 return <Animated.View style={[styles.spinner, style]} />;312}313314function ContinueButton({ ready, status, width, hint, onPress }: { ready: boolean; status: Status; width: number; hint: string; onPress: () => void }) {315 const c = usePalette();316 const on = useSharedValue(ready ? 1 : 0);317 const bounce = useSharedValue(1);318 const press = useSharedValue(1);319 const was = useRef(ready);320321 useEffect(() => {322 if (was.current === ready) return;323 was.current = ready;324 on.value = withTiming(ready ? 1 : 0, { duration: ready ? 460 : 220, easing: Easing.out(Easing.cubic) });325 if (ready) bounce.value = withSequence(withTiming(1.04, { duration: 160, easing: Easing.out(Easing.quad) }), withTiming(1, { duration: 340, easing: Easing.out(Easing.back(3)) }));326 }, [ready, on, bounce]);327328 // A circle of the accent colour grows from the centre until it covers the pill.329 const flood = Math.ceil(Math.hypot(width, BUTTON_H)) + 4;330 const shell = useAnimatedStyle(() => ({ transform: [{ scale: bounce.value * press.value }] }));331 const glow = useAnimatedStyle(() => ({ opacity: on.value }));332 const ink = useAnimatedStyle(() => ({ transform: [{ scale: on.value }] }));333 const label = useAnimatedStyle(() => ({ color: interpolateColor(on.value, [0, 1], [c.buttonOffFg, ON_ACCENT]) }));334 const arrow = useAnimatedStyle(() => ({ width: on.value * 26, opacity: on.value }));335336 return (337 <Pressable338 role="button"339 aria-label={status === 'done' ? 'Interests saved' : ready ? 'Continue' : `Continue, ${hint} first`}340 aria-busy={status === 'loading'}341 onPress={onPress}342 onPressIn={() => (press.value = withSpring(ready ? 0.97 : 0.985, SPRING))}343 onPressOut={() => (press.value = withSpring(1, SPRING))}344 >345 <Animated.View style={[styles.button, shell]}>346 <Animated.View style={[StyleSheet.absoluteFill, styles.buttonGlow, { boxShadow: `0px 10px 22px ${tint(c.accent, c.buttonGlowAlpha)}` }, glow]} />347 <View style={[styles.buttonBody, { backgroundColor: c.buttonOff }]}>348 <Animated.View349 style={[styles.flood, { left: (width - flood) / 2, top: (BUTTON_H - flood) / 2, width: flood, height: flood, borderRadius: flood / 2, backgroundColor: c.accent }, ink]}350 />351 {status === 'idle' && (352 <Animated.View entering={FadeIn.duration(160)} style={styles.buttonRow}>353 <Animated.Text style={[styles.buttonLabel, label]}>Continue</Animated.Text>354 <Animated.View style={[styles.arrow, arrow]}>355 <ArrowRight size={19} color={ON_ACCENT} strokeWidth={2.6} />356 </Animated.View>357 </Animated.View>358 )}359 {status === 'loading' && <Spinner />}360 {status === 'done' && (361 <Animated.View entering={ZoomIn.springify().damping(12)} style={styles.doneRow}>362 <Check size={20} color={ON_ACCENT} strokeWidth={3} />363 <Text style={[styles.buttonLabel, styles.doneLabel]}>Feed tuned</Text>364 </Animated.View>365 )}366 </View>367 </Animated.View>368 </Pressable>369 );370}371372// ─── Screen ─────────────────────────────────────────────────────────────────373374export default function PickInterestsScreen() {375 const c = usePalette();376 const insets = useSafeAreaInsets();377 const { width } = useWindowDimensions();378 const [selected, setSelected] = useState<string[]>(INITIAL_PICKS);379 const [status, setStatus] = useState<Status>('idle');380 const [dealing, setDealing] = useState(false);381 const [barHeight, setBarHeight] = useState(BUTTON_H + 62 + insets.bottom);382383 const count = selected.length;384 const remaining = Math.max(0, MIN_PICKS - count);385 const ready = remaining === 0;386 const allPicked = count === TOPICS.length;387 const locked = status !== 'idle';388389 // Every delayed step goes through here so nothing fires after the screen is gone.390 const timers = useRef<ReturnType<typeof setTimeout>[]>([]);391 const later = (fn: () => void, ms: number) => timers.current.push(setTimeout(fn, ms));392 const cancelAll = () => {393 timers.current.forEach(clearTimeout);394 timers.current = [];395 };396 useEffect(() => cancelAll, []);397398 const toggle = (id: string) => {399 if (locked) return;400 setSelected((now) => (now.includes(id) ? now.filter((x) => x !== id) : [...now, id]));401 };402403 // Pick the next three unselected topics from the fixed order, one after another.404 const cursor = useRef(0);405 const dice = useSharedValue(0);406 const surprise = () => {407 if (locked || dealing || allPicked) return;408 const picks: string[] = [];409 let i = cursor.current;410 for (let seen = 0; seen < SURPRISE_ORDER.length && picks.length < 3; seen++, i++) {411 const id = SURPRISE_ORDER[i % SURPRISE_ORDER.length];412 if (!selected.includes(id)) picks.push(id);413 }414 cursor.current = i % SURPRISE_ORDER.length;415 dice.value = withTiming(dice.value + 360, { duration: 620, easing: Easing.out(Easing.cubic) });416 setDealing(true);417 picks.forEach((id, n) => later(() => setSelected((now) => (now.includes(id) ? now : [...now, id])), 60 + n * 170));418 later(() => setDealing(false), 60 + picks.length * 170);419 };420421 const clear = () => {422 if (locked) return;423 cancelAll();424 setDealing(false);425 setSelected([]);426 };427428 // Pressing Continue too early nudges the counter instead of doing nothing.429 const nudge = useSharedValue(0);430 const submit = () => {431 if (locked) return;432 if (!ready) {433 nudge.value = withSequence(434 withTiming(-7, { duration: 50 }),435 withTiming(7, { duration: 60 }),436 withTiming(-4, { duration: 60 }),437 withTiming(4, { duration: 60 }),438 withTiming(0, { duration: 50 })439 );440 return;441 }442 setStatus('loading');443 // Replace with saving the picks and moving to step 3.444 later(() => {445 setStatus('done');446 later(() => setStatus('idle'), 2000);447 }, 1000);448 };449450 const scrollY = useSharedValue(0);451 const onScroll = useAnimatedScrollHandler((e) => {452 scrollY.value = e.contentOffset.y;453 });454 const headerLine = useAnimatedStyle(() => ({ opacity: interpolate(scrollY.value, [0, 14], [0, 1], 'clamp') }));455 const nudgeStyle = useAnimatedStyle(() => ({ transform: [{ translateX: nudge.value }] }));456 const diceStyle = useAnimatedStyle(() => ({ transform: [{ rotate: `${dice.value}deg` }] }));457458 const clearOn = useSharedValue(count > 0 ? 1 : 0);459 useEffect(() => {460 clearOn.value = withTiming(count > 0 ? 1 : 0, { duration: 180 });461 }, [count, clearOn]);462 const clearStyle = useAnimatedStyle(() => ({ opacity: clearOn.value, transform: [{ translateX: (1 - clearOn.value) * 6 }] }));463464 const goal = selected.slice(0, MIN_PICKS).map((id) => {465 const topic = TOPICS.find((t) => t.id === id)!;466 return c.dark ? topic.glow : topic.color;467 });468 const counter = ready ? `${count} selected` : `Pick ${remaining} more`;469 const words = [styles.words, { color: c.fg }];470471 return (472 <View style={[styles.screen, { backgroundColor: c.bg }]}>473 <Animated.ScrollView474 onScroll={onScroll}475 scrollEventThrottle={16}476 showsVerticalScrollIndicator={false}477 contentContainerStyle={[styles.content, { paddingTop: insets.top + HEADER_H + 18, paddingBottom: barHeight + 24 }]}478 >479 <Animated.Text entering={FadeInDown.duration(420)} style={[styles.eyebrow, { color: c.accentText }]}>480 {`STEP ${STEP.current} OF ${STEP.total}`}481 </Animated.Text>482 <Animated.Text483 entering={FadeInDown.delay(50).duration(420)}484 role="heading"485 style={[styles.title, { color: c.fg }]}486 >487 What are you into?488 </Animated.Text>489 <Animated.Text entering={FadeInDown.delay(100).duration(420)} style={[styles.subtitle, { color: c.muted }]}>490 Pick at least three and we'll tune your feed.491 </Animated.Text>492493 {/* Shortcuts */}494 <Animated.View entering={FadeIn.delay(180).duration(400)} style={styles.shortcuts}>495 <Pressable496 role="button"497 aria-label="Surprise me"498 disabled={allPicked}499 onPress={surprise}500 hitSlop={4}501 style={({ pressed }) => [styles.surprise, { backgroundColor: c.accentSoft, opacity: allPicked ? 0.4 : pressed ? 0.7 : 1 }]}502 >503 <Animated.View style={diceStyle}>504 <Dices size={17} color={c.accentText} strokeWidth={2.2} />505 </Animated.View>506 <Text style={[styles.surpriseLabel, { color: c.accentText }]}>Surprise me</Text>507 </Pressable>508 <Animated.View style={clearStyle} pointerEvents={count > 0 ? 'auto' : 'none'}>509 <Pressable510 role="button"511 aria-label="Clear all picks"512 aria-hidden={count === 0}513 disabled={count === 0}514 onPress={clear}515 hitSlop={8}516 style={({ pressed }) => [styles.clear, { opacity: pressed ? 0.5 : 1 }]}517 >518 <Text style={[styles.clearLabel, { color: c.muted }]}>Clear</Text>519 </Pressable>520 </Animated.View>521 </Animated.View>522523 {/* Topic cloud */}524 <View role="group" aria-label="Topics" style={styles.cloud}>525 {TOPICS.map((topic, i) => (526 <TopicChip key={topic.id} topic={topic} index={i} selected={selected.includes(topic.id)} onToggle={() => toggle(topic.id)} />527 ))}528 {/* Chips stretch so rows end flush. This spacer soaks up the slack when the last row is short, and wraps away when it is nearly full. */}529 <View style={styles.cloudSpacer} />530 </View>531532 <Animated.Text entering={FadeIn.delay(700).duration(400)} style={[styles.footnote, { color: c.muted }]}>533 You can change these anytime in Settings.534 </Animated.Text>535 </Animated.ScrollView>536537 {/* Header: opaque, runs under the status bar */}538 <View style={[styles.header, { paddingTop: insets.top, backgroundColor: c.bg }]}>539 <Animated.View entering={FadeIn.duration(400)} style={styles.headerBar}>540 <Pressable541 role="button"542 aria-label="Back"543 hitSlop={6}544 style={({ pressed }) => [styles.back, { backgroundColor: c.chip, borderColor: c.chipLine, opacity: pressed ? 0.6 : 1 }]}545 >546 <ChevronLeft size={21} color={c.fg} strokeWidth={2.4} style={styles.backIcon} />547 </Pressable>548 <StepBar />549 <Pressable role="button" aria-label="Skip this step" hitSlop={10} style={({ pressed }) => [styles.skip, { opacity: pressed ? 0.5 : 1 }]}>550 <Text style={[styles.skipLabel, { color: c.muted }]}>Skip</Text>551 </Pressable>552 </Animated.View>553 <Animated.View style={[styles.hairline, { backgroundColor: c.line }, headerLine]} />554 </View>555556 {/* Bottom bar: opaque, sits above the home indicator */}557 <View558 onLayout={(e: LayoutChangeEvent) => setBarHeight(e.nativeEvent.layout.height)}559 style={[styles.bottomBar, { paddingBottom: insets.bottom + 10, backgroundColor: c.bg, borderTopColor: c.line }]}560 >561 <Animated.View style={[styles.status, nudgeStyle]}>562 <View aria-live="polite" aria-label={counter} style={styles.counter}>563 {ready ? null : <Text style={words}>Pick </Text>}564 <RollingNumber value={ready ? count : remaining} max={TOPICS.length} color={c.fg} />565 <Text style={words}>{ready ? ' selected' : ' more'}</Text>566 </View>567 <View aria-hidden style={styles.goal}>568 {Array.from({ length: MIN_PICKS }, (_, i) => (569 <GoalSlot key={i} color={goal[i]} />570 ))}571 </View>572 </Animated.View>573 <View style={styles.buttonSlot}>574 <ContinueButton ready={ready} status={status} width={width - 40} hint={counter.toLowerCase()} onPress={submit} />575 </View>576 </View>577 </View>578 );579}580581// ─── Styles ─────────────────────────────────────────────────────────────────582583const styles = StyleSheet.create({584 screen: { flex: 1 },585 content: { paddingHorizontal: 20 },586 fill: { flex: 1 },587588 // Header589 header: { position: 'absolute', top: 0, left: 0, right: 0 },590 headerBar: { height: HEADER_H, paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center', gap: 14 },591 back: { width: 38, height: 38, borderRadius: 19, alignItems: 'center', justifyContent: 'center', borderWidth: 1 },592 backIcon: { marginLeft: -1 },593 steps: { flex: 1, flexDirection: 'row', gap: 5 },594 stepTrack: { flex: 1, height: 5, borderRadius: 3, overflow: 'hidden' },595 stepFill: { height: 5, borderRadius: 3 },596 skip: { height: 38, justifyContent: 'center' },597 skipLabel: { fontSize: 15, fontWeight: '600' },598 hairline: { height: 1 },599600 // Intro601 eyebrow: { fontSize: 12, fontWeight: '700', letterSpacing: 1.3 },602 title: { marginTop: 8, fontSize: 34, lineHeight: 40, fontWeight: '800', letterSpacing: -1.1 },603 subtitle: { marginTop: 8, fontSize: 16, lineHeight: 23 },604 shortcuts: { marginTop: 22, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },605 surprise: { height: 36, paddingLeft: 11, paddingRight: 14, borderRadius: 18, flexDirection: 'row', alignItems: 'center', gap: 7 },606 surpriseLabel: { fontSize: 14, fontWeight: '700' },607 clear: { height: 36, paddingHorizontal: 4, justifyContent: 'center' },608 clearLabel: { fontSize: 14, fontWeight: '600' },609610 // Topic cloud611 cloud: { marginTop: 18, marginBottom: -ROW_GAP, flexDirection: 'row', flexWrap: 'wrap', columnGap: 8 },612 cloudSpacer: { flexGrow: 1000, flexBasis: 72, height: 0 },613 chipSlot: { flexGrow: 1, marginBottom: ROW_GAP },614 chipGlow: { borderRadius: CHIP_H / 2 },615 chip: { height: CHIP_H, borderRadius: CHIP_H / 2, borderWidth: 1.5, paddingLeft: 13, paddingRight: 16, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 },616 chipIcon: { width: 18, height: 18 },617 chipLabel: { fontSize: 15, fontWeight: '600', letterSpacing: -0.1 },618 badge: {619 position: 'absolute',620 top: -6,621 right: -4,622 width: 22,623 height: 22,624 borderRadius: 11,625 borderWidth: 2.5,626 backgroundColor: '#FFFFFF',627 alignItems: 'center',628 justifyContent: 'center',629 boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.16)',630 },631 footnote: { marginTop: 22, fontSize: 13, lineHeight: 18 },632633 // Bottom bar634 bottomBar: { position: 'absolute', left: 0, right: 0, bottom: 0, paddingHorizontal: 20, paddingTop: 14, borderTopWidth: 1 },635 status: { height: ROLL_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },636 counter: { flexDirection: 'row', alignItems: 'center' },637 words: { fontSize: 15, lineHeight: ROLL_H, fontWeight: '600' },638 roll: { height: ROLL_H, overflow: 'hidden' },639 rollStrip: { position: 'absolute', top: 0, left: 0, right: 0 },640 digit: { height: ROLL_H, lineHeight: ROLL_H, fontSize: 15, fontWeight: '700' },641 invisible: { opacity: 0 },642 goal: { flexDirection: 'row', gap: 5 },643 goalSlot: { width: 24, height: 8, borderRadius: 4, overflow: 'hidden' },644 goalFill: { height: 8, borderRadius: 4 },645 buttonSlot: { marginTop: 14 },646647 // Continue648 button: { height: BUTTON_H },649 buttonGlow: { borderRadius: 18 },650 buttonBody: { flex: 1, borderRadius: 18, overflow: 'hidden', alignItems: 'center', justifyContent: 'center' },651 flood: { position: 'absolute' },652 buttonRow: { flexDirection: 'row', alignItems: 'center' },653 buttonLabel: { fontSize: 17, fontWeight: '700', letterSpacing: -0.2 },654 arrow: { height: 20, alignItems: 'flex-end', justifyContent: 'center', overflow: 'hidden' },655 doneRow: { flexDirection: 'row', alignItems: 'center', gap: 8 },656 doneLabel: { color: ON_ACCENT },657 spinner: { width: 20, height: 20, borderRadius: 10, borderWidth: 2.5, borderColor: tint(ON_ACCENT, 0.35), borderTopColor: ON_ACCENT },658});