Weather

A sky-driven weather home: the full-screen gradient, sun glow, drifting clouds, falling rain and twinkling stars follow each city's conditions and cross-fade as you page between three cities. The huge temperature counts up, the header condenses into one pinned line on scroll, and hourly, 10-day, radar and detail tiles sit on translucent panels.

weatherforecastpagingcollapsing-headersvganimationreanimated
Paste into Claude Code Cursor Codex Lovable RapidNative
Live preview · follows the site themeOpen full screen

Details

File
components/patterns/weather.tsx
Lines
900
Stack
React Native, StyleSheet
Packages
expo-linear-gradient, lucide-react-native, react-native-reanimated, react-native-safe-area-context, react-native-svg, react-native-worklets
Platforms
iOS, Android, Web

Using gluestack-ui?

Optional. The screen is plain React Native; these components can stand in for its primitives.

components/patterns/weather.tsx
1import { useEffect, useRef, useState, type ReactNode } from 'react';
2import { Pressable, ScrollView, StyleSheet, Text, View, useColorScheme, useWindowDimensions, type StyleProp, type ViewStyle } from 'react-native';
3import Animated, {
4 Easing,
5 FadeInDown,
6 interpolate,
7 runOnJS,
8 useAnimatedReaction,
9 useAnimatedScrollHandler,
10 useAnimatedStyle,
11 useSharedValue,
12 withDelay,
13 withRepeat,
14 withSpring,
15 withTiming,
16 type SharedValue,
17} from 'react-native-reanimated';
18import { LinearGradient } from 'expo-linear-gradient';
19import { useSafeAreaInsets } from 'react-native-safe-area-context';
20import Svg, { Circle, Defs, Ellipse, G, Line, Path, RadialGradient, Rect, Stop, Text as SvgText } from 'react-native-svg';
21import { Calendar, Clock, CloudRain, Droplets, Eye, Gauge, List, Map as MapIcon, Radar, Sun, Sunrise, Thermometer, Wind, Leaf, type LucideIcon } from 'lucide-react-native';
22
23// ─── Brand ──────────────────────────────────────────────────────────────────
24// The app's name. This screen has no accent colour: the sky is the weather's own palette, the sun stays sunlight and
25// the controls are white on every sky.
26
27const APP_NAME = 'Skylark Weather';
28
29// ─── Sample data ────────────────────────────────────────────────────────────
30
31type SkyKind = 'sunny' | 'rain' | 'night';
32// s sun, p partly cloudy, c cloud, r rain, m moon, n cloudy night
33type IconKind = 's' | 'p' | 'c' | 'r' | 'm' | 'n' | 'Sunset' | 'Sunrise';
34type Day = readonly [day: string, icon: IconKind, rainChance: number, low: number, high: number];
35
36type City = {
37 name: string;
38 sky: SkyKind;
39 temp: number;
40 condition: string;
41 high: number;
42 low: number;
43 summary: string;
44 /** Local time as a decimal hour; the hourly strip starts at its whole hour. */
45 now: number;
46 temps: number[];
47 icons: string;
48 /** The next sun event, inserted into the hourly strip after its hour. */
49 marker: { kind: 'Sunset' | 'Sunrise'; time: string; other: string };
50 sunrise: number;
51 sunset: number;
52 days: Day[];
53 uv: { value: number; label: string; note: string };
54 wind: { speed: number; gust: number; deg: number; dir: string };
55 humidity: { value: number; dew: number };
56 feels: { value: number; note: string };
57 rain: { mm: number; note: string };
58 visibility: { km: number; note: string };
59 pressure: { hpa: number; trend: string };
60 air: { value: number; label: string; note: string };
61 radar: { note: string; cells: readonly (readonly [x: number, y: number, r: number, heavy: boolean])[] };
62};
63
64const CITIES: City[] = [
65 {
66 name: 'Lisbon',
67 sky: 'sunny',
68 temp: 21,
69 condition: 'Mostly sunny',
70 high: 22,
71 low: 14,
72 summary: 'Sunny until sunset at 17:16. Clear and mild tonight, with gusts up to 28 km/h.',
73 now: 15.67,
74 temps: [21, 21, 19, 17, 16, 16, 15, 15, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 16, 18, 20, 21, 22, 22],
75 icons: 'sspmmmnnmmmmmmnmmpssssss',
76 marker: { kind: 'Sunset', time: '17:16', other: '07:32' },
77 sunrise: 7.53,
78 sunset: 17.27,
79 days: [
80 ['Today', 's', 0, 14, 22], ['Mon', 's', 0, 13, 21], ['Tue', 'p', 10, 13, 20], ['Wed', 'c', 30, 12, 18], ['Thu', 'r', 70, 11, 16],
81 ['Fri', 'r', 60, 11, 16], ['Sat', 'p', 20, 10, 17], ['Sun', 's', 0, 10, 18], ['Mon', 's', 0, 11, 19], ['Tue', 'p', 0, 12, 20],
82 ],
83 uv: { value: 3, label: 'Moderate', note: 'Low for the rest of the day.' },
84 wind: { speed: 14, gust: 28, deg: 315, dir: 'NW' },
85 humidity: { value: 62, dew: 13 },
86 feels: { value: 22, note: 'Sunshine makes it feel a little warmer.' },
87 rain: { mm: 0, note: 'Next expected Thursday, 6 mm.' },
88 visibility: { km: 24, note: 'Perfectly clear view.' },
89 pressure: { hpa: 1021, trend: 'Steady' },
90 air: { value: 38, label: 'Good', note: 'Air quality is better than yesterday at about this time.' },
91 radar: { note: 'Dry for the next 3 hours. Showers stay offshore.', cells: [[0.1, 0.34, 40, false], [0.2, 0.8, 30, false]] },
92 },
93 {
94 name: 'Copenhagen',
95 sky: 'rain',
96 temp: 6,
97 condition: 'Rain',
98 high: 7,
99 low: 3,
100 summary: 'Steady rain through the evening, easing after midnight. Gusts up to 46 km/h.',
101 now: 16.67,
102 temps: [6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 6],
103 icons: 'rrrrrrnrrrnnnnnnccrrrccp',
104 marker: { kind: 'Sunrise', time: '08:08', other: '15:43' },
105 sunrise: 8.13,
106 sunset: 15.72,
107 days: [
108 ['Today', 'r', 90, 3, 7], ['Mon', 'r', 80, 3, 6], ['Tue', 'c', 40, 2, 5], ['Wed', 'c', 20, 1, 4], ['Thu', 'p', 10, -1, 3],
109 ['Fri', 's', 0, -2, 2], ['Sat', 'c', 30, 0, 4], ['Sun', 'r', 70, 2, 6], ['Mon', 'r', 80, 3, 7], ['Tue', 'c', 40, 2, 5],
110 ],
111 uv: { value: 0, label: 'Low', note: 'Low for the rest of the day.' },
112 wind: { speed: 27, gust: 46, deg: 250, dir: 'WSW' },
113 humidity: { value: 91, dew: 5 },
114 feels: { value: 2, note: 'Wind is making it feel colder.' },
115 rain: { mm: 11, note: 'Another 7 mm expected tonight.' },
116 visibility: { km: 6, note: 'Reduced by rain and low cloud.' },
117 pressure: { hpa: 998, trend: 'Falling' },
118 air: { value: 21, label: 'Good', note: 'Rain is washing the air clean this evening.' },
119 radar: { note: 'Steady rain for the next 2 hours, moving east.', cells: [[0.52, 0.48, 78, true], [0.8, 0.62, 56, false], [0.24, 0.7, 50, false]] },
120 },
121 {
122 name: 'Kyoto',
123 sky: 'night',
124 temp: 9,
125 condition: 'Clear',
126 high: 16,
127 low: 6,
128 summary: 'Clear and still overnight. Sunrise at 06:44, then sunny through the afternoon.',
129 now: 0.67,
130 temps: [9, 8, 8, 7, 7, 6, 6, 7, 9, 11, 13, 14, 15, 16, 16, 15, 13, 12, 11, 10, 10, 9, 9, 9],
131 icons: 'mmmmmmmssssssspspmmmnmmm',
132 marker: { kind: 'Sunrise', time: '06:44', other: '16:46' },
133 sunrise: 6.73,
134 sunset: 16.77,
135 days: [
136 ['Today', 's', 0, 6, 16], ['Mon', 's', 0, 6, 15], ['Tue', 'p', 10, 7, 15], ['Wed', 'r', 60, 8, 13], ['Thu', 'c', 30, 6, 12],
137 ['Fri', 's', 0, 4, 12], ['Sat', 's', 0, 3, 11], ['Sun', 'p', 10, 4, 12], ['Mon', 's', 0, 5, 13], ['Tue', 'c', 20, 6, 13],
138 ],
139 uv: { value: 0, label: 'Low', note: 'Moderate from 10:00 tomorrow.' },
140 wind: { speed: 6, gust: 11, deg: 20, dir: 'NNE' },
141 humidity: { value: 71, dew: 4 },
142 feels: { value: 8, note: 'Similar to the actual temperature.' },
143 rain: { mm: 0, note: 'Next expected Wednesday, 9 mm.' },
144 visibility: { km: 18, note: 'Clear view across the basin.' },
145 pressure: { hpa: 1026, trend: 'Rising' },
146 air: { value: 64, label: 'Moderate', note: 'Fine particles are slightly raised tonight.' },
147 radar: { note: 'No rain within 80 km tonight.', cells: [[0.9, 0.2, 28, false]] },
148 },
149];
150
151// ─── Palette ────────────────────────────────────────────────────────────────
152
153const SUN = '#FFD25E'; // sunlight: the sun, the "now" markers and the map pin (art, so not the brand accent)
154const RAIN = '#7FD4FF';
155const SCALE = ['#3DDC84', '#F5D547', '#FF9A3D', '#F0524F', '#9E2238'] as const;
156const SPRING = { damping: 16, stiffness: 220, mass: 0.7 };
157const TABULAR = { fontVariant: ['tabular-nums' as const] };
158
159type Tone = {
160 colors: readonly [string, string, ...string[]];
161 stops: readonly [number, number, ...number[]];
162 panel: string;
163 glow: string;
164 cloud: number;
165 stars: number;
166};
167
168// Light shows each city's sky by day; dark is the same sky after dusk, with stars. Text on the sky is white in both.
169function usePalette() {
170 const dark = useColorScheme() === 'dark';
171 const sky: Record<SkyKind, Tone> = dark
172 ? {
173 sunny: { colors: ['#050E26', '#10294F', '#365273', '#C27A4C'], stops: [0, 0.5, 0.82, 1], panel: 'rgba(6,16,38,0.42)', glow: '#FFB067', cloud: 0.1, stars: 26 },
174 rain: { colors: ['#0C1118', '#1A222C', '#2F3945'], stops: [0, 0.55, 1], panel: 'rgba(255,255,255,0.07)', glow: '#FFFFFF', cloud: 0.1, stars: 0 },
175 night: { colors: ['#01030A', '#040B1E', '#0C1D3A'], stops: [0, 0.55, 1], panel: 'rgba(255,255,255,0.07)', glow: '#DCE6FF', cloud: 0, stars: 64 },
176 }
177 : {
178 sunny: { colors: ['#1556B5', '#3F86D6', '#8DB4DC', '#F3B37A'], stops: [0, 0.5, 0.82, 1], panel: 'rgba(14,50,108,0.30)', glow: '#FFE9A8', cloud: 0.26, stars: 0 },
179 rain: { colors: ['#3C4A5C', '#566678', '#8391A0'], stops: [0, 0.55, 1], panel: 'rgba(22,32,46,0.30)', glow: '#FFFFFF', cloud: 0.16, stars: 0 },
180 night: { colors: ['#040A1C', '#0B1B3D', '#1D3963'], stops: [0, 0.55, 1], panel: 'rgba(255,255,255,0.09)', glow: '#DCE6FF', cloud: 0, stars: 48 },
181 };
182 return {
183 dark,
184 sky,
185 onSky: '#FFFFFF',
186 soft: 'rgba(255,255,255,0.78)',
187 faint: 'rgba(255,255,255,0.56)',
188 hairline: 'rgba(255,255,255,0.16)',
189 track: 'rgba(0,0,0,0.22)',
190 highlight: 'rgba(255,255,255,0.16)',
191 mapSea: dark ? 'rgba(2,8,20,0.55)' : 'rgba(6,22,48,0.42)',
192 mapLand: dark ? 'rgba(255,255,255,0.09)' : 'rgba(255,255,255,0.14)',
193 };
194}
195
196// ─── Layout ─────────────────────────────────────────────────────────────────
197
198const COMPACT_H = 48;
199const HERO_H = 252; // the big header, measured from the safe area's top
200const BAR_H = 52;
201const GUTTER = 16;
202const HOUR_W = 56;
203
204/** A 0 to 1 value that swings back and forth forever. */
205function useLoop(duration: number) {
206 const t = useSharedValue(0);
207 useEffect(() => {
208 t.value = withRepeat(withTiming(1, { duration, easing: Easing.inOut(Easing.sin) }), -1, true);
209 }, [t, duration]);
210 return t;
211}
212
213/** Cool blue through green and amber to orange, by absolute temperature. */
214function tempColor(t: number) {
215 const stops: [number, number[]][] = [[-4, [96, 165, 255]], [6, [94, 214, 226]], [14, [140, 222, 120]], [20, [255, 210, 80]], [30, [255, 128, 56]]];
216 const i = Math.max(1, stops.findIndex(([at]) => t <= at) === -1 ? stops.length - 1 : stops.findIndex(([at]) => t <= at));
217 const [a, ca] = stops[i - 1];
218 const [b, cb] = stops[i];
219 const p = Math.min(1, Math.max(0, (t - a) / (b - a)));
220 return `rgb(${ca.map((v, k) => Math.round(v + (cb[k] - v) * p)).join(',')})`;
221}
222
223// ─── Weather glyphs, drawn ──────────────────────────────────────────────────
224
225const CLOUD_D = 'M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z';
226const MOON_D = 'M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z';
227
228function SunMark({ cx, cy, r }: { cx: number; cy: number; r: number }) {
229 const rays = Array.from({ length: 8 }, (_, i) => {
230 const a = (i * Math.PI) / 4;
231 return `M${cx + Math.cos(a) * (r + 2.2)} ${cy + Math.sin(a) * (r + 2.2)}L${cx + Math.cos(a) * (r + 4.4)} ${cy + Math.sin(a) * (r + 4.4)}`;
232 }).join('');
233 return (
234 <>
235 <Circle cx={cx} cy={cy} r={r} fill={SUN} />
236 <Path d={rays} stroke={SUN} strokeWidth={1.8} strokeLinecap="round" />
237 </>
238 );
239}
240
241function Glyph({ kind, size = 26 }: { kind: IconKind; size?: number }) {
242 const cloud = (t: string) => <Path d={CLOUD_D} fill="#FFFFFF" transform={t} />;
243 return (
244 <Svg width={size} height={size} viewBox="0 0 24 24">
245 {kind === 's' ? <SunMark cx={12} cy={12} r={4.6} /> : null}
246 {kind === 'm' ? <Path d={MOON_D} fill="#F3EFD9" transform="translate(2.4 2.4) scale(0.8)" /> : null}
247 {kind === 'p' ? <SunMark cx={8.5} cy={8} r={3.6} /> : null}
248 {kind === 'n' ? <Path d={MOON_D} fill="#F3EFD9" transform="translate(9 0.5) scale(0.56)" /> : null}
249 {kind === 'p' || kind === 'n' ? cloud('translate(4.4 6.4) scale(0.8)') : null}
250 {kind === 'c' ? cloud('translate(0 1)') : null}
251 {kind === 'r' ? (
252 <>
253 {cloud('translate(1.2 -2.6) scale(0.9)')}
254 <Path d="M8 17.6l-1.2 3.6M12.4 17.6l-1.2 3.6M16.8 17.6l-1.2 3.6" stroke={RAIN} strokeWidth={1.8} strokeLinecap="round" />
255 </>
256 ) : null}
257 {kind === 'Sunset' || kind === 'Sunrise' ? (
258 <>
259 <Path d="M6.5 17a5.5 5.5 0 0 1 11 0Z" fill={SUN} />
260 <Path d="M2 17h3M19 17h3M4.6 10.6l1.8 1.8M19.4 10.6l-1.8 1.8M4 20.5h16" stroke={SUN} strokeWidth={1.8} strokeLinecap="round" />
261 <Path d={kind === 'Sunset' ? 'M12 3v5.5M9.6 6.2 12 8.6l2.4-2.4' : 'M12 8.6V3.1M9.6 5.4 12 3l2.4 2.4'} stroke="#FFFFFF" strokeWidth={1.8} strokeLinecap="round" strokeLinejoin="round" fill="none" />
262 </>
263 ) : null}
264 </Svg>
265 );
266}
267
268// ─── Sky: gradient, sun or moon, clouds, rain and stars for one city ────────
269
270function RainDrop({ i, width, height }: { i: number; width: number; height: number }) {
271 const p = useSharedValue(0);
272 useEffect(() => {
273 p.value = withDelay((i * 173) % 900, withRepeat(withTiming(1, { duration: 820 + (i % 5) * 140, easing: Easing.linear }), -1));
274 }, [p, i]);
275 const fall = useAnimatedStyle(() => ({
276 transform: [{ translateY: -60 + p.value * (height + 120) }, { translateX: p.value * height * -0.12 }, { rotate: '7deg' }],
277 }));
278 return <Animated.View style={[styles.drop, { left: (i * 53 + 20) % (width + 80), height: 16 + (i % 4) * 6, opacity: 0.22 + (i % 3) * 0.1 }, fall]} />;
279}
280
281function CloudShape({ width, opacity }: { width: number; opacity: number }) {
282 return (
283 <View style={{ opacity }}>
284 <Svg width={width} height={width * 0.42} viewBox="0 0 220 92">
285 <Ellipse cx={110} cy={64} rx={104} ry={26} fill="#FFFFFF" />
286 <Circle cx={78} cy={46} r={30} fill="#FFFFFF" />
287 <Circle cx={128} cy={38} r={36} fill="#FFFFFF" />
288 <Circle cx={166} cy={56} r={22} fill="#FFFFFF" />
289 </Svg>
290 </View>
291 );
292}
293
294function Sky({ index, city, scrollX, scrollY, width, height }: { index: number; city: City; scrollX: SharedValue<number>; scrollY: SharedValue<number>; width: number; height: number }) {
295 const c = usePalette();
296 const insets = useSafeAreaInsets();
297 const tone = c.sky[city.sky];
298 const t = useLoop(7000);
299 const fade = useAnimatedStyle(() => ({
300 opacity: index === 0 ? 1 : interpolate(scrollX.value, [(index - 1) * width, index * width], [0, 1], 'clamp'),
301 }));
302 const parallax = useAnimatedStyle(() => ({ transform: [{ translateX: (scrollX.value - index * width) * -0.25 }] }));
303 const glow = useAnimatedStyle(() => ({ opacity: 0.82 + t.value * 0.18, transform: [{ scale: 1 + t.value * 0.07 }] }));
304 const near = useAnimatedStyle(() => ({ transform: [{ translateX: (t.value - 0.5) * 44 }] }));
305 const far = useAnimatedStyle(() => ({ transform: [{ translateX: (0.5 - t.value) * 28 }] }));
306 // The sun, moon and stars dim as the forecast scrolls over them, so the cards stay readable.
307 const dim = useAnimatedStyle(() => ({ opacity: interpolate(scrollY.value, [0, HERO_H - COMPACT_H], [1, 0.22], 'clamp') }));
308 const twinkleA = useAnimatedStyle(() => ({ opacity: 0.45 + t.value * 0.55 }));
309 const twinkleB = useAnimatedStyle(() => ({ opacity: 1 - t.value * 0.55 }));
310
311 const size = c.dark ? 560 : 380;
312 // By day the sun sits high on the right; after dusk it is an ember on the horizon.
313 const sun = c.dark ? { x: width * 0.34, y: height + 24 } : { x: width - 56, y: insets.top + 64 };
314 const stars = (odd: number) => (
315 <Svg width={width} height={height}>
316 {Array.from({ length: tone.stars }, (_, i) =>
317 i % 2 === odd ? <Circle key={i} cx={(i * 97 + 31) % width} cy={((i * i * 29 + i * 61) % 1000) / 1000 * height * (city.sky === 'night' ? 0.5 : 0.36) + 8} r={0.7 + (i % 3) * 0.45} fill="#FFFFFF" fillOpacity={0.5 + (i % 4) * 0.15} /> : null
318 )}
319 </Svg>
320 );
321 const id = `sky-glow-${index}`;
322
323 return (
324 <Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, fade]}>
325 <LinearGradient colors={tone.colors} locations={tone.stops} style={StyleSheet.absoluteFill} />
326 {tone.stars ? (
327 <Animated.View style={[StyleSheet.absoluteFill, dim]}>
328 <Animated.View style={[StyleSheet.absoluteFill, twinkleA]}>{stars(0)}</Animated.View>
329 <Animated.View style={[StyleSheet.absoluteFill, twinkleB]}>{stars(1)}</Animated.View>
330 </Animated.View>
331 ) : null}
332 <Animated.View style={[StyleSheet.absoluteFill, parallax]}>
333 <Animated.View style={[StyleSheet.absoluteFill, dim]}>
334 {city.sky === 'sunny' ? (
335 <Animated.View style={[styles.glow, { left: sun.x - size / 2, top: sun.y - size / 2, width: size, height: size }, glow]}>
336 <Svg width={size} height={size}>
337 <Defs>
338 <RadialGradient id={id} cx="50%" cy="50%" r="50%">
339 <Stop offset="0" stopColor="#FFFFFF" stopOpacity={1} />
340 <Stop offset="0.11" stopColor={tone.glow} stopOpacity={0.95} />
341 <Stop offset="0.2" stopColor={tone.glow} stopOpacity={0.4} />
342 <Stop offset="0.55" stopColor={tone.glow} stopOpacity={0.12} />
343 <Stop offset="1" stopColor={tone.glow} stopOpacity={0} />
344 </RadialGradient>
345 </Defs>
346 <Rect width={size} height={size} fill={`url(#${id})`} />
347 </Svg>
348 </Animated.View>
349 ) : null}
350 {city.sky === 'night' ? (
351 <Animated.View style={[styles.glow, { left: width - 150, top: insets.top + 6, width: 140, height: 140 }, glow]}>
352 <Svg width={140} height={140}>
353 <Defs>
354 <RadialGradient id={id} cx="50%" cy="50%" r="50%">
355 <Stop offset="0" stopColor={tone.glow} stopOpacity={0.34} />
356 <Stop offset="1" stopColor={tone.glow} stopOpacity={0} />
357 </RadialGradient>
358 </Defs>
359 <Rect width={140} height={140} fill={`url(#${id})`} />
360 <Path d={MOON_D} fill="#F6F2DF" transform="translate(46 46) scale(2)" />
361 </Svg>
362 </Animated.View>
363 ) : null}
364 </Animated.View>
365 {tone.cloud ? (
366 <>
367 <Animated.View style={[styles.cloud, { left: -84, top: insets.top + (city.sky === 'rain' ? -10 : 118) }, near]}>
368 <CloudShape width={city.sky === 'rain' ? 330 : 210} opacity={tone.cloud} />
369 </Animated.View>
370 <Animated.View style={[styles.cloud, { left: width - 190, top: insets.top + (city.sky === 'rain' ? 40 : 214) }, far]}>
371 <CloudShape width={city.sky === 'rain' ? 300 : 150} opacity={tone.cloud * 0.8} />
372 </Animated.View>
373 <Animated.View style={[styles.cloud, { left: width * 0.3, top: height * 0.56 }, near]}>
374 <CloudShape width={260} opacity={tone.cloud * 0.4} />
375 </Animated.View>
376 </>
377 ) : null}
378 </Animated.View>
379 {city.sky === 'rain' ? Array.from({ length: 30 }, (_, i) => <RainDrop key={i} i={i} width={width} height={height} />) : null}
380 </Animated.View>
381 );
382}
383
384// ─── Header: the big temperature condenses into one pinned line ─────────────
385
386function Hero({ index, city, active, scrollX, scrollY, width }: { index: number; city: City; active: boolean; scrollX: SharedValue<number>; scrollY: SharedValue<number>; width: number }) {
387 const c = usePalette();
388 const insets = useSafeAreaInsets();
389 // Counts up each time this city comes into view (it is faded out until then).
390 const [shown, setShown] = useState(0);
391 useEffect(() => {
392 if (!active) return setShown(0);
393 const t0 = Date.now();
394 let frame = 0;
395 const tick = () => {
396 const p = Math.min(1, (Date.now() - t0) / 900);
397 setShown(Math.round(city.temp * (1 - Math.pow(1 - p, 3))));
398 if (p < 1) frame = requestAnimationFrame(tick);
399 };
400 tick();
401 return () => cancelAnimationFrame(frame);
402 }, [active, city.temp]);
403
404 const range = HERO_H - COMPACT_H;
405 const page = useAnimatedStyle(() => {
406 const off = scrollX.value / width - index;
407 return { opacity: interpolate(Math.abs(off), [0.12, 0.5], [1, 0], 'clamp'), transform: [{ translateX: -off * width * 0.8 }] };
408 });
409 const big = useAnimatedStyle(() => {
410 const y = Math.max(0, scrollY.value);
411 return {
412 opacity: interpolate(y, [0, range * 0.62], [1, 0], 'clamp'),
413 transform: [{ translateY: -Math.min(y, range) * 0.55 }, { scale: interpolate(y, [0, range], [1, 0.72], 'clamp') }],
414 };
415 });
416 const compact = useAnimatedStyle(() => {
417 const p = interpolate(scrollY.value, [range * 0.5, range * 0.86], [0, 1], 'clamp');
418 return { opacity: p, transform: [{ translateY: (1 - p) * 10 }] };
419 });
420
421 return (
422 <Animated.View pointerEvents="none" style={[StyleSheet.absoluteFill, page]}>
423 <Animated.View style={[styles.hero, { top: insets.top + 30 }, big]}>
424 <Text style={[styles.city, { color: c.onSky }]}>{city.name}</Text>
425 <View>
426 <Text style={[styles.temp, { color: c.onSky }, TABULAR]} aria-label={`${city.temp} degrees`}>
427 {shown}
428 </Text>
429 <Text style={[styles.tempDegree, { color: c.onSky }]}>°</Text>
430 </View>
431 <Text style={[styles.condition, { color: c.soft }]}>{city.condition}</Text>
432 <Text style={[styles.highLow, { color: c.onSky }, TABULAR]}>
433 H:{city.high}° L:{city.low}°
434 </Text>
435 </Animated.View>
436 <Animated.View style={[styles.compact, { top: insets.top }, compact]}>
437 <Text style={[styles.compactCity, { color: c.onSky }]}>{city.name}</Text>
438 <View style={[styles.compactRule, { backgroundColor: c.faint }]} />
439 <Text style={[styles.compactTemp, { color: c.onSky }, TABULAR]}>{city.temp}°</Text>
440 <Text style={[styles.compactCondition, { color: c.soft }]}>{city.condition}</Text>
441 </Animated.View>
442 </Animated.View>
443 );
444}
445
446// ─── Panels and tiles ───────────────────────────────────────────────────────
447
448function Panel({ icon: Icon, label, order, tone, style, children }: { icon: LucideIcon; label: string; order: number; tone: Tone; style?: StyleProp<ViewStyle>; children: ReactNode }) {
449 const c = usePalette();
450 return (
451 <Animated.View entering={FadeInDown.delay(140 + Math.min(order, 5) * 70).duration(420)} style={[styles.panel, { backgroundColor: tone.panel, borderColor: c.hairline }, style]}>
452 <View style={styles.panelHead}>
453 <Icon size={13} color={c.faint} strokeWidth={2.4} />
454 <Text style={[styles.panelLabel, { color: c.faint }]}>{label.toUpperCase()}</Text>
455 </View>
456 {children}
457 </Animated.View>
458 );
459}
460
461/** A gradient scale with a dot at `at` (0 to 1). */
462function ScaleBar({ at, colors = SCALE }: { at: number; colors?: readonly [string, string, ...string[]] }) {
463 return (
464 <View style={styles.scale}>
465 <LinearGradient colors={colors} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }} style={styles.scaleFill} />
466 <View style={[styles.scaleDot, { left: `${Math.min(0.97, Math.max(0.03, at)) * 100}%` }]} />
467 </View>
468 );
469}
470
471function Hourly({ city }: { city: City }) {
472 const c = usePalette();
473 const start = Math.floor(city.now);
474 const items: { key: string; label: string; icon: IconKind; value: string; now?: boolean; event?: boolean }[] = [];
475 city.temps.forEach((temp, i) => {
476 const hour = (start + i) % 24;
477 items.push({ key: `h${i}`, label: i === 0 ? 'Now' : String(hour).padStart(2, '0'), icon: city.icons[i] as IconKind, value: `${temp}°`, now: i === 0 });
478 if (hour === Number(city.marker.time.slice(0, 2))) items.push({ key: 'event', label: city.marker.time, icon: city.marker.kind, value: city.marker.kind, event: true });
479 });
480 return (
481 <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.hours} aria-label="Hourly forecast">
482 {items.map((it) => (
483 <View key={it.key} style={[styles.hour, it.event && styles.hourEvent, it.now && { backgroundColor: c.highlight }]}>
484 <Text style={[styles.hourLabel, { color: it.now ? c.onSky : c.soft }, it.now && styles.bold, TABULAR]}>{it.label}</Text>
485 <Glyph kind={it.icon} />
486 <Text style={[it.event ? styles.hourEventLabel : styles.hourTemp, { color: c.onSky }, TABULAR]}>{it.value}</Text>
487 </View>
488 ))}
489 </ScrollView>
490 );
491}
492
493function Daily({ city, trackW }: { city: City; trackW: number }) {
494 const c = usePalette();
495 const min = Math.min(...city.days.map((d) => d[3]));
496 const max = Math.max(...city.days.map((d) => d[4]));
497 const x = (t: number) => ((t - min) / (max - min)) * trackW;
498 const colors = [tempColor(min), tempColor((min + max) / 2), tempColor(max)] as const;
499 return (
500 <View>
501 {city.days.map(([day, icon, chance, low, high], i) => (
502 <View key={i} style={[styles.day, { borderTopColor: c.hairline }]}>
503 <Text style={[styles.dayName, { color: c.onSky }]}>{day}</Text>
504 <View style={styles.dayIcon}>
505 <Glyph kind={icon} size={24} />
506 {chance >= 20 ? <Text style={[styles.dayChance, TABULAR]}>{chance}%</Text> : null}
507 </View>
508 <Text style={[styles.dayLow, { color: c.faint }, TABULAR]}>{low}°</Text>
509 <View style={[styles.range, { width: trackW, backgroundColor: c.track }]}>
510 <View style={[styles.rangeFill, { left: x(low), width: x(high) - x(low) }]}>
511 <LinearGradient colors={colors} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }} style={[styles.rangeScale, { left: -x(low), width: trackW }]} />
512 </View>
513 {i === 0 ? <View style={[styles.rangeNow, { left: Math.min(trackW - 9, Math.max(0, x(city.temp) - 4.5)) }]} /> : null}
514 </View>
515 <Text style={[styles.dayHigh, { color: c.onSky }, TABULAR]}>{high}°</Text>
516 </View>
517 ))}
518 </View>
519 );
520}
521
522/** The sun's path over 24 hours, the horizon, and where the sun is now. */
523function SunArc({ city, width }: { city: City; width: number }) {
524 const c = usePalette();
525 const h = 50;
526 const y = (hour: number) => h / 2 + 4 + Math.cos((hour / 24) * Math.PI * 2) * (h / 2 - 8);
527 const path = (from: number, to: number) => Array.from({ length: 25 }, (_, i) => from + ((to - from) * i) / 24).map((hr, i) => `${i ? 'L' : 'M'}${((hr / 24) * width).toFixed(1)} ${y(hr).toFixed(1)}`).join('');
528 const horizon = y(city.sunrise);
529 const up = city.now > city.sunrise && city.now < city.sunset;
530 const sunX = (city.now / 24) * width;
531 return (
532 <Svg width={width} height={h + 4}>
533 <Path d={path(0, 24)} stroke={c.faint} strokeOpacity={0.5} strokeWidth={2.2} fill="none" strokeLinecap="round" />
534 <Path d={path(city.sunrise, city.sunset)} stroke={c.onSky} strokeWidth={2.2} fill="none" strokeLinecap="round" />
535 <Line x1={0} x2={width} y1={horizon} y2={horizon} stroke={c.soft} strokeWidth={1} />
536 <Circle cx={sunX} cy={y(city.now)} r={9} fill={up ? SUN : c.onSky} fillOpacity={0.25} />
537 <Circle cx={sunX} cy={y(city.now)} r={4.5} fill={up ? SUN : c.soft} />
538 </Svg>
539 );
540}
541
542function Compass({ wind }: { wind: City['wind'] }) {
543 const c = usePalette();
544 const t = useLoop(2600);
545 const sway = useAnimatedStyle(() => ({ transform: [{ rotate: `${wind.deg + (t.value - 0.5) * 9}deg` }] }));
546 const s = 92;
547 const m = s / 2;
548 return (
549 <View style={styles.compass}>
550 <Svg width={s} height={s}>
551 <Circle cx={m} cy={m} r={39} stroke={c.faint} strokeWidth={6} strokeDasharray="1 4.105" fill="none" />
552 {(['N', 'E', 'S', 'W'] as const).map((l, i) => (
553 <SvgText key={l} x={m + [0, 26, 0, -26][i]} y={m + [-26, 0, 26, 0][i] + 3.4} fontSize={9.5} fontWeight="700" fill={c.soft} textAnchor="middle">
554 {l}
555 </SvgText>
556 ))}
557 </Svg>
558 <Animated.View style={[StyleSheet.absoluteFill, sway]}>
559 <Svg width={s} height={s}>
560 <Path d={`M${m} 3L${m + 5.5} 14H${m - 5.5}Z`} fill={c.onSky} />
561 <Line x1={m} y1={s - 13} x2={m} y2={s - 7} stroke={c.onSky} strokeWidth={2.4} strokeLinecap="round" />
562 <Circle cx={m} cy={s - 5} r={2.6} stroke={c.onSky} strokeWidth={1.8} fill="none" />
563 </Svg>
564 </Animated.View>
565 <View style={styles.compassCenter}>
566 <Text style={[styles.compassSpeed, { color: c.onSky }, TABULAR]}>{wind.speed}</Text>
567 <Text style={[styles.compassUnit, { color: c.soft }]}>km/h</Text>
568 </View>
569 </View>
570 );
571}
572
573function PressureDial({ hpa }: { hpa: number }) {
574 const c = usePalette();
575 const f = Math.min(1, Math.max(0, (hpa - 980) / 60));
576 const a = Math.PI * (1 - f);
577 return (
578 <Svg width={60} height={38}>
579 <Path d="M7 32A23 23 0 0 1 53 32" stroke={c.track} strokeWidth={5} strokeLinecap="round" fill="none" />
580 <Path d="M7 32A23 23 0 0 1 53 32" stroke={c.onSky} strokeWidth={5} strokeLinecap="round" strokeDasharray={`${f * Math.PI * 23} 200`} fill="none" />
581 <Circle cx={30 + Math.cos(a) * 23} cy={32 - Math.sin(a) * 23} r={5} fill={c.onSky} stroke={c.track} strokeWidth={2} />
582 </Svg>
583 );
584}
585
586/** Radar teaser: a drawn coastline, drifting rain cells and a pulsing pin on the city. */
587function RadarMap({ city, width }: { city: City; width: number }) {
588 const c = usePalette();
589 const t = useLoop(5200);
590 const h = 148;
591 const pin = { x: width * 0.62, y: 78 };
592 const drift = useAnimatedStyle(() => ({ transform: [{ translateX: (t.value - 0.5) * 22 }, { translateY: (t.value - 0.5) * -6 }] }));
593 const pulse = useAnimatedStyle(() => ({ opacity: 0.5 - t.value * 0.5, transform: [{ scale: 0.6 + t.value * 1.6 }] }));
594 const w = width;
595 return (
596 <View style={[styles.radar, { height: h, backgroundColor: c.mapSea }]}>
597 <Svg width={w} height={h}>
598 <Path d={`M${w * 0.4} 0C${w * 0.47} 28 ${w * 0.36} 52 ${w * 0.44} 80C${w * 0.5} 104 ${w * 0.41} 124 ${w * 0.47} ${h}H${w}V0Z`} fill={c.mapLand} stroke={c.hairline} strokeWidth={1} />
599 <Path d={`M${w * 0.46} 96C${w * 0.6} 88 ${w * 0.7} 104 ${w} 92M${w * 0.62} 0C${w * 0.6} 40 ${w * 0.7} 90 ${w * 0.66} ${h}M${w * 0.43} 40C${w * 0.6} 46 ${w * 0.8} 30 ${w} 44`} stroke={c.hairline} strokeWidth={1.2} fill="none" />
600 {[30, 60].map((r) => (
601 <Circle key={r} cx={pin.x} cy={pin.y} r={r} stroke={c.faint} strokeOpacity={0.5} strokeWidth={1} strokeDasharray="2 5" fill="none" />
602 ))}
603 </Svg>
604 <Animated.View style={[StyleSheet.absoluteFill, drift]}>
605 <Svg width={w} height={h}>
606 <Defs>
607 <RadialGradient id={`cell-light-${city.name}`} cx="50%" cy="50%" r="50%">
608 <Stop offset="0" stopColor={RAIN} stopOpacity={0.75} />
609 <Stop offset="0.6" stopColor="#4C9BFF" stopOpacity={0.3} />
610 <Stop offset="1" stopColor="#4C9BFF" stopOpacity={0} />
611 </RadialGradient>
612 <RadialGradient id={`cell-heavy-${city.name}`} cx="50%" cy="50%" r="50%">
613 <Stop offset="0" stopColor="#F5D547" stopOpacity={0.85} />
614 <Stop offset="0.3" stopColor="#5EDC8A" stopOpacity={0.6} />
615 <Stop offset="0.65" stopColor={RAIN} stopOpacity={0.4} />
616 <Stop offset="1" stopColor="#4C9BFF" stopOpacity={0} />
617 </RadialGradient>
618 </Defs>
619 {city.radar.cells.map(([x, y, r, heavy], i) => (
620 <Ellipse key={i} cx={x * w} cy={y * h} rx={r * 1.25} ry={r} fill={`url(#cell-${heavy ? 'heavy' : 'light'}-${city.name})`} />
621 ))}
622 </Svg>
623 </Animated.View>
624 <Animated.View style={[styles.pinPulse, { left: pin.x - 14, top: pin.y - 14 }, pulse]} />
625 <View style={[styles.pin, { left: pin.x - 6, top: pin.y - 6 }]} />
626 <View style={[styles.pinTag, { left: pin.x + 12, top: pin.y - 11 }]}>
627 <Text style={styles.pinTagText}>{city.name}</Text>
628 </View>
629 </View>
630 );
631}
632
633function Tile({ icon, label, order, tone, width, value, unit, sub, note, children }: { icon: LucideIcon; label: string; order: number; tone: Tone; width: number; value?: string; unit?: string; sub?: string; note: string; children?: ReactNode }) {
634 const c = usePalette();
635 return (
636 <Panel icon={icon} label={label} order={order} tone={tone} style={[styles.tile, { width }]}>
637 {value ? (
638 <Text style={[styles.tileValue, { color: c.onSky }, TABULAR]}>
639 {value}
640 {unit ? <Text style={styles.tileUnit}> {unit}</Text> : null}
641 </Text>
642 ) : null}
643 {sub ? <Text style={[styles.tileSub, { color: c.onSky }]}>{sub}</Text> : null}
644 {children}
645 <View style={styles.fill} />
646 <Text style={[styles.note, { color: c.soft }]} numberOfLines={2}>
647 {note}
648 </Text>
649 </Panel>
650 );
651}
652
653// ─── One city's page ────────────────────────────────────────────────────────
654
655function CityPage({ city, scrollY, width }: { city: City; scrollY: SharedValue<number>; width: number }) {
656 const c = usePalette();
657 const tone = c.sky[city.sky];
658 const [mapPressed, setMapPressed] = useState(false);
659 const onScroll = useAnimatedScrollHandler((e) => {
660 scrollY.value = e.contentOffset.y;
661 });
662 const inner = width - GUTTER * 2 - 32;
663 const tileW = (width - GUTTER * 2 - 12) / 2;
664 const tile = { tone, width: tileW };
665 return (
666 <Animated.ScrollView onScroll={onScroll} scrollEventThrottle={16} showsVerticalScrollIndicator={false} style={{ width }} contentContainerStyle={styles.page} aria-label={`${city.name} forecast`}>
667 <Panel icon={Clock} label="Hourly forecast" order={0} tone={tone} style={styles.flush}>
668 <Text style={[styles.summary, { color: c.onSky, borderBottomColor: c.hairline }]}>{city.summary}</Text>
669 <Hourly city={city} />
670 </Panel>
671
672 <Panel icon={Calendar} label="10-day forecast" order={1} tone={tone}>
673 <Daily city={city} trackW={inner - 52 - 40 - 34 - 34 - 32} />
674 </Panel>
675
676 <Pressable role="button" aria-label="Open precipitation map" onPressIn={() => setMapPressed(true)} onPressOut={() => setMapPressed(false)} style={{ opacity: mapPressed ? 0.85 : 1 }}>
677 <Panel icon={Radar} label="Precipitation" order={2} tone={tone}>
678 <RadarMap city={city} width={inner} />
679 <Text style={[styles.note, styles.radarNote, { color: c.soft }]}>{city.radar.note}</Text>
680 </Panel>
681 </Pressable>
682
683 <View style={styles.grid}>
684 <Tile {...tile} icon={Sun} label="UV index" order={3} value={String(city.uv.value)} sub={city.uv.label} note={city.uv.note}>
685 <ScaleBar at={city.uv.value / 11} />
686 </Tile>
687 <Tile {...tile} icon={Sunrise} label={city.marker.kind} order={3} value={city.marker.time} note={`${city.marker.kind === 'Sunset' ? 'Sunrise' : 'Sunset'}: ${city.marker.other}`}>
688 <SunArc city={city} width={tileW - 32} />
689 </Tile>
690 <Tile {...tile} icon={Wind} label="Wind" order={4} note={`${city.wind.dir}, gusts ${city.wind.gust} km/h`}>
691 <Compass wind={city.wind} />
692 </Tile>
693 <Tile {...tile} icon={CloudRain} label="Precipitation" order={4} value={String(city.rain.mm)} unit="mm" sub="in the last 24h" note={city.rain.note} />
694 <Tile {...tile} icon={Thermometer} label="Feels like" order={5} value={`${city.feels.value}°`} note={city.feels.note} />
695 <Tile {...tile} icon={Droplets} label="Humidity" order={5} value={`${city.humidity.value}%`} note={`The dew point is ${city.humidity.dew}° right now.`}>
696 <ScaleBar at={city.humidity.value / 100} colors={['rgba(127,212,255,0.25)', RAIN]} />
697 </Tile>
698 <Tile {...tile} icon={Eye} label="Visibility" order={5} value={String(city.visibility.km)} unit="km" note={city.visibility.note} />
699 <Tile {...tile} icon={Gauge} label="Pressure" order={5} value={String(city.pressure.hpa)} sub="hPa" note={`${city.pressure.trend} over the last 3 hours.`}>
700 <View style={styles.dial}>
701 <PressureDial hpa={city.pressure.hpa} />
702 </View>
703 </Tile>
704 </View>
705
706 <Panel icon={Leaf} label="Air quality" order={5} tone={tone}>
707 <Text style={[styles.tileValue, { color: c.onSky }, TABULAR]}>
708 {city.air.value}
709 <Text style={styles.airLabel}> {city.air.label}</Text>
710 </Text>
711 <ScaleBar at={city.air.value / 300} />
712 <Text style={[styles.note, styles.radarNote, { color: c.soft }]}>{city.air.note}</Text>
713 </Panel>
714
715 <Text style={[styles.credit, { color: c.faint }]}>Updated 2 minutes ago · {APP_NAME}</Text>
716 </Animated.ScrollView>
717 );
718}
719
720// ─── Bottom bar ─────────────────────────────────────────────────────────────
721
722function PageDot({ index, scrollX, width, active, onPress }: { index: number; scrollX: SharedValue<number>; width: number; active: boolean; onPress: () => void }) {
723 const style = useAnimatedStyle(() => {
724 const t = Math.max(0, 1 - Math.abs(scrollX.value / width - index));
725 return { width: 7 + t * 13, opacity: 0.4 + t * 0.6 };
726 });
727 return (
728 <Pressable onPress={onPress} hitSlop={10} role="tab" aria-selected={active} aria-label={`${CITIES[index].name}, city ${index + 1} of ${CITIES.length}`}>
729 <Animated.View style={[styles.dot, style]} />
730 </Pressable>
731 );
732}
733
734function BarButton({ icon: Icon, label }: { icon: LucideIcon; label: string }) {
735 const c = usePalette();
736 const scale = useSharedValue(1);
737 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
738 // Replace with navigation to your map or saved cities list.
739 return (
740 <Pressable role="button" aria-label={label} hitSlop={8} onPressIn={() => (scale.value = withSpring(0.82, SPRING))} onPressOut={() => (scale.value = withSpring(1, SPRING))}>
741 <Animated.View style={[styles.barButton, style]}>
742 <Icon size={22} color="#FFFFFF" strokeWidth={2} />
743 </Animated.View>
744 </Pressable>
745 );
746}
747
748// ─── Screen ─────────────────────────────────────────────────────────────────
749
750export default function WeatherScreen() {
751 const c = usePalette();
752 const insets = useSafeAreaInsets();
753 const window = useWindowDimensions();
754 const width = window.width;
755 const [measured, setMeasured] = useState(0);
756 const height = measured || window.height;
757 const pager = useRef<Animated.ScrollView>(null);
758 const scrollX = useSharedValue(0);
759 const scrollYs = [useSharedValue(0), useSharedValue(0), useSharedValue(0)];
760 const [index, setIndex] = useState(0);
761
762 const onScroll = useAnimatedScrollHandler((e) => {
763 scrollX.value = e.contentOffset.x;
764 });
765 useAnimatedReaction(
766 () => Math.min(CITIES.length - 1, Math.max(0, Math.round(scrollX.value / width))),
767 (now, before) => {
768 if (now !== before) runOnJS(setIndex)(now);
769 }
770 );
771 const goTo = (i: number) => pager.current?.scrollTo({ x: i * width, animated: true });
772
773 return (
774 <View onLayout={(e) => setMeasured(e.nativeEvent.layout.height)} style={[styles.screen, { backgroundColor: c.sky[CITIES[0].sky].colors[0] }]}>
775 {/* Skies run edge to edge and cross-fade with the horizontal scroll */}
776 {CITIES.map((city, i) => (
777 <Sky key={city.name} index={i} city={city} scrollX={scrollX} scrollY={scrollYs[i]} width={width} height={height} />
778 ))}
779
780 {/* Pages are clipped between the pinned header line and the bottom bar, so nothing ghosts under them */}
781 <Animated.ScrollView
782 ref={pager}
783 horizontal
784 pagingEnabled
785 bounces={false}
786 decelerationRate="fast"
787 showsHorizontalScrollIndicator={false}
788 scrollEventThrottle={16}
789 onScroll={onScroll}
790 style={[styles.pager, { top: insets.top + COMPACT_H, bottom: insets.bottom + BAR_H }]}
791 >
792 {CITIES.map((city, i) => (
793 <CityPage key={city.name} city={city} scrollY={scrollYs[i]} width={width} />
794 ))}
795 </Animated.ScrollView>
796
797 {CITIES.map((city, i) => (
798 <Hero key={city.name} index={i} city={city} active={index === i} scrollX={scrollX} scrollY={scrollYs[i]} width={width} />
799 ))}
800
801 <View style={[styles.bar, { height: BAR_H + insets.bottom, paddingBottom: insets.bottom, borderTopColor: c.hairline }]}>
802 <BarButton icon={MapIcon} label="Open map" />
803 <View style={styles.dots} role="tablist">
804 {CITIES.map((city, i) => (
805 <PageDot key={city.name} index={i} scrollX={scrollX} width={width} active={index === i} onPress={() => goTo(i)} />
806 ))}
807 </View>
808 <BarButton icon={List} label="Saved cities" />
809 </View>
810 </View>
811 );
812}
813
814// ─── Styles ─────────────────────────────────────────────────────────────────
815
816const styles = StyleSheet.create({
817 screen: { flex: 1, overflow: 'hidden' },
818 fill: { flex: 1 },
819 bold: { fontWeight: '700' },
820
821 // Sky
822 glow: { position: 'absolute' },
823 cloud: { position: 'absolute' },
824 drop: { position: 'absolute', top: 0, width: 1.5, borderRadius: 1, backgroundColor: '#FFFFFF' },
825
826 // Header
827 hero: { position: 'absolute', left: 0, right: 0, alignItems: 'center' },
828 city: { fontSize: 32, lineHeight: 38, fontWeight: '500', letterSpacing: -0.4 },
829 temp: { fontSize: 108, lineHeight: 112, fontWeight: '200', letterSpacing: -5, textAlign: 'center' },
830 tempDegree: { position: 'absolute', left: '100%', top: 2, fontSize: 84, lineHeight: 100, fontWeight: '200' },
831 condition: { fontSize: 20, lineHeight: 26, fontWeight: '600' },
832 highLow: { fontSize: 18, lineHeight: 26, fontWeight: '500', marginTop: 2 },
833 compact: { position: 'absolute', left: 0, right: 0, height: COMPACT_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 },
834 compactCity: { fontSize: 18, fontWeight: '700', letterSpacing: -0.2 },
835 compactRule: { width: 1, height: 16 },
836 compactTemp: { fontSize: 18, fontWeight: '500' },
837 compactCondition: { fontSize: 16, fontWeight: '500' },
838
839 // Pages
840 pager: { position: 'absolute', left: 0, right: 0 },
841 page: { paddingTop: HERO_H - COMPACT_H + 12, paddingHorizontal: GUTTER, paddingBottom: 20, gap: 12 },
842 panel: { borderRadius: 20, borderWidth: StyleSheet.hairlineWidth, padding: 16 },
843 flush: { paddingBottom: 8 },
844 panelHead: { flexDirection: 'row', alignItems: 'center', gap: 6, marginBottom: 10 },
845 panelLabel: { fontSize: 12, fontWeight: '700', letterSpacing: 0.6 },
846 summary: { fontSize: 15, lineHeight: 20, fontWeight: '500', paddingBottom: 12, borderBottomWidth: StyleSheet.hairlineWidth },
847 note: { fontSize: 13, lineHeight: 17, fontWeight: '500' },
848
849 // Hourly
850 hours: { paddingTop: 8, gap: 2 },
851 hour: { width: HOUR_W, paddingVertical: 10, borderRadius: 16, alignItems: 'center', gap: 10 },
852 hourEvent: { width: HOUR_W + 12 },
853 hourLabel: { fontSize: 14, fontWeight: '600' },
854 hourTemp: { fontSize: 19, fontWeight: '600' },
855 hourEventLabel: { fontSize: 14, lineHeight: 23, fontWeight: '600' },
856
857 // 10-day
858 day: { height: 46, flexDirection: 'row', alignItems: 'center', gap: 8, borderTopWidth: StyleSheet.hairlineWidth },
859 dayName: { width: 52, fontSize: 17, fontWeight: '600' },
860 dayIcon: { width: 40, alignItems: 'center' },
861 dayChance: { fontSize: 11, lineHeight: 12, fontWeight: '700', color: RAIN, marginTop: -2 },
862 dayLow: { width: 34, fontSize: 17, fontWeight: '600', textAlign: 'right' },
863 dayHigh: { width: 34, fontSize: 17, fontWeight: '600', textAlign: 'right' },
864 range: { height: 5, borderRadius: 3 },
865 rangeFill: { position: 'absolute', top: 0, height: 5, borderRadius: 3, overflow: 'hidden' },
866 rangeScale: { position: 'absolute', top: 0, height: 5 },
867 rangeNow: { position: 'absolute', top: -2, width: 9, height: 9, borderRadius: 5, backgroundColor: '#FFFFFF', borderWidth: 2, borderColor: 'rgba(0,0,0,0.4)' },
868
869 // Radar
870 radar: { borderRadius: 12, overflow: 'hidden' },
871 radarNote: { marginTop: 12 },
872 pin: { position: 'absolute', width: 12, height: 12, borderRadius: 6, backgroundColor: SUN, borderWidth: 2, borderColor: '#FFFFFF' },
873 pinPulse: { position: 'absolute', width: 28, height: 28, borderRadius: 14, backgroundColor: SUN },
874 pinTag: { position: 'absolute', height: 22, paddingHorizontal: 8, borderRadius: 11, backgroundColor: 'rgba(0,0,0,0.45)', justifyContent: 'center' },
875 pinTagText: { fontSize: 12, fontWeight: '700', color: '#FFFFFF' },
876
877 // Tiles
878 grid: { flexDirection: 'row', flexWrap: 'wrap', gap: 12 },
879 tile: { height: 172 },
880 tileValue: { fontSize: 32, lineHeight: 36, fontWeight: '400', letterSpacing: -0.6 },
881 tileUnit: { fontSize: 18, fontWeight: '500', letterSpacing: 0 },
882 tileSub: { fontSize: 17, lineHeight: 22, fontWeight: '600' },
883 airLabel: { fontSize: 20, fontWeight: '600', letterSpacing: 0 },
884 scale: { height: 5, marginTop: 12, justifyContent: 'center' },
885 scaleFill: { height: 5, borderRadius: 3 },
886 scaleDot: { position: 'absolute', width: 9, height: 9, marginLeft: -4.5, borderRadius: 5, backgroundColor: '#FFFFFF', borderWidth: 2, borderColor: 'rgba(0,0,0,0.4)' },
887 compass: { width: 92, height: 92, alignSelf: 'center', marginTop: -4 },
888 compassCenter: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' },
889 compassSpeed: { fontSize: 20, lineHeight: 22, fontWeight: '700' },
890 compassUnit: { fontSize: 10, lineHeight: 12, fontWeight: '600' },
891 dial: { position: 'absolute', right: 14, top: 42 },
892 credit: { fontSize: 12, fontWeight: '500', textAlign: 'center', marginTop: 8 },
893
894 // Bottom bar
895 bar: { position: 'absolute', left: 0, right: 0, bottom: 0, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 20, borderTopWidth: StyleSheet.hairlineWidth },
896 barButton: { width: 44, height: 44, alignItems: 'center', justifyContent: 'center' },
897 dots: { flexDirection: 'row', alignItems: 'center', gap: 7 },
898 dot: { height: 7, borderRadius: 4, backgroundColor: '#FFFFFF' },
899});

More screens like this.

All Lifestyle