@bsv/expo-wallet-toolbox 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/LICENSE.txt +28 -0
  2. package/README.md +512 -0
  3. package/assets/sounds/payment-receive.wav +0 -0
  4. package/assets/sounds/payment-send.wav +0 -0
  5. package/assets/sounds/vault-close.wav +0 -0
  6. package/assets/sounds/vault-open.wav +0 -0
  7. package/core/amountFormatHelpers.ts +330 -0
  8. package/core/backup/RemoteSyncReader.ts +94 -0
  9. package/core/backup/client.ts +111 -0
  10. package/core/backup/codec.ts +218 -0
  11. package/core/backup/constants.ts +88 -0
  12. package/core/backup/cursor.ts +138 -0
  13. package/core/backup/derive.ts +46 -0
  14. package/core/backup/deviceId.ts +33 -0
  15. package/core/backup/erase.ts +67 -0
  16. package/core/backup/preference.ts +33 -0
  17. package/core/backup/push.ts +295 -0
  18. package/core/backup/restore.ts +152 -0
  19. package/core/backup/restoreOnImport.ts +119 -0
  20. package/core/backup/status.ts +46 -0
  21. package/core/config.tsx +47 -0
  22. package/core/constants.ts +35 -0
  23. package/core/context/ExchangeRateContext.tsx +69 -0
  24. package/core/context/LocalStorageProvider.tsx +225 -0
  25. package/core/context/UserContext.tsx +129 -0
  26. package/core/context/VaultContext.tsx +79 -0
  27. package/core/context/WalletConnectionContext.tsx +454 -0
  28. package/core/context/WalletContext.tsx +2938 -0
  29. package/core/context/buildGeneration.ts +37 -0
  30. package/core/deviceTier.ts +89 -0
  31. package/core/diskSpace.ts +62 -0
  32. package/core/displayCurrencies.ts +56 -0
  33. package/core/headers/OfflineFirstChaintracks.ts +176 -0
  34. package/core/headers/checkpoints.ts +39 -0
  35. package/core/headers/fs.ts +119 -0
  36. package/core/headers/headerStore.ts +333 -0
  37. package/core/headers/prewarm.ts +36 -0
  38. package/core/headers/syncHeaders.ts +73 -0
  39. package/core/hooks/useConfirmationSound.ts +135 -0
  40. package/core/hooks/useHaptics.ts +51 -0
  41. package/core/hooks/usePermissionQueue.ts +69 -0
  42. package/core/i18n/translations.tsx +6692 -0
  43. package/core/index.ts +295 -0
  44. package/core/localpay/blePermissions.ts +32 -0
  45. package/core/localpay/build.ts +392 -0
  46. package/core/localpay/codec.ts +338 -0
  47. package/core/localpay/deviceCaps.ts +175 -0
  48. package/core/localpay/nearbyAdvisory.ts +32 -0
  49. package/core/localpay/nearbyPermissions.ts +34 -0
  50. package/core/localpay/pending.ts +385 -0
  51. package/core/localpay/pendingAborts.ts +67 -0
  52. package/core/localpay/qr.ts +16 -0
  53. package/core/localpay/session.ts +277 -0
  54. package/core/localpay/sessionPolicy.ts +5 -0
  55. package/core/localpay/transport/awdl.ts +11 -0
  56. package/core/localpay/transport/ble.ts +159 -0
  57. package/core/localpay/transport/nearby.ts +12 -0
  58. package/core/localpay/transport/race.ts +110 -0
  59. package/core/localpay/transport/select.ts +128 -0
  60. package/core/localpay/transport/socket.ts +244 -0
  61. package/core/localpay/types.ts +82 -0
  62. package/core/localpay/verify.ts +204 -0
  63. package/core/logging.config.ts +10 -0
  64. package/core/logging.ts +77 -0
  65. package/core/mnemonicWallet.ts +180 -0
  66. package/core/monitor/TaskBackupPush.ts +168 -0
  67. package/core/monitor/TaskCreditInbox.ts +116 -0
  68. package/core/monitor/TaskDrainOutbox.ts +122 -0
  69. package/core/monitor/TaskSendOffline.ts +123 -0
  70. package/core/monitor/unfailRetry.ts +116 -0
  71. package/core/net/chainMatch.ts +34 -0
  72. package/core/net/online.ts +34 -0
  73. package/core/offline/cancelParked.ts +56 -0
  74. package/core/offline/hold.ts +127 -0
  75. package/core/offline/order.ts +109 -0
  76. package/core/offline/payerHold.ts +144 -0
  77. package/core/offline/plan.ts +264 -0
  78. package/core/offline/queueGrace.ts +52 -0
  79. package/core/parsePeerPayURI.ts +119 -0
  80. package/core/pay/beefRepair.ts +106 -0
  81. package/core/pay/creditErrors.ts +46 -0
  82. package/core/pay/creditInbox.ts +202 -0
  83. package/core/pay/damagedInbox.ts +64 -0
  84. package/core/pay/proofNudge.ts +23 -0
  85. package/core/pay/provenTxFromBump.ts +31 -0
  86. package/core/pay/rails/address.ts +329 -0
  87. package/core/pay/rails/handle.ts +617 -0
  88. package/core/pay/rails/index.ts +197 -0
  89. package/core/pay/rails/nearby.ts +79 -0
  90. package/core/pay/receiveFocus.ts +13 -0
  91. package/core/pay/recordProof.ts +91 -0
  92. package/core/pay/refreshProofGuard.ts +34 -0
  93. package/core/pay/sweeper.ts +75 -0
  94. package/core/pay/tokenAmount.ts +18 -0
  95. package/core/pay/userError.ts +18 -0
  96. package/core/pay/watchlist.ts +126 -0
  97. package/core/peerpay/control.ts +122 -0
  98. package/core/peerpay/handleResendRequests.ts +475 -0
  99. package/core/peerpay/inboxAttempts.ts +33 -0
  100. package/core/peerpay/metadataDecryptor.ts +42 -0
  101. package/core/peerpay/offlineNacks.ts +96 -0
  102. package/core/peerpay/outbox.ts +209 -0
  103. package/core/peerpay/rebuildToken.ts +76 -0
  104. package/core/peerpay/resendBeef.ts +115 -0
  105. package/core/services/arcadeBroadcastProvider.ts +214 -0
  106. package/core/services/capWalletArgs.ts +99 -0
  107. package/core/services/exchangeRate.ts +63 -0
  108. package/core/services/secrets/envelope.ts +102 -0
  109. package/core/services/secrets/hkdf.ts +37 -0
  110. package/core/services/secrets/index.ts +63 -0
  111. package/core/services/secrets/kek.ts +274 -0
  112. package/core/services/secrets/migration.ts +188 -0
  113. package/core/services/secrets/policy.ts +120 -0
  114. package/core/services/secrets/storage.ts +54 -0
  115. package/core/services/secrets/store.ts +125 -0
  116. package/core/services/secrets/types.ts +85 -0
  117. package/core/services/usdFxRates.ts +101 -0
  118. package/core/services/vault/VaultKeyService.ts +312 -0
  119. package/core/services/vault/backupAttestation.ts +136 -0
  120. package/core/services/vault/ceremony.ts +972 -0
  121. package/core/services/vault/ceremonyHost.ts +46 -0
  122. package/core/services/vault/devMock.ts +22 -0
  123. package/core/services/vault/driver.ts +197 -0
  124. package/core/services/vault/guard.ts +90 -0
  125. package/core/services/vault/k1.ts +75 -0
  126. package/core/services/vault/mockYubiKey.ts +217 -0
  127. package/core/services/vault/random.ts +20 -0
  128. package/core/services/vault/sealing.ts +84 -0
  129. package/core/services/vault/session.ts +59 -0
  130. package/core/services/vault/transfers.ts +1151 -0
  131. package/core/services/vault/types.ts +109 -0
  132. package/core/services/vault/vaultDerivation.ts +152 -0
  133. package/core/services/vault/vaultPassphrase.ts +287 -0
  134. package/core/services/vault/vaultStore.ts +104 -0
  135. package/core/services/walletArgLimits.ts +234 -0
  136. package/core/services/walletServiceConfig.ts +170 -0
  137. package/core/storage/LocalStorageAdapter.ts +58 -0
  138. package/core/storage/README.md +391 -0
  139. package/core/storage/StorageExpoSQLite.ts +2008 -0
  140. package/core/storage/errors.ts +73 -0
  141. package/core/storage/index.ts +3 -0
  142. package/core/storage/methods/findSql.ts +286 -0
  143. package/core/storage/methods/historyNotes.ts +61 -0
  144. package/core/storage/methods/listActionsSql.ts +212 -0
  145. package/core/storage/methods/listOutputsSql.ts +211 -0
  146. package/core/storage/methods/offlineActions.ts +156 -0
  147. package/core/storage/methods/processOfflineActions.ts +503 -0
  148. package/core/storage/methods/reclaim.ts +135 -0
  149. package/core/storage/methods/reviewStatusSql.ts +167 -0
  150. package/core/storage/methods/unprovenWithoutReqSql.ts +26 -0
  151. package/core/storage/methods/walletBalanceSql.ts +55 -0
  152. package/core/storage/schema/createTables.ts +385 -0
  153. package/core/storage/skipQueuedAncestors.ts +29 -0
  154. package/core/storage/sqlUpdateValue.ts +12 -0
  155. package/core/stores/ConnectionStore.ts +71 -0
  156. package/core/theme/ThemeContext.tsx +182 -0
  157. package/core/theme/assertThemeContrast.ts +109 -0
  158. package/core/theme/motion.ts +50 -0
  159. package/core/theme/tokens.ts +232 -0
  160. package/core/theme/useThemeStyles.tsx +156 -0
  161. package/core/walletDbRegistry.ts +110 -0
  162. package/core/walletMonitor.ts +149 -0
  163. package/core/walletRepair/runWalletCheck.ts +195 -0
  164. package/core/walletRepair/shouldReleaseUtxo.ts +18 -0
  165. package/package.json +86 -0
  166. package/ui/backupShares.ts +367 -0
  167. package/ui/components/QRScanner.tsx +353 -0
  168. package/ui/components/pay/AddressReceive.tsx +507 -0
  169. package/ui/components/pay/AvailableBalance.tsx +61 -0
  170. package/ui/components/pay/HandleReceive.tsx +896 -0
  171. package/ui/components/pay/MessageBoxConfig.tsx +256 -0
  172. package/ui/components/pay/NearbyAdvisoryModal.tsx +111 -0
  173. package/ui/components/pay/NearbyFlow.tsx +2542 -0
  174. package/ui/components/pay/OfflineNotice.tsx +337 -0
  175. package/ui/components/pay/PayCellRow.tsx +101 -0
  176. package/ui/components/pay/PayForm.tsx +223 -0
  177. package/ui/components/pay/PaymentQrDisplay.tsx +105 -0
  178. package/ui/components/pay/PaymentSuccessOverlay.tsx +266 -0
  179. package/ui/components/pay/RecipientField.tsx +308 -0
  180. package/ui/components/pay/RequestHub.tsx +75 -0
  181. package/ui/components/pay/ResultBanner.tsx +69 -0
  182. package/ui/components/pay/UniversalSend.tsx +687 -0
  183. package/ui/components/pay/useRecipientInput.ts +270 -0
  184. package/ui/components/security/WalletLockNotice.tsx +138 -0
  185. package/ui/components/ui/AlertCard.tsx +223 -0
  186. package/ui/components/ui/AppLogo.tsx +166 -0
  187. package/ui/components/ui/BlurChrome.tsx +72 -0
  188. package/ui/components/ui/Celebration.tsx +84 -0
  189. package/ui/components/ui/ChoiceSheet.ts +69 -0
  190. package/ui/components/ui/CustomSafeArea.tsx +74 -0
  191. package/ui/components/ui/ErrorBoundary.tsx +154 -0
  192. package/ui/components/ui/GroupedList.tsx +125 -0
  193. package/ui/components/ui/IconButton.tsx +105 -0
  194. package/ui/components/ui/ListRow.tsx +197 -0
  195. package/ui/components/ui/PermissionSheet.tsx +920 -0
  196. package/ui/components/ui/PresenceRow.tsx +215 -0
  197. package/ui/components/ui/PressableScale.tsx +105 -0
  198. package/ui/components/ui/ScreenGradient.tsx +47 -0
  199. package/ui/components/ui/ScrollFade.tsx +76 -0
  200. package/ui/components/ui/Sheet.tsx +342 -0
  201. package/ui/components/ui/Toast.tsx +142 -0
  202. package/ui/components/ui/index.ts +8 -0
  203. package/ui/components/vault/EnrollWizard.tsx +627 -0
  204. package/ui/components/vault/PassphraseField.tsx +306 -0
  205. package/ui/components/vault/PhraseBackupSheet.tsx +227 -0
  206. package/ui/components/vault/VaultBackdrop.tsx +354 -0
  207. package/ui/components/vault/VaultCeremonySheet.tsx +327 -0
  208. package/ui/components/wallet/ActivityRow.tsx +408 -0
  209. package/ui/components/wallet/AmountDisplay.tsx +48 -0
  210. package/ui/components/wallet/AmountInput.tsx +256 -0
  211. package/ui/components/wallet/BackupReminderSheet.tsx +168 -0
  212. package/ui/components/wallet/Balance.tsx +144 -0
  213. package/ui/components/wallet/BiometricAdvisoryModal.tsx +133 -0
  214. package/ui/components/wallet/ImportFromBackupPrompt.tsx +93 -0
  215. package/ui/exportDatabases.ts +122 -0
  216. package/ui/exportTransactions.ts +129 -0
  217. package/ui/hooks/useOfflineNoticeActions.ts +136 -0
  218. package/ui/hooks/useOnline.ts +70 -0
  219. package/ui/hooks/useSpendableBalance.ts +58 -0
  220. package/ui/hooks/useVaultBalance.ts +50 -0
  221. package/ui/importDatabases.ts +170 -0
  222. package/ui/index.ts +136 -0
  223. package/ui/isImageUrl.ts +10 -0
  224. package/ui/printRecoveryShares.ts +93 -0
  225. package/ui/resolveIdentity.ts +125 -0
  226. package/ui/screens/ConnectionsScreen.tsx +438 -0
  227. package/ui/screens/LogsScreen.tsx +432 -0
  228. package/ui/screens/PairScreen.tsx +288 -0
  229. package/ui/screens/PayScreen.tsx +479 -0
  230. package/ui/screens/SettingsScreen.tsx +180 -0
  231. package/ui/screens/TrustScreen.tsx +831 -0
  232. package/ui/screens/VaultRecoverScreen.tsx +226 -0
  233. package/ui/screens/VaultScreen.tsx +423 -0
  234. package/ui/screens/VaultTransferScreen.tsx +293 -0
  235. package/ui/screens/WalletCheckScreen.tsx +539 -0
  236. package/ui/screens/WalletConfigScreen.tsx +1095 -0
  237. package/ui/screens/WalletHomeScreen.tsx +1597 -0
  238. package/ui/screens/homeBadges.ts +18 -0
  239. package/ui/txStatus.ts +79 -0
  240. package/ui/validateTrust.ts +44 -0
