import React, { useCallback, useEffect, useState } from 'react'; import { Pressable, ScrollView, StyleSheet, View } from 'react-native'; import { useNavigation, useRoute, type RouteProp } from '@react-navigation/native'; import type { NativeStackNavigationProp } from '@react-navigation/native-stack'; import { AlertTriangle, BellOff, Copy, QrCode, RefreshCw, ScanLine, ShieldCheck, Smartphone, Trash2, Wifi, WifiOff, } from 'lucide-react-native'; import Clipboard from '@react-native-clipboard/clipboard'; import { useAlarm, useSubscriptions } from '../state/AlarmContext'; import { useConnection } from '../state/ConnectionContext'; import * as api from '../services/alarmApi'; import { formatAutoStop } from '../services/alarmApi'; import { relativeSince } from '../lib/time'; import { truncateToken } from '../lib/qrPayload'; import { TriggerPad } from '../components/TriggerPad'; import { AppText, Button, Card, Divider, EmptyState, ErrorBanner, Field, Header, IconLine, LoadingView, OfflineStrip, StatePill, StateRing, TextInputBox, } from '../components/ui'; import type { RootStackParamList } from '../navigation'; import { bg, border, danger, focusRing, minTapTarget, radiusLg, radiusMd, space1, space2, space3, space4, space6, stateArmed, stateDisarmed, surfaceRaised, text, textFaint, textMuted, textSecondary, typeBodyStrong, typeCaption, typeCode, typeHeading, typeMicro, warn, type AlarmState, } from '../theme/tokens'; type Nav = NativeStackNavigationProp; type Rt = RouteProp; const NEW = 'new'; export default function AlertDetailScreen() { const navigation = useNavigation