Biometric unlock

The lock screen of a wallet app: a drawn face-scan glyph pulses, tightens its brackets while a scan line sweeps, then turns green and draws a check as the wallet slides up, or turns red, shakes and falls back to the passcode after two misses. A fingerprint fills ridge by ridge while you hold it, and the six-dot passcode pad pops, shakes on a wrong code and locks for 30 seconds after five.

authbiometricface unlockfingerprintpasscodenumber padapp locklockoutanimationreanimated
Paste into Claude Code Cursor Codex Lovable RapidNative
Live preview · follows the site themeOpen full screen

Details

File
components/patterns/biometric-unlock.tsx
Lines
978
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/biometric-unlock.tsx
1import { useEffect, useRef, useState } from 'react';
2import { Image, Platform, Pressable, StyleSheet, Text, View, useColorScheme, useWindowDimensions, type LayoutChangeEvent } from 'react-native';
3import Animated, {
4 cancelAnimation,
5 Easing,
6 FadeIn,
7 FadeInDown,
8 useAnimatedProps,
9 useAnimatedStyle,
10 useSharedValue,
11 withRepeat,
12 withSequence,
13 withSpring,
14 withTiming,
15} from 'react-native-reanimated';
16import { LinearGradient } from 'expo-linear-gradient';
17import { useSafeAreaInsets } from 'react-native-safe-area-context';
18import Svg, { Circle, Path } from 'react-native-svg';
19import { ArrowDownLeft, BadgeCheck, Car, Check, Coffee, Delete, Grip, Lock, ShieldAlert, type LucideIcon } from 'lucide-react-native';
20
21// ─── Brand ──────────────────────────────────────────────────────────────────
22// The wallet's accent and name. Every accent colour below derives from these, so changing them rebrands the screen.
23
24const ACCENT = '#FF5A1F';
25const ON_ACCENT = '#140A05'; // text and icons on an accent fill
26const APP_NAME = 'Ember';
27
28/** `hex` at `alpha` opacity, as rgba(). */
29function tint(hex: string, alpha: number) {
30 const n = parseInt(hex.slice(1), 16);
31 return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;
32}
33
34/** `hex` mixed toward black (amount > 0) or white (amount < 0); amount from -1 to 1. */
35function shade(hex: string, amount: number) {
36 const n = parseInt(hex.slice(1), 16);
37 const target = amount < 0 ? 255 : 0;
38 const p = Math.abs(amount);
39 const c = (v: number) => Math.round(v + (target - v) * p).toString(16).padStart(2, '0');
40 return `#${c((n >> 16) & 255)}${c((n >> 8) & 255)}${c(n & 255)}`.toUpperCase();
41}
42
43/** `hex` with its hue turned by `deg` and its lightness and saturation moved by `light` and `sat` (HSL, -1 to 1), for colours that run warmer, cooler or brighter than the accent. */
44function spin(hex: string, deg: number, light = 0, sat = 0) {
45 const n = parseInt(hex.slice(1), 16);
46 const r = ((n >> 16) & 255) / 255;
47 const g = ((n >> 8) & 255) / 255;
48 const b = (n & 255) / 255;
49 const max = Math.max(r, g, b);
50 const min = Math.min(r, g, b);
51 const d = max - min;
52 const s = Math.min(1, Math.max(0, (d === 0 ? 0 : d / (1 - Math.abs(max + min - 1))) + sat));
53 const l = Math.min(1, Math.max(0, (max + min) / 2 + light));
54 const h0 = d === 0 ? 0 : max === r ? ((g - b) / d + 6) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
55 const h = (((h0 * 60 + deg) % 360) + 360) % 360;
56 const a = s * Math.min(l, 1 - l);
57 const f = (m: number) => {
58 const k = (m + h / 30) % 12;
59 return Math.round(255 * (l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)))).toString(16).padStart(2, '0');
60 };
61 return `#${f(0)}${f(8)}${f(4)}`.toUpperCase();
62}
63
64// ─── Sample data ────────────────────────────────────────────────────────────
65
66const USER = { first: 'Maya', photo: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200&q=80&fit=crop' };
67const ACCOUNT_HINT = 'Wallet ending 4821';
68const BALANCE = '$12,480.62';
69
70// The passcode this demo accepts.
71const PASSCODE = '258025';
72const PASSCODE_LENGTH = 6;
73const MAX_ATTEMPTS = 5; // wrong passcodes before the wallet locks
74const LOCK_SECONDS = 30;
75const MAX_SCAN_MISSES = 2; // failed scans before the passcode takes over
76
77const SCAN_MS = 1500; // stands in for the system biometric prompt
78const HOLD_MS = 1000; // how long the fingerprint must be held
79
80const RECENT: { id: string; title: string; subtitle: string; amount: string; icon: LucideIcon; gain: boolean }[] = [
81 { id: '1', title: 'Daniel Okafor', subtitle: 'Dinner split · 9:41 PM', amount: '+$48.50', icon: ArrowDownLeft, gain: true },
82 { id: '2', title: 'Corner Roastery', subtitle: 'Coffee · 8:12 AM', amount: '−$6.40', icon: Coffee, gain: false },
83 { id: '3', title: 'Metro Rides', subtitle: 'Transport · Yesterday', amount: '−$18.75', icon: Car, gain: false },
84];
85
86const PAD: string[][] = [
87 ['1', '2', '3'],
88 ['4', '5', '6'],
89 ['7', '8', '9'],
90 ['bio', '0', 'del'],
91];
92
93// ─── Palette ────────────────────────────────────────────────────────────────
94
95// The warm end of the brand gradient (app mark, balance card).
96const ACCENT_WARM = spin(ACCENT, 9, 0.12);
97const POP = { damping: 13, stiffness: 260, mass: 0.6 };
98const PRESS = { damping: 16, stiffness: 320, mass: 0.6 };
99const TABULAR = { fontVariant: ['tabular-nums' as const] };
100const NO_OUTLINE = Platform.OS === 'web' ? ({ outlineStyle: 'none', userSelect: 'none' } as object) : null;
101
102function usePalette() {
103 const dark = useColorScheme() === 'dark';
104 return {
105 dark,
106 bg: dark ? '#000000' : '#F5F5F5',
107 card: dark ? '#171717' : '#FFFFFF',
108 fg: dark ? '#FAFAFA' : '#0A0A0A',
109 muted: dark ? '#8A8A8F' : '#6E6E74',
110 faint: dark ? '#48484D' : '#C2C2C8',
111 track: dark ? '#26262A' : '#E6E6E9',
112 shine: dark ? '#34343A' : '#D8D8DD',
113 press: dark ? '#1F1F23' : '#E4E4E8',
114 line: dark ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.06)',
115 accentText: dark ? shade(ACCENT, -0.29) : shade(ACCENT, 0.15),
116 accentTint: dark ? tint(ACCENT, 0.16) : tint(ACCENT, 0.1),
117 error: dark ? '#FF6B6B' : '#E5484D',
118 errorTint: dark ? 'rgba(255,107,107,0.16)' : 'rgba(229,72,77,0.10)',
119 errorLine: dark ? 'rgba(255,107,107,0.32)' : 'rgba(229,72,77,0.24)',
120 success: dark ? '#22C55E' : '#16A34A',
121 successTint: dark ? 'rgba(34,197,94,0.16)' : 'rgba(22,163,74,0.12)',
122 disc: dark ? '#121214' : '#FFFFFF',
123 glow: dark ? ([tint(ACCENT, 0.22), tint(ACCENT, 0.05), 'rgba(0,0,0,0)'] as const) : ([tint(ACCENT_WARM, 0.3), tint(ACCENT_WARM, 0.08), 'rgba(245,245,245,0)'] as const),
124 cardShadow: dark ? '0px 0px 0px 1px rgba(255, 255, 255, 0.07)' : '0px 10px 30px rgba(0, 0, 0, 0.07)',
125 };
126}
127type Palette = ReturnType<typeof usePalette>;
128
129type Method = 'face' | 'finger';
130type Phase = 'idle' | 'scanning' | 'success' | 'fail';
131type PinStatus = 'idle' | 'ok' | 'error';
132
133const phaseColor = (phase: Phase, c: Palette, rest: string) => (phase === 'success' ? c.success : phase === 'fail' ? c.error : phase === 'scanning' ? ACCENT : rest);
134const phaseTint = (phase: Phase, c: Palette) => (phase === 'success' ? c.successTint : phase === 'fail' ? c.errorTint : c.accentTint);
135
136// ─── Small pieces ───────────────────────────────────────────────────────────
137
138/** A round photo that pulses as a tinted placeholder, then fades in once loaded. */
139function Photo({ uri, alt, size, pal }: { uri: string; alt: string; size: number; pal: Palette }) {
140 const shown = useSharedValue(0);
141 const pulse = useSharedValue(0.4);
142 useEffect(() => {
143 pulse.value = withRepeat(withSequence(withTiming(1, { duration: 700 }), withTiming(0.4, { duration: 700 })), -1);
144 return () => cancelAnimation(pulse);
145 }, [pulse]);
146 const image = useAnimatedStyle(() => ({ opacity: shown.value }));
147 const placeholder = useAnimatedStyle(() => ({ opacity: (1 - shown.value) * pulse.value }));
148 return (
149 <View style={[styles.photo, { width: size, height: size, borderRadius: size / 2, backgroundColor: pal.track }]}>
150 <Animated.View style={[StyleSheet.absoluteFill, { backgroundColor: pal.shine }, placeholder]} />
151 <Animated.View style={[styles.fill, image]}>
152 <Image
153 source={{ uri }}
154 alt={alt}
155 resizeMode="cover"
156 style={styles.fill}
157 onLoad={() => {
158 cancelAnimation(pulse);
159 shown.value = withTiming(1, { duration: 320 });
160 }}
161 />
162 </Animated.View>
163 </View>
164 );
165}
166
167/** The invented app mark: an ember on a warm tile. */
168function AppMark({ color }: { color: string }) {
169 return (
170 <View style={styles.mark}>
171 <LinearGradient colors={[ACCENT_WARM, ACCENT]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={styles.markTile}>
172 <Svg width={16} height={16} viewBox="0 0 24 24">
173 <Path d="M12.6 2.5c.7 3.6 5.4 5.6 5.4 10.9a6 6 0 0 1-12 0c0-2.4 1.2-3.9 2.5-5.3.4 1.5 1 2.3 2 2.7-.4-3.2.4-6 2.1-8.3Z" fill="#FFFFFF" />
174 </Svg>
175 </LinearGradient>
176 <Text style={[styles.markName, { color }]}>{APP_NAME}</Text>
177 </View>
178 );
179}
180
181function TextLink({ label, color, onPress }: { label: string; color: string; onPress?: () => void }) {
182 return (
183 <Pressable role="button" aria-label={label} onPress={onPress} hitSlop={8} style={({ pressed }) => [styles.link, { opacity: pressed ? 0.5 : 1 }]}>
184 <Text style={[styles.linkText, { color }]}>{label}</Text>
185 </Pressable>
186 );
187}
188
189// ─── Method switch: the thumb springs between Face unlock and Fingerprint ───
190
191function MethodSwitch({ method, onChange, pal }: { method: Method; onChange: (m: Method) => void; pal: Palette }) {
192 const [width, setWidth] = useState(0);
193 const x = useSharedValue(method === 'face' ? 0 : 1);
194 useEffect(() => {
195 x.value = withSpring(method === 'face' ? 0 : 1, PRESS);
196 }, [method, x]);
197 const half = (width - 8) / 2;
198 const thumb = useAnimatedStyle(() => ({ transform: [{ translateX: x.value * half }] }));
199 const options: { id: Method; label: string }[] = [
200 { id: 'face', label: 'Face unlock' },
201 { id: 'finger', label: 'Fingerprint' },
202 ];
203 return (
204 <View role="tablist" style={[styles.switch, { backgroundColor: pal.track }]} onLayout={(e: LayoutChangeEvent) => setWidth(e.nativeEvent.layout.width)}>
205 {width > 0 && <Animated.View style={[styles.switchThumb, { width: half, backgroundColor: pal.card, boxShadow: pal.cardShadow }, thumb]} />}
206 {options.map((o) => (
207 <Pressable key={o.id} role="tab" aria-label={o.label} aria-selected={method === o.id} onPress={() => onChange(o.id)} style={[styles.switchOption, NO_OUTLINE]}>
208 {o.id === 'face' ? <FaceArt size={18} color={method === o.id ? pal.fg : pal.muted} weight={9} /> : <PrintArt size={18} color={method === o.id ? pal.fg : pal.muted} weight={10} small />}
209 <Text style={[styles.switchLabel, { color: method === o.id ? pal.fg : pal.muted }]}>{o.label}</Text>
210 </Pressable>
211 ))}
212 </View>
213 );
214}
215
216// ─── Glyph art: generic drawings, used large on the stage and small in keys ─
217
218const BRACKETS = 'M10 46V28A18 18 0 0 1 28 10H46M114 10H132A18 18 0 0 1 150 28V46M150 114V132A18 18 0 0 1 132 150H114M46 150H28A18 18 0 0 1 10 132V114';
219const HEAD = 'M80 37C102 37 114 56 114 80C114 106 98 125 80 125C62 125 46 106 46 80C46 56 58 37 80 37Z';
220const EYES = 'M68 71V80M92 71V80';
221const SMILE = 'M68 98Q80 107 92 98';
222const CHECK = 'M54 82L72 100L108 62';
223const CHECK_LENGTH = 78;
224
225function Brackets({ size, color, weight = 4.5 }: { size: number; color: string; weight?: number }) {
226 return (
227 <Svg width={size} height={size} viewBox="0 0 160 160">
228 <Path d={BRACKETS} stroke={color} strokeWidth={weight} strokeLinecap="round" strokeLinejoin="round" fill="none" />
229 </Svg>
230 );
231}
232
233function Face({ size, color, weight = 3.5 }: { size: number; color: string; weight?: number }) {
234 return (
235 <Svg width={size} height={size} viewBox="0 0 160 160">
236 <Path d={`${HEAD}${EYES}${SMILE}`} stroke={color} strokeWidth={weight} strokeLinecap="round" fill="none" />
237 </Svg>
238 );
239}
240
241/** The whole face-scan mark in one drawing, for small sizes. */
242function FaceArt({ size, color, weight }: { size: number; color: string; weight: number }) {
243 return (
244 <Svg width={size} height={size} viewBox="0 0 160 160">
245 <Path d={`${BRACKETS}M62 64V78M98 64V78M60 100Q80 118 100 100`} stroke={color} strokeWidth={weight * 1.6} strokeLinecap="round" strokeLinejoin="round" fill="none" />
246 </Svg>
247 );
248}
249
250// Nested arches with breaks, open at the bottom like a print pressed on glass.
251const RIDGES = [
252 'M17 45A46 46 0 0 1 103 45',
253 'M23 86V60A37 37 0 0 1 97 60V72M97 84V92',
254 'M32 100V60A28 28 0 0 1 88 60V92Q88 102 84 108',
255 'M41 78V60A19 19 0 0 1 79 60V80M41 90V108M79 92Q79 104 75 113',
256 'M50 114V60A10 10 0 0 1 70 60V98Q70 109 66 116',
257 'M60 62V88M60 100V118',
258].join('');
259
260// Fewer ridges, so the mark stays crisp at icon size.
261const RIDGES_SMALL = 'M18 56A42 42 0 0 1 102 56V78M18 76V88M39 106V58A21 21 0 0 1 81 58V104M60 60V112';
262
263function PrintArt({ size, color, weight = 4.5, small }: { size: number; color: string; weight?: number; small?: boolean }) {
264 return (
265 <Svg width={size} height={(size * 124) / 120} viewBox="0 0 120 124">
266 <Path d={small ? RIDGES_SMALL : RIDGES} stroke={color} strokeWidth={weight} strokeLinecap="round" fill="none" />
267 </Svg>
268 );
269}
270
271// ─── Face unlock: pulse, scan, then a green check or a red shake ────────────
272
273const STAGE = 188;
274const AnimatedPath = Animated.createAnimatedComponent(Path);
275const AnimatedCircle = Animated.createAnimatedComponent(Circle);
276
277function shakeOf() {
278 'worklet';
279 return withSequence(
280 withTiming(-10, { duration: 55 }),
281 withTiming(9, { duration: 70 }),
282 withTiming(-7, { duration: 70 }),
283 withTiming(5, { duration: 70 }),
284 withTiming(0, { duration: 70 })
285 );
286}
287
288function FaceGlyph({ phase, pal }: { phase: Phase; pal: Palette }) {
289 const pulse = useSharedValue(0);
290 const tight = useSharedValue(0);
291 const sweep = useSharedValue(0);
292 const scanning = useSharedValue(0);
293 const done = useSharedValue(0);
294 const shake = useSharedValue(0);
295
296 useEffect(() => {
297 pulse.value = withRepeat(withTiming(1, { duration: 1500, easing: Easing.inOut(Easing.quad) }), -1, true);
298 return () => cancelAnimation(pulse);
299 }, [pulse]);
300
301 useEffect(() => {
302 const on = phase === 'scanning';
303 tight.value = on ? withTiming(1, { duration: 320, easing: Easing.out(Easing.cubic) }) : withSpring(0, POP);
304 scanning.value = withTiming(on ? 1 : 0, { duration: 180 });
305 done.value = withTiming(phase === 'success' ? 1 : 0, { duration: phase === 'success' ? 420 : 160, easing: Easing.out(Easing.cubic) });
306 if (on) {
307 sweep.value = 0;
308 sweep.value = withRepeat(withTiming(1, { duration: 720, easing: Easing.inOut(Easing.quad) }), -1, true);
309 } else {
310 cancelAnimation(sweep);
311 }
312 if (phase === 'fail') shake.value = shakeOf();
313 }, [phase, tight, scanning, done, sweep, shake]);
314
315 const stage = useAnimatedStyle(() => ({ transform: [{ translateX: shake.value }] }));
316 const halo = useAnimatedStyle(() => ({ transform: [{ scale: 1 + pulse.value * 0.05 * (1 - tight.value) }], opacity: 0.75 + pulse.value * 0.25 }));
317 const brackets = useAnimatedStyle(() => ({ transform: [{ scale: (1 + pulse.value * 0.035 * (1 - tight.value)) * (1 - tight.value * 0.1) }] }));
318 const face = useAnimatedStyle(() => ({ opacity: 1 - done.value, transform: [{ scale: 1 - done.value * 0.12 }] }));
319 const beam = useAnimatedStyle(() => ({ opacity: scanning.value, transform: [{ translateY: 22 + sweep.value * (STAGE - 72) }] }));
320 const tick = useAnimatedProps(() => ({ strokeDashoffset: CHECK_LENGTH * (1 - done.value) }));
321
322 const color = phaseColor(phase, pal, pal.fg);
323 return (
324 <Animated.View style={[styles.stage, stage]}>
325 <Animated.View style={[styles.halo, { backgroundColor: phaseTint(phase, pal) }, halo]} />
326 <Animated.View style={[styles.layer, face]}>
327 <Face size={STAGE} color={phase === 'fail' ? pal.error : pal.fg} />
328 </Animated.View>
329 <View style={styles.beamClip} pointerEvents="none">
330 <Animated.View style={[styles.beam, beam]}>
331 <LinearGradient colors={[tint(ACCENT, 0), tint(ACCENT, 0.34)]} style={styles.beamGlow} />
332 <View style={styles.beamLine} />
333 </Animated.View>
334 </View>
335 <Animated.View style={[styles.layer, brackets]}>
336 <Brackets size={STAGE} color={color} />
337 </Animated.View>
338 <View style={styles.layer} pointerEvents="none">
339 <Svg width={STAGE} height={STAGE} viewBox="0 0 160 160">
340 <AnimatedPath d={CHECK} stroke={pal.success} strokeWidth={7} strokeLinecap="round" strokeLinejoin="round" fill="none" strokeDasharray={CHECK_LENGTH} animatedProps={tick} opacity={phase === 'success' ? 1 : 0} />
341 </Svg>
342 </View>
343 </Animated.View>
344 );
345}
346
347// ─── Fingerprint: ridges fill from the bottom while it is held ──────────────
348
349const PRINT = 104;
350const PRINT_H = (PRINT * 124) / 120;
351const RING_R = 86;
352const RING_LENGTH = 2 * Math.PI * RING_R;
353
354function FingerGlyph({ phase, onHoldStart, onHoldEnd, pal }: { phase: Phase; onHoldStart: () => void; onHoldEnd: () => void; pal: Palette }) {
355 const pulse = useSharedValue(0);
356 const hold = useSharedValue(0);
357 const shake = useSharedValue(0);
358
359 useEffect(() => {
360 pulse.value = withRepeat(withTiming(1, { duration: 1500, easing: Easing.inOut(Easing.quad) }), -1, true);
361 return () => cancelAnimation(pulse);
362 }, [pulse]);
363
364 useEffect(() => {
365 if (phase === 'scanning') hold.value = withTiming(1, { duration: HOLD_MS, easing: Easing.linear });
366 else if (phase === 'success') hold.value = withTiming(1, { duration: 120 });
367 else hold.value = withTiming(0, { duration: 260, easing: Easing.out(Easing.cubic) });
368 if (phase === 'fail') shake.value = shakeOf();
369 }, [phase, hold, shake]);
370
371 const stage = useAnimatedStyle(() => ({ transform: [{ translateX: shake.value }, { scale: 1 - Math.min(hold.value * 4, 1) * 0.04 }] }));
372 const halo = useAnimatedStyle(() => ({ transform: [{ scale: 1 + pulse.value * 0.05 * (1 - hold.value) }], opacity: 0.75 + pulse.value * 0.25 }));
373 const fill = useAnimatedStyle(() => ({ height: PRINT_H * hold.value }));
374 const ring = useAnimatedProps(() => ({ strokeDashoffset: RING_LENGTH * (1 - hold.value) }));
375
376 const color = phaseColor(phase, pal, ACCENT);
377 return (
378 <Pressable role="button" aria-label="Fingerprint sensor, press and hold" onPressIn={onHoldStart} onPressOut={onHoldEnd} style={NO_OUTLINE}>
379 <Animated.View style={[styles.stage, stage]}>
380 <Animated.View style={[styles.halo, { backgroundColor: phaseTint(phase, pal) }, halo]} />
381 <View style={[styles.layer, styles.ring]}>
382 <Svg width={STAGE} height={STAGE} viewBox={`0 0 ${STAGE} ${STAGE}`}>
383 <Circle cx={STAGE / 2} cy={STAGE / 2} r={RING_R} stroke={pal.track} strokeWidth={4} fill="none" />
384 <AnimatedCircle cx={STAGE / 2} cy={STAGE / 2} r={RING_R} stroke={color} strokeWidth={4} strokeLinecap="round" fill="none" strokeDasharray={RING_LENGTH} animatedProps={ring} />
385 </Svg>
386 </View>
387 <View style={styles.print}>
388 <PrintArt size={PRINT} color={phase === 'fail' ? pal.error : pal.faint} />
389 {/* The same drawing in colour, revealed by a window that grows from the bottom */}
390 <Animated.View style={[styles.printFill, fill]}>
391 <View style={styles.printFillArt}>
392 <PrintArt size={PRINT} color={color} />
393 </View>
394 </Animated.View>
395 </View>
396 </Animated.View>
397 </Pressable>
398 );
399}
400
401// ─── Demo toggle: makes the next scan miss ──────────────────────────────────
402
403function DemoToggle({ on, onChange, pal }: { on: boolean; onChange: (v: boolean) => void; pal: Palette }) {
404 const x = useSharedValue(on ? 1 : 0);
405 useEffect(() => {
406 x.value = withSpring(on ? 1 : 0, PRESS);
407 }, [on, x]);
408 const knob = useAnimatedStyle(() => ({ transform: [{ translateX: x.value * 14 }] }));
409 return (
410 <Pressable role="switch" aria-label="Demo: fail next scan" aria-checked={on} onPress={() => onChange(!on)} hitSlop={6} style={[styles.demo, { borderColor: pal.line }, NO_OUTLINE]}>
411 <Text style={[styles.demoLabel, { color: pal.muted }]}>Demo: fail next scan</Text>
412 <View style={[styles.demoTrack, { backgroundColor: on ? ACCENT : pal.track }]}>
413 <Animated.View style={[styles.demoKnob, knob]} />
414 </View>
415 </Pressable>
416 );
417}
418
419// ─── Passcode: six dots and a number pad ────────────────────────────────────
420
421function Dot({ filled, status, pal }: { filled: boolean; status: PinStatus; pal: Palette }) {
422 const scale = useSharedValue(1);
423 useEffect(() => {
424 if (filled) scale.value = withSequence(withTiming(1.45, { duration: 90, easing: Easing.out(Easing.quad) }), withSpring(1, POP));
425 }, [filled, scale]);
426 const style = useAnimatedStyle(() => ({ transform: [{ scale: scale.value }] }));
427 const color = status === 'error' ? pal.error : status === 'ok' ? pal.success : pal.fg;
428 return <Animated.View style={[styles.dot, { borderColor: filled ? color : pal.faint, backgroundColor: filled ? color : 'transparent' }, style]} />;
429}
430
431function PadKey({ value, disabled, onPress, pal }: { value: string; disabled: boolean; onPress: () => void; pal: Palette }) {
432 const glow = useSharedValue(0);
433 const style = useAnimatedStyle(() => ({ opacity: glow.value, transform: [{ scale: 0.8 + glow.value * 0.2 }] }));
434 const label = value === 'del' ? 'Delete' : value === 'bio' ? 'Use face unlock' : value;
435 return (
436 <Pressable
437 role="button"
438 aria-label={label}
439 aria-disabled={disabled}
440 disabled={disabled}
441 onPress={onPress}
442 onPressIn={() => (glow.value = 1)}
443 onPressOut={() => (glow.value = withTiming(0, { duration: 380, easing: Easing.out(Easing.quad) }))}
444 style={[styles.padKey, NO_OUTLINE]}
445 >
446 <Animated.View style={[styles.padGlow, { backgroundColor: pal.press }, style]} />
447 {value === 'del' ? (
448 <View>
449 <Delete size={26} color={pal.fg} strokeWidth={1.9} />
450 </View>
451 ) : value === 'bio' ? (
452 <View>
453 <FaceArt size={28} color={pal.accentText} weight={7} />
454 </View>
455 ) : (
456 <Text style={[styles.padDigit, { color: pal.fg }, TABULAR]}>{value}</Text>
457 )}
458 </Pressable>
459 );
460}
461
462// ─── Unlocked: the wallet slides up with a balance teaser ───────────────────
463
464function Unlocked({ top, bottom, onLock, pal }: { top: number; bottom: number; onLock: () => void; pal: Palette }) {
465 return (
466 <View style={[styles.unlocked, { paddingTop: top + 8, paddingBottom: bottom + 16 }]}>
467 <Animated.View entering={FadeIn.delay(120).duration(300)} style={styles.header}>
468 <AppMark color={pal.fg} />
469 <View style={[styles.chip, { backgroundColor: pal.successTint }]}>
470 <Check size={13} color={pal.success} strokeWidth={3} />
471 <Text style={[styles.chipText, { color: pal.success }]}>Unlocked</Text>
472 </View>
473 </Animated.View>
474
475 <Animated.View entering={FadeInDown.delay(200).duration(380)} style={styles.unlockedHead}>
476 <Text style={[styles.unlockedTitle, { color: pal.fg }]}>Unlocked</Text>
477 <Text style={[styles.unlockedSub, { color: pal.muted }]}>Good to see you, {USER.first}. Your wallet is ready.</Text>
478 </Animated.View>
479
480 <Animated.View entering={FadeInDown.delay(300).duration(420)}>
481 <LinearGradient colors={[ACCENT_WARM, ACCENT]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 1 }} style={styles.balanceCard}>
482 <View style={styles.balanceGlow} />
483 <Text style={styles.balanceLabel}>Total balance</Text>
484 <Text style={[styles.balanceValue, TABULAR]}>{BALANCE}</Text>
485 <View style={styles.balanceFoot}>
486 <Text style={styles.balanceMeta}>Everyday · Debit</Text>
487 <Text style={[styles.balanceMeta, TABULAR]}>•••• 4821</Text>
488 </View>
489 </LinearGradient>
490 </Animated.View>
491
492 <Animated.View entering={FadeInDown.delay(400).duration(420)} style={[styles.recent, { backgroundColor: pal.card, boxShadow: pal.cardShadow }]}>
493 {RECENT.map((r, i) => (
494 <View key={r.id} style={[styles.recentRow, i > 0 && { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: pal.line }]}>
495 <View style={[styles.recentIcon, { backgroundColor: r.gain ? pal.successTint : pal.accentTint }]}>
496 <r.icon size={18} color={r.gain ? pal.success : pal.accentText} strokeWidth={2.2} />
497 </View>
498 <View style={styles.recentText}>
499 <Text style={[styles.recentTitle, { color: pal.fg }]}>{r.title}</Text>
500 <Text style={[styles.recentSub, { color: pal.muted }]}>{r.subtitle}</Text>
501 </View>
502 <Text style={[styles.recentAmount, { color: r.gain ? pal.success : pal.fg }, TABULAR]}>{r.amount}</Text>
503 </View>
504 ))}
505 </Animated.View>
506
507 <View style={styles.grow} />
508 <Animated.View entering={FadeIn.delay(560).duration(300)}>
509 <Pressable role="button" aria-label="Lock wallet" onPress={onLock} style={({ pressed }) => [styles.secondary, { borderColor: pal.faint, opacity: pressed ? 0.6 : 1 }, NO_OUTLINE]}>
510 <Lock size={16} color={pal.fg} strokeWidth={2.2} />
511 <Text style={[styles.secondaryText, { color: pal.fg }]}>Lock wallet</Text>
512 </Pressable>
513 </Animated.View>
514 </View>
515 );
516}
517
518// ─── Screen ─────────────────────────────────────────────────────────────────
519
520export default function BiometricUnlockScreen() {
521 const c = usePalette();
522 const insets = useSafeAreaInsets();
523 const { height } = useWindowDimensions();
524
525 const [method, setMethod] = useState<Method>('face');
526 const [passcodeMode, setPasscodeMode] = useState(false);
527 const [phase, setPhase] = useState<Phase>('idle');
528 const [misses, setMisses] = useState(0);
529 const [failNext, setFailNext] = useState(false);
530 const [code, setCode] = useState('');
531 const [pinStatus, setPinStatus] = useState<PinStatus>('idle');
532 const [attempts, setAttempts] = useState(0);
533 const [lockLeft, setLockLeft] = useState(0);
534 const [fellBack, setFellBack] = useState(false);
535 const [unlocked, setUnlocked] = useState(false);
536
537 // Timers read the latest values through refs, and are cleared on unmount.
538 const live = useRef({ phase, failNext, misses });
539 live.current = { phase, failNext, misses };
540 const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
541 const holdTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
542 const later = (ms: number, fn: () => void) => {
543 const t = setTimeout(fn, ms);
544 timers.current.push(t);
545 return t;
546 };
547 const clearTimers = () => {
548 timers.current.forEach(clearTimeout);
549 timers.current = [];
550 if (holdTimer.current) clearTimeout(holdTimer.current);
551 holdTimer.current = null;
552 };
553 useEffect(() => clearTimers, []);
554
555 const locked = lockLeft > 0;
556 const busy = phase === 'scanning' || phase === 'success';
557
558 // ── Biometrics ──
559 const finishScan = () => {
560 holdTimer.current = null;
561 if (!live.current.failNext) {
562 setPhase('success');
563 later(950, () => setUnlocked(true));
564 return;
565 }
566 const count = live.current.misses + 1;
567 setFailNext(false);
568 setMisses(count);
569 setPhase('fail');
570 if (count >= MAX_SCAN_MISSES) {
571 later(1100, () => {
572 setFellBack(true);
573 setPasscodeMode(true);
574 setPhase('idle');
575 setMisses(0);
576 });
577 } else {
578 later(1300, () => setPhase((p) => (p === 'fail' ? 'idle' : p)));
579 }
580 };
581
582 const startFaceScan = () => {
583 if (live.current.phase !== 'idle' && live.current.phase !== 'fail') return;
584 clearTimers();
585 setPhase('scanning');
586 later(SCAN_MS, finishScan);
587 };
588
589 const holdStart = () => {
590 if (live.current.phase !== 'idle' && live.current.phase !== 'fail') return;
591 clearTimers();
592 setPhase('scanning');
593 holdTimer.current = setTimeout(finishScan, HOLD_MS);
594 };
595 // Letting go early cancels: the ridges drain back down.
596 const holdEnd = () => {
597 if (!holdTimer.current) return;
598 clearTimeout(holdTimer.current);
599 holdTimer.current = null;
600 setPhase('idle');
601 };
602
603 const changeMethod = (m: Method) => {
604 if (m === method || live.current.phase === 'success') return;
605 clearTimers();
606 setPhase('idle');
607 setMethod(m);
608 };
609
610 // ── Passcode ──
611 const dotsShake = useSharedValue(0);
612 const dotsStyle = useAnimatedStyle(() => ({ transform: [{ translateX: dotsShake.value }] }));
613
614 const pressKey = (key: string) => {
615 if (key === 'bio') {
616 setCode('');
617 setFellBack(false);
618 setMethod('face');
619 setPasscodeMode(false);
620 return;
621 }
622 if (pinStatus !== 'idle') return;
623 if (key === 'del') setCode((v) => v.slice(0, -1));
624 else setCode((v) => (v.length < PASSCODE_LENGTH ? v + key : v));
625 };
626
627 // The sixth digit checks the code on its own.
628 useEffect(() => {
629 if (code.length < PASSCODE_LENGTH || pinStatus !== 'idle') return;
630 const t = setTimeout(() => {
631 if (code === PASSCODE) {
632 setPinStatus('ok');
633 later(600, () => setUnlocked(true));
634 return;
635 }
636 const count = attempts + 1;
637 setAttempts(count);
638 setPinStatus('error');
639 dotsShake.value = shakeOf();
640 later(620, () => {
641 setCode('');
642 setPinStatus('idle');
643 if (count >= MAX_ATTEMPTS) setLockLeft(LOCK_SECONDS);
644 });
645 }, 170);
646 return () => clearTimeout(t);
647 // eslint-disable-next-line react-hooks/exhaustive-deps
648 }, [code, pinStatus]);
649
650 // The lockout counts down once a second, then hands the attempts back.
651 useEffect(() => {
652 if (lockLeft <= 0) return;
653 const t = setTimeout(() => {
654 if (lockLeft === 1) setAttempts(0);
655 setLockLeft(lockLeft - 1);
656 }, 1000);
657 return () => clearTimeout(t);
658 }, [lockLeft]);
659
660 const lockAgain = () => {
661 clearTimers();
662 setUnlocked(false);
663 setPasscodeMode(false);
664 setMethod('face');
665 setPhase('idle');
666 setMisses(0);
667 setFailNext(false);
668 setCode('');
669 setPinStatus('idle');
670 setAttempts(0);
671 setFellBack(false);
672 };
673
674 // ── Unlock transition: the lock lifts away as the wallet slides up ──
675 const open = useSharedValue(0);
676 useEffect(() => {
677 open.value = withTiming(unlocked ? 1 : 0, { duration: unlocked ? 560 : 360, easing: Easing.out(Easing.cubic) });
678 }, [unlocked, open]);
679 const lockStyle = useAnimatedStyle(() => ({ opacity: 1 - open.value, transform: [{ translateY: -48 * open.value }, { scale: 1 - open.value * 0.04 }] }));
680 const sheetStyle = useAnimatedStyle(() => ({ transform: [{ translateY: (1 - open.value) * height }] }));
681
682 // ── Copy ──
683 const missed = phase === 'fail' || (phase === 'idle' && misses > 0);
684 const lastTry = misses >= MAX_SCAN_MISSES;
685 const status =
686 phase === 'success'
687 ? 'Recognised'
688 : missed
689 ? 'Not recognised, try again'
690 : method === 'face'
691 ? phase === 'scanning'
692 ? 'Scanning your face…'
693 : 'Look at the screen to unlock'
694 : phase === 'scanning'
695 ? 'Keep holding…'
696 : 'Press and hold the fingerprint';
697 const statusSub =
698 phase === 'success'
699 ? 'Opening your wallet'
700 : missed
701 ? lastTry
702 ? 'Switching to your passcode'
703 : 'One more miss and we will ask for your passcode'
704 : method === 'face'
705 ? 'Hold your phone at eye level'
706 : 'Hold for a second, release to cancel';
707 const statusColor = phase === 'success' ? c.success : missed ? c.error : c.fg;
708
709 const left = MAX_ATTEMPTS - attempts;
710 const pinMessage =
711 pinStatus === 'ok'
712 ? 'Passcode correct'
713 : locked
714 ? 'Wait for the timer, or use your password'
715 : left <= 0
716 ? 'Too many wrong passcodes'
717 : attempts > 0
718 ? `Wrong passcode, ${left} ${left === 1 ? 'attempt' : 'attempts'} left`
719 : `Demo passcode: ${PASSCODE}`;
720 const pinColor = pinStatus === 'ok' ? c.success : attempts > 0 && !locked ? c.error : c.muted;
721
722 return (
723 <View style={[styles.screen, { backgroundColor: c.bg }]}>
724 <LinearGradient colors={c.glow} locations={[0, 0.55, 1]} style={styles.glow} pointerEvents="none" />
725
726 <Animated.View style={[styles.lock, { paddingTop: insets.top + 8, paddingBottom: insets.bottom + 4 }, lockStyle]} pointerEvents={unlocked ? 'none' : 'auto'}>
727 <Animated.View entering={FadeIn.duration(300)} style={styles.header}>
728 <AppMark color={c.fg} />
729 <View style={[styles.chip, { backgroundColor: c.track }]}>
730 <Lock size={12} color={c.muted} strokeWidth={2.6} />
731 <Text style={[styles.chipText, { color: c.muted }]}>Locked</Text>
732 </View>
733 </Animated.View>
734
735 <Animated.View entering={FadeInDown.delay(80).duration(380)} style={[styles.greeting, passcodeMode && styles.greetingTight]}>
736 <View>
737 <View style={[styles.avatarRing, { borderColor: c.bg, backgroundColor: c.bg }]}>
738 <Photo uri={USER.photo} alt={`${USER.first}'s profile photo`} size={passcodeMode ? 56 : 68} pal={c} />
739 </View>
740 <View style={[styles.verified, { backgroundColor: c.bg }]}>
741 <BadgeCheck size={20} color={c.bg} fill={ACCENT} strokeWidth={2} />
742 </View>
743 </View>
744 <Text style={[styles.title, { color: c.fg }]}>Welcome back, {USER.first}</Text>
745 <Text style={[styles.subtitle, { color: c.muted }, TABULAR]}>{ACCOUNT_HINT}</Text>
746 </Animated.View>
747
748 {!passcodeMode ? (
749 <Animated.View key="bio" entering={FadeIn.delay(160).duration(320)} style={styles.panel}>
750 <MethodSwitch method={method} onChange={changeMethod} pal={c} />
751
752 <View style={styles.stageWrap}>
753 {method === 'face' ? (
754 <Animated.View key="face" entering={FadeIn.duration(220)}>
755 <FaceGlyph phase={phase} pal={c} />
756 </Animated.View>
757 ) : (
758 <Animated.View key="finger" entering={FadeIn.duration(220)}>
759 <FingerGlyph phase={phase} onHoldStart={holdStart} onHoldEnd={holdEnd} pal={c} />
760 </Animated.View>
761 )}
762 </View>
763
764 <View style={styles.status} aria-live="polite">
765 <Text style={[styles.statusText, { color: statusColor }]}>{status}</Text>
766 <Text style={[styles.statusSub, { color: c.muted }]}>{statusSub}</Text>
767 </View>
768
769 <DemoToggle on={failNext} onChange={setFailNext} pal={c} />
770
771 {method === 'face' ? (
772 <Pressable
773 role="button"
774 aria-label="Try face unlock"
775 aria-disabled={busy}
776 disabled={busy}
777 onPress={startFaceScan}
778 style={({ pressed }) => [styles.primary, { opacity: busy ? 0.55 : pressed ? 0.85 : 1, transform: [{ scale: pressed ? 0.98 : 1 }] }, NO_OUTLINE]}
779 >
780 <FaceArt size={20} color={ON_ACCENT} weight={8} />
781 <Text style={styles.primaryText}>{phase === 'scanning' ? 'Scanning…' : 'Try face unlock'}</Text>
782 </Pressable>
783 ) : (
784 <Pressable
785 role="button"
786 aria-label="Hold to unlock"
787 aria-disabled={phase === 'success'}
788 onPressIn={holdStart}
789 onPressOut={holdEnd}
790 style={({ pressed }) => [styles.primary, { opacity: phase === 'success' ? 0.55 : pressed ? 0.85 : 1, transform: [{ scale: pressed ? 0.98 : 1 }] }, NO_OUTLINE]}
791 >
792 <PrintArt size={19} color={ON_ACCENT} weight={10} small />
793 <Text style={styles.primaryText}>{phase === 'scanning' ? 'Keep holding…' : 'Hold to unlock'}</Text>
794 </Pressable>
795 )}
796
797 <Pressable
798 role="button"
799 aria-label="Use passcode"
800 onPress={() => {
801 if (busy) return;
802 clearTimers();
803 setPhase('idle');
804 setFellBack(false);
805 setPasscodeMode(true);
806 }}
807 style={({ pressed }) => [styles.ghost, { opacity: pressed ? 0.5 : 1 }, NO_OUTLINE]}
808 >
809 <Grip size={16} color={c.fg} strokeWidth={2.2} />
810 <Text style={[styles.ghostText, { color: c.fg }]}>Use passcode</Text>
811 </Pressable>
812 </Animated.View>
813 ) : (
814 <Animated.View key="pin" entering={FadeIn.duration(280)} style={styles.panel}>
815 <View style={styles.pinHead}>
816 {locked ? (
817 <Animated.View entering={FadeInDown.duration(260)} role="alert" style={[styles.banner, { backgroundColor: c.errorTint, borderColor: c.errorLine }]}>
818 <View style={[styles.bannerIcon, { backgroundColor: c.error }]}>
819 <ShieldAlert size={18} color="#FFFFFF" strokeWidth={2.2} />
820 </View>
821 <View style={styles.bannerText}>
822 <Text style={[styles.bannerTitle, { color: c.fg }]}>Locked for security</Text>
823 <Text style={[styles.bannerSub, { color: c.muted }]}>Too many wrong passcodes</Text>
824 </View>
825 <Text style={[styles.bannerTime, { color: c.error }, TABULAR]}>0:{String(lockLeft).padStart(2, '0')}</Text>
826 </Animated.View>
827 ) : (
828 <>
829 <Text style={[styles.pinTitle, { color: c.fg }]}>Enter passcode</Text>
830 <Text style={[styles.pinSub, { color: c.muted }]}>{fellBack ? 'We could not recognise you twice in a row' : 'Six digits to open your wallet'}</Text>
831 </>
832 )}
833 </View>
834
835 <Animated.View style={[styles.dots, { opacity: locked ? 0.35 : 1 }, dotsStyle]} aria-label={`${code.length} of ${PASSCODE_LENGTH} digits entered`}>
836 {Array.from({ length: PASSCODE_LENGTH }, (_, i) => (
837 <Dot key={i} filled={i < code.length} status={pinStatus} pal={c} />
838 ))}
839 </Animated.View>
840 <Text style={[styles.pinMessage, { color: pinColor }, TABULAR]} aria-live="polite">
841 {pinMessage}
842 </Text>
843
844 <View style={[styles.pad, { opacity: locked ? 0.3 : 1 }]}>
845 {PAD.map((row) => (
846 <View key={row[0]} style={styles.padRow}>
847 {row.map((key) => (
848 <PadKey key={key} value={key} disabled={locked || pinStatus === 'ok'} onPress={() => pressKey(key)} pal={c} />
849 ))}
850 </View>
851 ))}
852 </View>
853 </Animated.View>
854 )}
855
856 <Animated.View entering={FadeIn.delay(320).duration(320)} style={styles.footer}>
857 <TextLink label="Forgot passcode?" color={c.accentText} />
858 <View style={[styles.footerDot, { backgroundColor: c.faint }]} />
859 <TextLink label="Use password instead" color={c.accentText} />
860 </Animated.View>
861 </Animated.View>
862
863 <Animated.View style={[styles.sheet, { backgroundColor: c.bg }, sheetStyle]} pointerEvents={unlocked ? 'auto' : 'none'}>
864 <LinearGradient colors={c.glow} locations={[0, 0.55, 1]} style={styles.glow} pointerEvents="none" />
865 {unlocked && <Unlocked top={insets.top} bottom={insets.bottom} onLock={lockAgain} pal={c} />}
866 </Animated.View>
867 </View>
868 );
869}
870
871// ─── Styles ─────────────────────────────────────────────────────────────────
872
873const styles = StyleSheet.create({
874 screen: { flex: 1, overflow: 'hidden' },
875 fill: { width: '100%', height: '100%' },
876 grow: { flex: 1 },
877 glow: { position: 'absolute', top: 0, left: 0, right: 0, height: 380 },
878 lock: { flex: 1, paddingHorizontal: 24 },
879
880 // Header
881 header: { height: 40, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' },
882 mark: { flexDirection: 'row', alignItems: 'center', gap: 8 },
883 markTile: { width: 28, height: 28, borderRadius: 9, alignItems: 'center', justifyContent: 'center' },
884 markName: { fontSize: 17, fontWeight: '700', letterSpacing: -0.4 },
885 chip: { height: 28, paddingHorizontal: 10, borderRadius: 14, flexDirection: 'row', alignItems: 'center', gap: 5 },
886 chipText: { fontSize: 12, fontWeight: '600', letterSpacing: 0.1 },
887
888 // Greeting
889 greeting: { alignItems: 'center', marginTop: 20 },
890 greetingTight: { marginTop: 8 },
891 photo: { overflow: 'hidden' },
892 avatarRing: { borderWidth: 3, borderRadius: 40 },
893 verified: { position: 'absolute', right: -4, bottom: -2, width: 24, height: 24, borderRadius: 12, alignItems: 'center', justifyContent: 'center' },
894 title: { fontSize: 26, lineHeight: 32, fontWeight: '700', letterSpacing: -0.7, marginTop: 12 },
895 subtitle: { fontSize: 15, lineHeight: 20, marginTop: 2 },
896
897 // Method switch
898 panel: { flex: 1, alignItems: 'center' },
899 switch: { alignSelf: 'stretch', height: 44, borderRadius: 14, padding: 4, flexDirection: 'row', marginTop: 20 },
900 switchThumb: { position: 'absolute', top: 4, left: 4, bottom: 4, borderRadius: 10 },
901 switchOption: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 7 },
902 switchLabel: { fontSize: 14, fontWeight: '600', letterSpacing: -0.1 },
903
904 // Glyph stage
905 stageWrap: { flex: 1, minHeight: STAGE, alignItems: 'center', justifyContent: 'center' },
906 stage: { width: STAGE, height: STAGE, alignItems: 'center', justifyContent: 'center' },
907 layer: { position: 'absolute', top: 0, left: 0, width: STAGE, height: STAGE },
908 halo: { position: 'absolute', width: 148, height: 148, borderRadius: 74 },
909 beamClip: { position: 'absolute', top: 14, left: 14, right: 14, bottom: 14, borderRadius: 26, overflow: 'hidden' },
910 beam: { position: 'absolute', top: -58, left: 0, right: 0, height: 44 },
911 beamGlow: { flex: 1 },
912 beamLine: { height: 2.5, borderRadius: 2, backgroundColor: ACCENT },
913 ring: { transform: [{ rotate: '-90deg' }] },
914 print: { width: PRINT, height: PRINT_H },
915 printFill: { position: 'absolute', left: 0, right: 0, bottom: 0, overflow: 'hidden' },
916 printFillArt: { position: 'absolute', left: 0, bottom: 0 },
917
918 // Status and actions
919 status: { alignItems: 'center', height: 46 },
920 statusText: { fontSize: 17, lineHeight: 24, fontWeight: '600', letterSpacing: -0.3 },
921 statusSub: { fontSize: 14, lineHeight: 20 },
922 demo: { height: 32, paddingLeft: 12, paddingRight: 6, borderRadius: 16, borderWidth: 1, flexDirection: 'row', alignItems: 'center', gap: 8, marginTop: 14 },
923 demoLabel: { fontSize: 12.5, fontWeight: '500' },
924 demoTrack: { width: 34, height: 20, borderRadius: 10, padding: 2 },
925 demoKnob: { width: 16, height: 16, borderRadius: 8, backgroundColor: '#FFFFFF' },
926 primary: { alignSelf: 'stretch', height: 56, borderRadius: 18, backgroundColor: ACCENT, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 10, marginTop: 16 },
927 primaryText: { fontSize: 17, fontWeight: '700', letterSpacing: -0.2, color: ON_ACCENT },
928 ghost: { height: 44, paddingHorizontal: 16, flexDirection: 'row', alignItems: 'center', gap: 8, marginTop: 4 },
929 ghostText: { fontSize: 15, fontWeight: '600' },
930 secondary: { height: 54, borderRadius: 18, borderWidth: 1.5, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 },
931 secondaryText: { fontSize: 16, fontWeight: '600' },
932
933 // Passcode
934 pinHead: { alignSelf: 'stretch', height: 68, marginTop: 14, alignItems: 'center', justifyContent: 'center' },
935 pinTitle: { fontSize: 18, lineHeight: 24, fontWeight: '600', letterSpacing: -0.3 },
936 pinSub: { fontSize: 14, lineHeight: 20, marginTop: 2 },
937 banner: { alignSelf: 'stretch', height: 68, borderRadius: 18, borderWidth: 1, paddingHorizontal: 12, flexDirection: 'row', alignItems: 'center', gap: 12 },
938 bannerIcon: { width: 36, height: 36, borderRadius: 12, alignItems: 'center', justifyContent: 'center' },
939 bannerText: { flex: 1 },
940 bannerTitle: { fontSize: 15, lineHeight: 20, fontWeight: '700', letterSpacing: -0.2 },
941 bannerSub: { fontSize: 12.5, lineHeight: 17 },
942 bannerTime: { fontSize: 20, fontWeight: '700', letterSpacing: -0.4 },
943 dots: { flexDirection: 'row', gap: 18, marginTop: 18 },
944 dot: { width: 15, height: 15, borderRadius: 8, borderWidth: 1.5 },
945 pinMessage: { fontSize: 14, lineHeight: 20, fontWeight: '500', marginTop: 14 },
946 pad: { flex: 1, alignSelf: 'stretch', justifyContent: 'center', maxHeight: 340 },
947 padRow: { flex: 1, maxHeight: 80, flexDirection: 'row' },
948 padKey: { flex: 1, alignItems: 'center', justifyContent: 'center' },
949 padGlow: { position: 'absolute', width: 72, height: 72, borderRadius: 36 },
950 padDigit: { fontSize: 30, fontWeight: '500', letterSpacing: -0.5 },
951
952 // Footer
953 footer: { height: 40, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 12 },
954 footerDot: { width: 3, height: 3, borderRadius: 2 },
955 link: { paddingVertical: 8 },
956 linkText: { fontSize: 14, fontWeight: '600' },
957
958 // Unlocked
959 sheet: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },
960 unlocked: { flex: 1, paddingHorizontal: 24 },
961 unlockedHead: { marginTop: 28, marginBottom: 20 },
962 unlockedTitle: { fontSize: 34, lineHeight: 40, fontWeight: '700', letterSpacing: -1 },
963 unlockedSub: { fontSize: 16, lineHeight: 22, marginTop: 4 },
964 balanceCard: { height: 188, borderRadius: 28, padding: 22, overflow: 'hidden' },
965 balanceGlow: { position: 'absolute', right: -60, top: -70, width: 220, height: 220, borderRadius: 110, backgroundColor: 'rgba(255,255,255,0.16)' },
966 balanceLabel: { fontSize: 14, fontWeight: '600', color: ON_ACCENT, opacity: 0.7 },
967 balanceValue: { fontSize: 40, lineHeight: 46, fontWeight: '700', letterSpacing: -1.4, color: ON_ACCENT, marginTop: 6 },
968 balanceFoot: { position: 'absolute', left: 22, right: 22, bottom: 20, flexDirection: 'row', justifyContent: 'space-between' },
969 balanceMeta: { fontSize: 14, fontWeight: '600', color: ON_ACCENT, opacity: 0.75 },
970 recent: { borderRadius: 22, paddingHorizontal: 16, marginTop: 14 },
971 recentRow: { height: 68, flexDirection: 'row', alignItems: 'center', gap: 12 },
972 recentIcon: { width: 40, height: 40, borderRadius: 14, alignItems: 'center', justifyContent: 'center' },
973 recentText: { flex: 1 },
974 recentTitle: { fontSize: 15, lineHeight: 20, fontWeight: '600', letterSpacing: -0.2 },
975 recentSub: { fontSize: 13, lineHeight: 18 },
976 recentAmount: { fontSize: 15, fontWeight: '700', letterSpacing: -0.2 },
977});

More screens like this.

All Authentication