@@ -0,0 +1,353 @@
1
+ import React, { useRef, useCallback } from 'react'
2
+ import { View, Text, TouchableOpacity, StyleSheet, Linking } from 'react-native'
3
+ import { useTranslation } from 'react-i18next'
4
+ import { haptics, useTheme, spacing, typography } from '@bsv/expo-wallet-toolbox'
5
+
6
+ /**
7
+ * expo-camera is a native module that this file is barrel-exported alongside
8
+ * (the `ui` package's index re-exports it for app-level consumers), so a
9
+ * static top-level import would pull its native bindings into every test that
10
+ * touches the barrel, even one that never renders a scanner. Loaded lazily,
11
+ * only when the component actually renders, same pattern as this package's
12
+ * other native-module-boundary fixes (expo-router, expo-blur). `useCameraPermissions`
13
+ * is a hook, but calling it via `loadExpoCamera().useCameraPermissions()` is
14
+ * rules-of-hooks-safe for the same reason `loadExpoRouter().useFocusEffect(...)`
15
+ * is in WalletHomeScreen.tsx: the module is cached after the first call, so
16
+ * every render calls the exact same function reference, unconditionally.
17
+ */
18
+ type ExpoCameraModule = typeof import('expo-camera')
19
+ let expoCameraMod: ExpoCameraModule | undefined
20
+ function loadExpoCamera(): ExpoCameraModule {
21
+ if (!expoCameraMod) {
22
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
23
+ expoCameraMod = require('expo-camera') as ExpoCameraModule
24
+ }
25
+ return expoCameraMod
26
+ }
27
+
28
+ /**
29
+ * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
30
+ * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
31
+ * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
32
+ * Ionicons is loaded lazily, only when actually rendering, same pattern as
33
+ * this package's other native-module-boundary fixes (expo-router, expo-blur).
34
+ */
35
+ type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
36
+ let ioniconsComponent: IoniconsComponent | undefined
37
+ function loadIonicons(): IoniconsComponent {
38
+ if (!ioniconsComponent) {
39
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
40
+ ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
41
+ }
42
+ return ioniconsComponent
43
+ }
44
+
45
+ /* -------------------------------------------------------------------------- */
46
+ /* Types */
47
+ /* -------------------------------------------------------------------------- */
48
+
49
+ interface QRScannerProps {
50
+ /** Called with the raw barcode string. Caller is responsible for validation. */
51
+ onScan: (data: string) => void
52
+ /** Dismiss the scanner. */
53
+ onClose: () => void
54
+ /** Hint text shown below the finder window. Falls back to a generic i18n key. */
55
+ hintText?: string
56
+ /**
57
+ * When true the scanner keeps accepting barcodes after each `onScan` call
58
+ * (e.g. for multi-share Shamir recovery or scans that need caller-side
59
+ * validation before closing). When false (default) scanning is disabled
60
+ * after the first successful read.
61
+ */
62
+ multiScan?: boolean
63
+ /**
64
+ * Forward every recognised barcode immediately — no scan lock, no per-read
65
+ * haptic. For animated multi-part codes (~5 reads/s): the lock would cap
66
+ * assembly below 1 part/1.5 s, and per-read haptics would buzz constantly.
67
+ * The caller owns dedupe and completion.
68
+ */
69
+ continuous?: boolean
70
+ /**
71
+ * Optional render callback for extra content in the bottom overlay area,
72
+ * rendered below the hint text. Useful for progress dots, error banners, etc.
73
+ */
74
+ renderBottom?: () => React.ReactNode
75
+ }
76
+
77
+ /* -------------------------------------------------------------------------- */
78
+ /* Constants */
79
+ /* -------------------------------------------------------------------------- */
80
+
81
+ const SCAN_WINDOW_SIZE = 260
82
+ const CORNER_SIZE = 24
83
+ const CORNER_THICKNESS = 3
84
+ const SCAN_LOCK_DELAY_MS = 1500
85
+
86
+ /* -------------------------------------------------------------------------- */
87
+ /* Component */
88
+ /* -------------------------------------------------------------------------- */
89
+
90
+ export default function QRScanner({
91
+ onScan,
92
+ onClose,
93
+ hintText,
94
+ multiScan = false,
95
+ continuous = false,
96
+ renderBottom
97
+ }: QRScannerProps) {
98
+ const { t } = useTranslation()
99
+ const { colors } = useTheme()
100
+ const Ionicons = loadIonicons()
101
+ const { CameraView, useCameraPermissions } = loadExpoCamera()
102
+ const [permission, requestPermission] = useCameraPermissions()
103
+
104
+ // Prevent rapid-fire duplicate scans
105
+ const scanLockRef = useRef(false)
106
+ const stoppedRef = useRef(false)
107
+
108
+ const handleBarCodeScanned = useCallback(
109
+ ({ data }: { data: string }) => {
110
+ if (continuous) {
111
+ if (stoppedRef.current) return
112
+ onScan(data)
113
+ return
114
+ }
115
+
116
+ if (scanLockRef.current || stoppedRef.current) return
117
+ scanLockRef.current = true
118
+
119
+ // tap = recognition pulse; avoids double-fire with callers that fire
120
+ // their own success/error haptic in onScan (e.g. scan-shares.tsx)
121
+ haptics.tap()
122
+ onScan(data)
123
+
124
+ if (!multiScan) {
125
+ // Single-scan mode: stop scanning permanently (caller should close)
126
+ stoppedRef.current = true
127
+ } else {
128
+ // Multi-scan mode: re-enable after a brief delay
129
+ setTimeout(() => {
130
+ scanLockRef.current = false
131
+ }, SCAN_LOCK_DELAY_MS)
132
+ }
133
+ },
134
+ [onScan, multiScan, continuous]
135
+ )
136
+
137
+ /* ── Permission not yet determined ─────────────────────────────────────── */
138
+ if (!permission) {
139
+ return <View style={styles.fill} />
140
+ }
141
+
142
+ /* ── Permission denied permanently — link to Settings ──────────────────── */
143
+ if (!permission.granted && !permission.canAskAgain) {
144
+ return (
145
+ <View style={styles.permScreen}>
146
+ <View style={styles.permIconWrap}>
147
+ <Ionicons name="camera-outline" size={40} color="#fff" />
148
+ </View>
149
+ <Text style={styles.permTitle}>{t('scan_shares_camera_needed')}</Text>
150
+ <Text style={styles.permBody}>{t('camera_denied_description')}</Text>
151
+ <TouchableOpacity style={styles.permBtn} onPress={() => Linking.openSettings()}>
152
+ <Text style={styles.permBtnText}>{t('open_settings')}</Text>
153
+ </TouchableOpacity>
154
+ <TouchableOpacity style={{ marginTop: spacing.lg }} onPress={onClose}>
155
+ <Text style={styles.permBack}>{t('go_back')}</Text>
156
+ </TouchableOpacity>
157
+ </View>
158
+ )
159
+ }
160
+
161
+ /* ── Permission not yet granted — pre-permission explanation ─────────── */
162
+ if (!permission.granted) {
163
+ return (
164
+ <View style={styles.permScreen}>
165
+ <View style={styles.permIconWrap}>
166
+ <Ionicons name="camera-outline" size={40} color="#fff" />
167
+ </View>
168
+ <Text style={styles.permTitle}>{t('scan_shares_camera_needed')}</Text>
169
+ <Text style={styles.permBody}>{t('scan_shares_camera_description')}</Text>
170
+ <TouchableOpacity style={styles.permBtn} onPress={requestPermission}>
171
+ <Text style={styles.permBtnText}>{t('continue_action')}</Text>
172
+ </TouchableOpacity>
173
+ </View>
174
+ )
175
+ }
176
+
177
+ /* ── Camera + overlay ──────────────────────────────────────────────────── */
178
+ return (
179
+ <View style={styles.fill}>
180
+ <CameraView
181
+ style={StyleSheet.absoluteFill}
182
+ facing="back"
183
+ barcodeScannerSettings={{ barcodeTypes: ['qr'] }}
184
+ onBarcodeScanned={handleBarCodeScanned}
185
+ />
186
+
187
+ {/* Dark overlay with cutout */}
188
+ <View style={styles.overlay}>
189
+ {/* Top bar */}
190
+ <View style={styles.overlayTop}>
191
+ <TouchableOpacity style={styles.closeButton} onPress={onClose}>
192
+ <Ionicons name="close" size={26} color="#fff" />
193
+ </TouchableOpacity>
194
+ </View>
195
+
196
+ {/* Center row with cutout */}
197
+ <View style={styles.overlayMiddle}>
198
+ <View style={styles.overlaySide} />
199
+ <View style={styles.scanWindow}>
200
+ <View style={[styles.corner, styles.cornerTL]} />
201
+ <View style={[styles.corner, styles.cornerTR]} />
202
+ <View style={[styles.corner, styles.cornerBL]} />
203
+ <View style={[styles.corner, styles.cornerBR]} />
204
+ </View>
205
+ <View style={styles.overlaySide} />
206
+ </View>
207
+
208
+ {/* Bottom info */}
209
+ <View style={styles.overlayBottom}>
210
+ <Text style={styles.hintText}>{hintText ?? t('scan_qr_default_hint')}</Text>
211
+ {renderBottom?.()}
212
+ </View>
213
+ </View>
214
+ </View>
215
+ )
216
+ }
217
+
218
+ /* -------------------------------------------------------------------------- */
219
+ /* Styles */
220
+ /* -------------------------------------------------------------------------- */
221
+
222
+ const styles = StyleSheet.create({
223
+ fill: {
224
+ flex: 1,
225
+ backgroundColor: '#000'
226
+ },
227
+
228
+ // ── Permission screen ──────────────────────────────────────────────────
229
+ permScreen: {
230
+ flex: 1,
231
+ backgroundColor: '#000',
232
+ alignItems: 'center',
233
+ justifyContent: 'center',
234
+ paddingHorizontal: spacing.xxxl
235
+ },
236
+ permIconWrap: {
237
+ width: 80,
238
+ height: 80,
239
+ borderRadius: 40,
240
+ backgroundColor: 'rgba(255,255,255,0.1)',
241
+ alignItems: 'center',
242
+ justifyContent: 'center',
243
+ marginBottom: spacing.xxl
244
+ },
245
+ permTitle: {
246
+ ...typography.headline,
247
+ color: '#fff',
248
+ textAlign: 'center',
249
+ marginBottom: spacing.sm
250
+ },
251
+ permBody: {
252
+ ...typography.subhead,
253
+ color: 'rgba(255,255,255,0.6)',
254
+ textAlign: 'center',
255
+ marginBottom: spacing.xxl
256
+ },
257
+ permBtn: {
258
+ backgroundColor: '#007AFF',
259
+ borderRadius: 12,
260
+ paddingVertical: spacing.md,
261
+ paddingHorizontal: spacing.xxxl
262
+ },
263
+ permBtnText: {
264
+ ...typography.headline,
265
+ color: '#fff'
266
+ },
267
+ permBack: {
268
+ ...typography.subhead,
269
+ color: 'rgba(255,255,255,0.5)'
270
+ },
271
+
272
+ // ── Scanner overlay ────────────────────────────────────────────────────
273
+ overlay: {
274
+ ...StyleSheet.absoluteFillObject,
275
+ justifyContent: 'space-between'
276
+ },
277
+ overlayTop: {
278
+ flex: 1,
279
+ backgroundColor: 'rgba(0,0,0,0.55)',
280
+ justifyContent: 'flex-start',
281
+ paddingTop: 60,
282
+ paddingHorizontal: spacing.lg
283
+ },
284
+ closeButton: {
285
+ width: 44,
286
+ height: 44,
287
+ borderRadius: 22,
288
+ backgroundColor: 'rgba(0,0,0,0.4)',
289
+ alignItems: 'center',
290
+ justifyContent: 'center'
291
+ },
292
+ overlayMiddle: {
293
+ flexDirection: 'row',
294
+ height: SCAN_WINDOW_SIZE
295
+ },
296
+ overlaySide: {
297
+ flex: 1,
298
+ backgroundColor: 'rgba(0,0,0,0.55)'
299
+ },
300
+ scanWindow: {
301
+ width: SCAN_WINDOW_SIZE,
302
+ height: SCAN_WINDOW_SIZE
303
+ },
304
+ overlayBottom: {
305
+ flex: 1,
306
+ backgroundColor: 'rgba(0,0,0,0.55)',
307
+ alignItems: 'center',
308
+ paddingTop: spacing.xxl,
309
+ paddingHorizontal: spacing.xl
310
+ },
311
+
312
+ // ── Corner marks ───────────────────────────────────────────────────────
313
+ corner: {
314
+ position: 'absolute',
315
+ width: CORNER_SIZE,
316
+ height: CORNER_SIZE
317
+ },
318
+ cornerTL: {
319
+ top: 0,
320
+ left: 0,
321
+ borderTopWidth: CORNER_THICKNESS,
322
+ borderLeftWidth: CORNER_THICKNESS,
323
+ borderColor: '#fff'
324
+ },
325
+ cornerTR: {
326
+ top: 0,
327
+ right: 0,
328
+ borderTopWidth: CORNER_THICKNESS,
329
+ borderRightWidth: CORNER_THICKNESS,
330
+ borderColor: '#fff'
331
+ },
332
+ cornerBL: {
333
+ bottom: 0,
334
+ left: 0,
335
+ borderBottomWidth: CORNER_THICKNESS,
336
+ borderLeftWidth: CORNER_THICKNESS,
337
+ borderColor: '#fff'
338
+ },
339
+ cornerBR: {
340
+ bottom: 0,
341
+ right: 0,
342
+ borderBottomWidth: CORNER_THICKNESS,
343
+ borderRightWidth: CORNER_THICKNESS,
344
+ borderColor: '#fff'
345
+ },
346
+
347
+ // ── Hint text ──────────────────────────────────────────────────────────
348
+ hintText: {
349
+ ...typography.subhead,
350
+ color: 'rgba(255,255,255,0.8)',
351
+ textAlign: 'center'
352
+ }
353
+ })