@bsv/expo-wallet-toolbox 0.25.1 → 0.26.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 (43) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/core/context/WalletContext.tsx +3 -1
  3. package/core/i18n/translations.tsx +221 -36
  4. package/core/identity/handleRegistry/client.ts +110 -16
  5. package/core/identity/handleRegistry/registration.ts +115 -17
  6. package/core/profiles/profileStore.ts +4 -1
  7. package/core/services/groupSpendingLimit.ts +26 -0
  8. package/core/services/signingPermissionPolicy.ts +14 -8
  9. package/core/services/vault/ceremony.ts +13 -0
  10. package/core/services/vault/ceremonyHost.ts +58 -0
  11. package/core/services/vault/failedVaultSpend.ts +40 -0
  12. package/core/services/vault/outputAuthority.ts +13 -6
  13. package/core/services/vault/transfers.ts +56 -12
  14. package/core/storage/encryptedDbImage.ts +11 -2
  15. package/core/theme/tokens.ts +26 -12
  16. package/package.json +2 -1
  17. package/ui/components/QRScanner.tsx +24 -22
  18. package/ui/components/pay/MessageBoxConfig.tsx +10 -16
  19. package/ui/components/pay/NearbyAdvisoryModal.tsx +6 -13
  20. package/ui/components/pay/NearbyFlow.tsx +72 -35
  21. package/ui/components/pay/PayForm.tsx +27 -19
  22. package/ui/components/pay/PaymentSuccessOverlay.tsx +8 -6
  23. package/ui/components/pay/UniversalSend.tsx +4 -1
  24. package/ui/components/ui/AlertCard.tsx +3 -2
  25. package/ui/components/ui/BalancedText.tsx +117 -0
  26. package/ui/components/ui/ErrorBoundary.tsx +31 -14
  27. package/ui/components/ui/GroupedList.tsx +28 -22
  28. package/ui/components/ui/ListRow.tsx +126 -35
  29. package/ui/components/ui/PermissionSheet.tsx +31 -24
  30. package/ui/components/ui/PresenceRow.tsx +15 -23
  31. package/ui/components/ui/Sheet.tsx +11 -17
  32. package/ui/components/ui/Toast.tsx +13 -17
  33. package/ui/components/vault/EnrollWizard.tsx +446 -196
  34. package/ui/components/vault/KeyChooser.tsx +7 -20
  35. package/ui/components/vault/VaultCeremonySheet.tsx +44 -36
  36. package/ui/components/wallet/AmountInput.tsx +11 -17
  37. package/ui/components/wallet/BiometricAdvisoryModal.tsx +13 -17
  38. package/ui/index.ts +1 -1
  39. package/ui/screens/TrustScreen.tsx +49 -61
  40. package/ui/screens/VaultScreen.tsx +99 -60
  41. package/ui/screens/VaultTransferScreen.tsx +34 -27
  42. package/ui/screens/WalletCheckScreen.tsx +25 -24
  43. package/ui/screens/WalletConfigScreen.tsx +66 -72
@@ -196,20 +196,49 @@ import type { AmountInputAsset } from '../wallet/AmountInput'
196
196
  import type { DismissTarget } from '../../dismissTarget'
197
197
 
198
198
  /**
199
- * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
200
- * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
201
- * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
202
- * Ionicons is loaded lazily, only when actually rendering, same pattern as
203
- * this package's other native-module-boundary fixes (expo-router, expo-blur).
199
+ * Every glyph this flow draws comes from lucide, as the rest of this app does
200
+ * (src/settings/Rows.tsx, the headers, the sheets). Two icon families in one
201
+ * flow is visible at a glance: Ionicons' filled-corner, closed shapes next to
202
+ * lucide's open 2px strokes read as two apps.
203
+ *
204
+ * Imported at module scope rather than behind a lazy loader. What had to be
205
+ * deferred is @expo/vector-icons' index barrel, which re-exports every icon
206
+ * set and so reaches expo-font -> expo-asset as untransformed ESM; nothing
207
+ * here pulls that barrel in any more. lucide publishes both module formats
208
+ * and Jest resolves the ESM one, so the app pins this name to lucide's CJS
209
+ * entry in jest.moduleNameMapper (package.json), as it already does for its
210
+ * other ESM-only dependencies. Only the glyph-name type below still refers to
211
+ * @expo/vector-icons, and a `typeof import(...)` type is erased at compile
212
+ * time.
213
+ *
214
+ * The button props stay Ionicons names, because that is what every call site
215
+ * in this file passes; this maps each one to its nearest lucide counterpart.
204
216
  */
217
+ import {
218
+ ArrowUp,
219
+ CircleAlert,
220
+ CircleCheckBig,
221
+ Clock,
222
+ CloudOff,
223
+ Info,
224
+ QrCode,
225
+ RefreshCw,
226
+ ScanLine,
227
+ Settings,
228
+ Wallet,
229
+ Wrench,
230
+ type LucideIcon
231
+ } from 'lucide-react-native'
232
+
205
233
  type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
206
- let ioniconsComponent: IoniconsComponent | undefined
207
- function loadIonicons(): IoniconsComponent {
208
- if (!ioniconsComponent) {
209
- // eslint-disable-next-line @typescript-eslint/no-require-imports
210
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
211
- }
212
- return ioniconsComponent
234
+
235
+ const LUCIDE: Record<string, LucideIcon> = {
236
+ 'arrow-up': ArrowUp,
237
+ construct: Wrench,
238
+ 'qr-code-outline': QrCode,
239
+ refresh: RefreshCw,
240
+ 'scan-outline': ScanLine,
241
+ 'settings-outline': Settings
213
242
  }
214
243
 
215
244
  /**
@@ -364,10 +393,10 @@ const FLOOR_KEYS: Record<Exclude<FloorReason, 'none'>, string> = {
364
393
  cross_os_no_ble: 'local_pay_floor_cross_os'
365
394
  }
366
395
 
367
- const NOTICE_ICONS: Record<NoticeTone, keyof IoniconsComponent['glyphMap']> = {
368
- success: 'wallet',
369
- info: 'time-outline',
370
- warning: 'cloud-offline-outline'
396
+ const NOTICE_ICONS: Record<NoticeTone, LucideIcon> = {
397
+ success: Wallet,
398
+ info: Clock,
399
+ warning: CloudOff
371
400
  }
372
401
 
373
402
  // ── Helpers ──
@@ -635,8 +664,13 @@ export interface NearbyFlowProps {
635
664
  * `onBusy` reports when a payment is in hand (the payer's-code scanner,
636
665
  * saving, the paid overlay, a failure): the host must not remount or
637
666
  * unmount the flow then — no new amount, no switching away.
667
+ *
668
+ * `renderQr` draws the pairing code in the host's own style (its card, a
669
+ * mark in the middle) in place of the built-in one. It is handed the code's
670
+ * text and must render it at `qrSize` with error correction that survives
671
+ * whatever it draws over it.
638
672
  */
639
- embedded?: { qrSize?: number; onBusy?: (busy: boolean) => void }
673
+ embedded?: { qrSize?: number; onBusy?: (busy: boolean) => void; renderQr?: (value: string) => React.ReactNode }
640
674
  /**
641
675
  * Payer only: draw these steps yourself, in the host's own style. Each is
642
676
  * optional; a step without one shows the built-in screen. The logic stays
@@ -668,7 +702,6 @@ function NearbyFlow({
668
702
  }: NearbyFlowProps) {
669
703
  const { t } = useTranslation()
670
704
  const { colors } = useTheme()
671
- const Ionicons = loadIonicons()
672
705
  const QRCode = loadQRCode()
673
706
  const StatusBar = loadStatusBar()
674
707
  const { router, useFocusEffect, useNavigation } = loadExpoRouter()
@@ -2821,7 +2854,7 @@ function NearbyFlow({
2821
2854
  ]}
2822
2855
  accessibilityRole="text"
2823
2856
  >
2824
- <Ionicons name={NOTICE_ICONS[n.tone]} size={16} color={tint} />
2857
+ {React.createElement(NOTICE_ICONS[n.tone], { size: 16, color: tint })}
2825
2858
  <Text style={[styles.noticeText, { color: n.tone === 'info' ? colors.textSecondary : tint }]}>{n.text}</Text>
2826
2859
  </Animated.View>
2827
2860
  )
@@ -2842,7 +2875,7 @@ function NearbyFlow({
2842
2875
  {phase === 'entry' && initialRole === 'payer' && (
2843
2876
  <Animated.View entering={settleIn} style={styles.stage}>
2844
2877
  <View style={[styles.heroCircle, { backgroundColor: colors.fillTertiary }]}>
2845
- <Ionicons name="qr-code-outline" size={44} color={colors.textSecondary} />
2878
+ <QrCode size={44} color={colors.textSecondary} />
2846
2879
  </View>
2847
2880
  <View style={styles.gapLg} />
2848
2881
  {phaseTitle(t('local_pay_scan_qr'))}
@@ -2973,7 +3006,7 @@ function NearbyFlow({
2973
3006
  style={[styles.qrError, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
2974
3007
  accessibilityRole="alert"
2975
3008
  >
2976
- <Ionicons name="alert-circle-outline" size={28} color={colors.error} />
3009
+ <CircleAlert size={28} color={colors.error} />
2977
3010
  <View style={styles.gapSm} />
2978
3011
  <Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_qr_unavailable')}</Text>
2979
3012
  </View>
@@ -3000,7 +3033,7 @@ function NearbyFlow({
3000
3033
  style={[styles.notice, { backgroundColor: colors.error + '15', borderColor: colors.error + '40' }]}
3001
3034
  accessibilityRole="alert"
3002
3035
  >
3003
- <Ionicons name="alert-circle-outline" size={16} color={colors.error} />
3036
+ <CircleAlert size={16} color={colors.error} />
3004
3037
  <Text style={[styles.noticeText, { color: colors.error }]}>{t('local_pay_wrong_session')}</Text>
3005
3038
  </Animated.View>
3006
3039
  )}
@@ -3017,7 +3050,7 @@ function NearbyFlow({
3017
3050
  entering={fadeIn}
3018
3051
  style={[styles.notice, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
3019
3052
  >
3020
- <Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
3053
+ <Info size={16} color={colors.textSecondary} />
3021
3054
  <Text style={[styles.noticeText, { color: colors.textSecondary }]}>
3022
3055
  {err.networkDenied
3023
3056
  ? t('local_pay_network_denied')
@@ -3268,7 +3301,7 @@ function NearbyFlow({
3268
3301
  saw a second payment — so nothing here is at display scale. */}
3269
3302
  {phase === 'already_paid' && (
3270
3303
  <Animated.View entering={settleIn} style={styles.stage}>
3271
- <Ionicons name="checkmark-done-circle-outline" size={56} color={colors.textSecondary} />
3304
+ <CircleCheckBig size={56} color={colors.textSecondary} />
3272
3305
  <View style={styles.gapLg} />
3273
3306
  {phaseTitle(t('local_pay_already_paid'))}
3274
3307
  {supportText(t('local_pay_queued'))}
@@ -3285,7 +3318,7 @@ function NearbyFlow({
3285
3318
  {phase === 'failed' && (
3286
3319
  <Animated.View entering={settleIn} style={styles.stage} accessibilityRole="alert">
3287
3320
  <View style={[styles.heroCircle, { backgroundColor: colors.error + '15' }]}>
3288
- <Ionicons name="alert-circle-outline" size={40} color={colors.error} />
3321
+ <CircleAlert size={40} color={colors.error} />
3289
3322
  </View>
3290
3323
  <View style={styles.gapLg} />
3291
3324
  {phaseTitle(t('local_pay_failed'))}
@@ -3385,7 +3418,9 @@ function NearbyFlow({
3385
3418
 
3386
3419
  const inlineBody = (
3387
3420
  <View style={styles.embedded}>
3388
- {phase === 'receive_wait' && hostedSession && sessionQr && !sessionQrBroken ? (
3421
+ {phase === 'receive_wait' && hostedSession && sessionQr && !sessionQrBroken && embedded?.renderQr ? (
3422
+ embedded.renderQr(sessionQr)
3423
+ ) : phase === 'receive_wait' && hostedSession && sessionQr && !sessionQrBroken ? (
3389
3424
  <View style={[styles.qrCard, { shadowColor: colors.textPrimary }]}>
3390
3425
  <View style={styles.qrPlate}>
3391
3426
  <QRCode
@@ -3411,7 +3446,7 @@ function NearbyFlow({
3411
3446
  ]}
3412
3447
  accessibilityRole="alert"
3413
3448
  >
3414
- <Ionicons name="alert-circle-outline" size={28} color={colors.error} />
3449
+ <CircleAlert size={28} color={colors.error} />
3415
3450
  <View style={styles.gapSm} />
3416
3451
  <Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_qr_unavailable')}</Text>
3417
3452
  </View>
@@ -3442,7 +3477,7 @@ function NearbyFlow({
3442
3477
  style={[styles.notice, { backgroundColor: colors.error + '15', borderColor: colors.error + '40' }]}
3443
3478
  accessibilityRole="alert"
3444
3479
  >
3445
- <Ionicons name="alert-circle-outline" size={16} color={colors.error} />
3480
+ <CircleAlert size={16} color={colors.error} />
3446
3481
  <Text style={[styles.noticeText, { color: colors.error }]}>{t('local_pay_wrong_session')}</Text>
3447
3482
  </View>
3448
3483
  )}
@@ -3453,7 +3488,7 @@ function NearbyFlow({
3453
3488
  <React.Fragment key={kind}>
3454
3489
  <View style={styles.gapMd} />
3455
3490
  <View style={[styles.notice, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
3456
- <Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
3491
+ <Info size={16} color={colors.textSecondary} />
3457
3492
  <Text style={[styles.noticeText, { color: colors.textSecondary }]}>
3458
3493
  {err.networkDenied
3459
3494
  ? t('local_pay_network_denied')
@@ -3487,7 +3522,7 @@ function NearbyFlow({
3487
3522
  accessibilityRole="button"
3488
3523
  accessibilityLabel={t('local_pay_scan_payer_qr')}
3489
3524
  >
3490
- <Ionicons name="scan-outline" size={16} color={colors.textSecondary} />
3525
+ <ScanLine size={16} color={colors.textSecondary} />
3491
3526
  <Text style={[styles.embeddedScanText, { color: colors.textSecondary }]}>
3492
3527
  {t('local_pay_scan_payer_qr')}
3493
3528
  </Text>
@@ -3746,7 +3781,6 @@ function PrimaryButton({
3746
3781
  onPress: () => void
3747
3782
  disabled?: boolean
3748
3783
  }) {
3749
- const Ionicons = loadIonicons()
3750
3784
  return (
3751
3785
  <PressableScale
3752
3786
  onPress={onPress}
@@ -3757,7 +3791,9 @@ function PrimaryButton({
3757
3791
  accessibilityLabel={label}
3758
3792
  accessibilityState={{ disabled: !!disabled }}
3759
3793
  >
3760
- {!!icon && <Ionicons name={icon} size={20} color={disabled ? colors.textTertiary : colors.textOnAccent} />}
3794
+ {!!icon &&
3795
+ !!LUCIDE[icon] &&
3796
+ React.createElement(LUCIDE[icon], { size: 20, color: disabled ? colors.textTertiary : colors.textOnAccent })}
3761
3797
  <Text style={[styles.buttonText, { color: disabled ? colors.textTertiary : colors.textOnAccent }]}>{label}</Text>
3762
3798
  </PressableScale>
3763
3799
  )
@@ -3778,7 +3814,6 @@ function SecondaryButton({
3778
3814
  onPress: () => void
3779
3815
  disabled?: boolean
3780
3816
  }) {
3781
- const Ionicons = loadIonicons()
3782
3817
  return (
3783
3818
  <PressableScale
3784
3819
  onPress={onPress}
@@ -3789,7 +3824,9 @@ function SecondaryButton({
3789
3824
  accessibilityLabel={label}
3790
3825
  accessibilityState={{ disabled: !!disabled }}
3791
3826
  >
3792
- {!!icon && <Ionicons name={icon} size={18} color={disabled ? colors.textTertiary : colors.accent} />}
3827
+ {!!icon &&
3828
+ !!LUCIDE[icon] &&
3829
+ React.createElement(LUCIDE[icon], { size: 18, color: disabled ? colors.textTertiary : colors.accent })}
3793
3830
  <Text style={[styles.buttonText, { color: disabled ? colors.textTertiary : colors.accent }]}>{label}</Text>
3794
3831
  </PressableScale>
3795
3832
  )
@@ -3839,7 +3876,7 @@ function makeStyles() {
3839
3876
  embedded: { alignItems: 'center', alignSelf: 'stretch' },
3840
3877
  embeddedPending: { alignItems: 'center', justifyContent: 'center' },
3841
3878
  embeddedScan: { flexDirection: 'row', alignItems: 'center', gap: 6, paddingVertical: 6, paddingHorizontal: 12 },
3842
- embeddedScanText: { fontSize: 13, lineHeight: 18 },
3879
+ embeddedScanText: { fontFamily: 'Nunito', fontSize: 13, lineHeight: 18 },
3843
3880
  header: {
3844
3881
  flexDirection: 'row',
3845
3882
  alignItems: 'center',
@@ -21,21 +21,19 @@ import { AmountInput, type AmountInputAsset } from '../wallet/AmountInput'
21
21
  import PressableScale from '../ui/PressableScale'
22
22
 
23
23
  /**
24
- * @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
25
- * etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
26
- * that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
27
- * Ionicons is loaded lazily, only when actually rendering, same pattern as
28
- * this package's other native-module-boundary fixes (expo-router, expo-blur).
24
+ * lucide, like every other glyph this app draws. Imported at module scope
25
+ * rather than behind a lazy loader: what had to be deferred is
26
+ * @expo/vector-icons' index barrel, which re-exports every icon set and so
27
+ * reaches expo-font -> expo-asset as untransformed ESM; nothing here pulls
28
+ * that barrel in any more. lucide publishes both module formats and Jest
29
+ * resolves the ESM one, so the app pins this name to lucide's CJS entry in
30
+ * jest.moduleNameMapper (package.json), as it already does for its other
31
+ * ESM-only dependencies.
29
32
  */
33
+ import { ArrowRight, ArrowUp, Info, User, type LucideIcon } from 'lucide-react-native'
34
+
35
+ /** The icon props below stay Ionicons names; LUCIDE draws their twins. */
30
36
  type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
31
- let ioniconsComponent: IoniconsComponent | undefined
32
- function loadIonicons(): IoniconsComponent {
33
- if (!ioniconsComponent) {
34
- // eslint-disable-next-line @typescript-eslint/no-require-imports
35
- ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
36
- }
37
- return ioniconsComponent
38
- }
39
37
 
40
38
  /** One field section: the uppercase caption, then whatever asks the question. */
41
39
  export function PayField({ labelKey, children }: { labelKey: string; children: React.ReactNode }) {
@@ -126,10 +124,9 @@ export function ConsequenceNote({
126
124
  }) {
127
125
  const { t } = useTranslation()
128
126
  const { colors } = useTheme()
129
- const Ionicons = loadIonicons()
130
127
  return (
131
128
  <View style={[styles.consequence, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
132
- <Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
129
+ <Info size={16} color={colors.textSecondary} />
133
130
  <Text style={[styles.consequenceText, { color: colors.textSecondary }]}>{text ?? t(textKey, values)}</Text>
134
131
  {action && (
135
132
  <PressableScale
@@ -150,6 +147,18 @@ export function ConsequenceNote({
150
147
  }
151
148
 
152
149
  /** The submit button every rail sends with. */
150
+ /**
151
+ * The two icon props below stay Ionicons names, because that is what every
152
+ * call site already passes; this maps each name used in this package to its
153
+ * lucide counterpart. A name with no entry draws nothing rather than a glyph
154
+ * from the wrong family -- the seam this whole change exists to close.
155
+ */
156
+ const LUCIDE: Record<string, LucideIcon> = {
157
+ 'arrow-up': ArrowUp,
158
+ 'arrow-forward': ArrowRight,
159
+ person: User
160
+ }
161
+
153
162
  export function PayCta({
154
163
  onPress,
155
164
  disabled,
@@ -175,7 +184,6 @@ export function PayCta({
175
184
  }) {
176
185
  const { t } = useTranslation()
177
186
  const { colors } = useTheme()
178
- const Ionicons = loadIonicons()
179
187
  const enabled = !disabled
180
188
  const text = label ?? t(labelKey)
181
189
  return (
@@ -193,7 +201,8 @@ export function PayCta({
193
201
  <ActivityIndicator size="small" color={enabled ? colors.background : colors.textTertiary} />
194
202
  ) : (
195
203
  <>
196
- <Ionicons name={icon} size={20} color={enabled ? colors.textOnAccent : colors.textTertiary} />
204
+ {!!LUCIDE[icon] &&
205
+ React.createElement(LUCIDE[icon], { size: 20, color: enabled ? colors.textOnAccent : colors.textTertiary })}
197
206
  <Text style={[styles.ctaText, { color: enabled ? colors.textOnAccent : colors.textTertiary }]}>{text}</Text>
198
207
  </>
199
208
  )}
@@ -217,11 +226,10 @@ export function RecipientSummary({
217
226
  }) {
218
227
  const { t } = useTranslation()
219
228
  const { colors } = useTheme()
220
- const Ionicons = loadIonicons()
221
229
  return (
222
230
  <View style={[styles.idCard, { backgroundColor: colors.backgroundElevated, borderColor: colors.separator }]}>
223
231
  <View style={[styles.avatar, { backgroundColor: colors.fillTertiary }]}>
224
- <Ionicons name={icon} size={20} color={colors.textSecondary} />
232
+ {!!LUCIDE[icon] && React.createElement(LUCIDE[icon], { size: 20, color: colors.textSecondary })}
225
233
  </View>
226
234
  <View style={styles.idText}>
227
235
  <Text style={[styles.idLabel, { color: colors.textTertiary }]}>{t('recipient')}</Text>
@@ -28,6 +28,7 @@ import AmountDisplay from '../wallet/AmountDisplay'
28
28
  import Celebration from '../ui/Celebration'
29
29
  import PressableScale from '../ui/PressableScale'
30
30
  import type { DismissTarget } from '../../dismissTarget'
31
+ import { BalancedText } from '../ui/BalancedText'
31
32
 
32
33
  /**
33
34
  * expo-router is required lazily rather than imported at module scope: this
@@ -282,12 +283,14 @@ export default function PaymentSuccessOverlay({
282
283
  rendered ungated by direction; a sent payment gets its own, because
283
284
  "Received offline" over an outgoing payment is simply wrong. */}
284
285
  {!broadcast && (
285
- <Text style={[styles.pending, { color: colors.textSecondary }]}>
286
+ <BalancedText style={[styles.pending, { color: colors.textSecondary }]}>
286
287
  {t(sent ? 'pay_sent_not_broadcast' : 'pay_received_not_broadcast')}
287
- </Text>
288
+ </BalancedText>
288
289
  )}
289
290
 
290
- {!!statusNote && <Text style={[styles.pending, { color: colors.textSecondary }]}>{statusNote}</Text>}
291
+ {!!statusNote && (
292
+ <BalancedText style={[styles.pending, { color: colors.textSecondary }]}>{statusNote}</BalancedText>
293
+ )}
291
294
 
292
295
  {!!firstHoldNote && (
293
296
  <Text
@@ -342,10 +345,9 @@ const styles = StyleSheet.create({
342
345
  alignSelf: 'stretch',
343
346
  alignItems: 'center'
344
347
  },
348
+ // the display ramp exactly, which this used to restate by hand
345
349
  amount: {
346
- fontSize: 44,
347
- lineHeight: 52,
348
- fontWeight: '700',
350
+ ...typography.display,
349
351
  textAlign: 'center'
350
352
  },
351
353
  support: {
@@ -587,7 +587,10 @@ function UniversalSendInner(
587
587
  setRegistrySearching(true)
588
588
  const timer = setTimeout(async () => {
589
589
  try {
590
- const rows = await registryClient.search(query)
590
+ // A complete address whose key is not the one pinned here comes back
591
+ // flagged `changedFrom` (XR-071). This screen has no key-change
592
+ // warning, so such a row is dropped, as before the flag existed.
593
+ const rows = (await registryClient.search(query)).filter(row => !row.changedFrom)
591
594
  if (cancelled) return
592
595
  setRegistryMatches(rows)
593
596
  setRegistryError(false)
@@ -25,6 +25,7 @@ import Animated, {
25
25
  useReducedMotion
26
26
  } from 'react-native-reanimated'
27
27
  import { useTheme, spacing, radii, typography, springs, durations, haptics } from '@bsv/expo-wallet-toolbox'
28
+ import { BalancedText } from './BalancedText'
28
29
 
29
30
  export interface AlertButton {
30
31
  text: string
@@ -167,9 +168,9 @@ export function AlertHost() {
167
168
  <Animated.View
168
169
  style={[styles.card, { backgroundColor: colors.sheetBackground, borderColor: colors.separator }, cardStyle]}
169
170
  >
170
- <Text style={[styles.title, { color: colors.textPrimary }]}>{current.title}</Text>
171
+ <BalancedText style={[styles.title, { color: colors.textPrimary }]}>{current.title}</BalancedText>
171
172
  {!!current.message && (
172
- <Text style={[styles.message, { color: colors.textSecondary }]}>{current.message}</Text>
173
+ <BalancedText style={[styles.message, { color: colors.textSecondary }]}>{current.message}</BalancedText>
173
174
  )}
174
175
  <View
175
176
  style={[styles.buttonGroup, { borderTopColor: colors.separator }, !sideBySide && styles.buttonGroupStacked]}
@@ -0,0 +1,117 @@
1
+ // Centred body copy, balanced (CSS's text-wrap: balance): its lines about the
2
+ // same length, never a long line over a lonely last word.
3
+ //
4
+ // This is the host app's src/ui/BalancedText.tsx, copied here because a
5
+ // package cannot import from the app that mounts it. The two are kept
6
+ // identical on purpose, so a diff is the whole review; it belongs upstream in
7
+ // this package, at which point the app's copy becomes the duplicate.
8
+ //
9
+ // Android: its own balanced line breaking (textBreakStrategy). Shrink-wrapping
10
+ // centred text in a custom font there clips the last word, so the text keeps
11
+ // its full width.
12
+ //
13
+ // iOS has no such strategy, so an unseen copy of the text finds the narrowest
14
+ // width that keeps it as many lines as at full width (a binary search on its
15
+ // height), and the text takes that width, centred in the room it had: the
16
+ // words spread evenly over the same lines. (onTextLayout, which would give
17
+ // the lines directly, doesn't fire on the new architecture here.)
18
+ //
19
+ // It wraps its text in a View, so it is only a drop-in where a View is legal:
20
+ // not inside another Text, and not where a parent row measures the text's own
21
+ // width. Everywhere else it takes the same props as Text.
22
+ import React, { useLayoutEffect, useState } from 'react'
23
+ import { Platform, Text, View, type TextProps } from 'react-native'
24
+
25
+ /** Close enough: the search stops when the width is known to within this. */
26
+ const PRECISION = 3
27
+
28
+ function plain(children: React.ReactNode): string {
29
+ if (children == null || typeof children === 'boolean') return ''
30
+ if (typeof children === 'string' || typeof children === 'number') return String(children)
31
+ if (Array.isArray(children)) return children.map(plain).join('')
32
+ if (React.isValidElement<{ children?: React.ReactNode }>(children)) return plain(children.props.children)
33
+ return ''
34
+ }
35
+
36
+ export function BalancedText({ style, children, onTextLayout, ...rest }: TextProps) {
37
+ if (Platform.OS !== 'ios') {
38
+ return (
39
+ <Text textBreakStrategy="balanced" style={style} onTextLayout={onTextLayout} {...rest}>
40
+ {children}
41
+ </Text>
42
+ )
43
+ }
44
+ return (
45
+ <IosBalanced style={style} onTextLayout={onTextLayout} {...rest}>
46
+ {children}
47
+ </IosBalanced>
48
+ )
49
+ }
50
+
51
+ function IosBalanced({ style, children, ...rest }: TextProps) {
52
+ const text = plain(children)
53
+ const [room, setRoom] = useState(0)
54
+ // the search: the full-width height, and the range the answer lies in
55
+ const [search, setSearch] = useState<{ height: number; lo: number; hi: number; probe: number } | null>(null)
56
+ const [width, setWidth] = useState<number | null>(null)
57
+
58
+ // new words or new room: search again
59
+ useLayoutEffect(() => {
60
+ setSearch(null)
61
+ setWidth(null)
62
+ }, [text, room])
63
+
64
+ // the unseen copy laid out at the probe width: its height says whether it's still as few lines
65
+ const probed = (height: number) => {
66
+ if (!room) return
67
+ if (!search) {
68
+ // the full width first, then halfway down
69
+ setSearch({ height, lo: Math.floor(room / 2), hi: room, probe: Math.floor(room * 0.75) })
70
+ return
71
+ }
72
+ const fits = height <= search.height + 0.5
73
+ const lo = fits ? search.lo : search.probe
74
+ const hi = fits ? search.probe : search.hi
75
+ if (hi - lo <= PRECISION) {
76
+ setWidth(hi < room - 1 ? hi : null)
77
+ setSearch({ ...search, lo, hi, probe: -1 })
78
+ return
79
+ }
80
+ setSearch({ ...search, lo, hi, probe: Math.floor((lo + hi) / 2) })
81
+ }
82
+ const probe = !room ? 0 : !search ? room : search.probe
83
+
84
+ return (
85
+ <View style={{ alignSelf: 'stretch', alignItems: 'center' }} onLayout={e => setRoom(Math.floor(e.nativeEvent.layout.width))}>
86
+ <Text {...rest} style={[style, width ? { width, maxWidth: width, alignSelf: 'center' } : null]}>
87
+ {children}
88
+ </Text>
89
+ {/* holds the room open at the text's own full width: in a parent that
90
+ shrink-wraps its content (alignItems: 'center'), the room would
91
+ otherwise follow the balanced width, and every narrowing would start
92
+ the search again, the text forever re-wrapping */}
93
+ <Text
94
+ {...rest}
95
+ accessible={false}
96
+ importantForAccessibility="no-hide-descendants"
97
+ pointerEvents="none"
98
+ style={[style, { height: 0, opacity: 0, overflow: 'hidden', marginVertical: 0, paddingVertical: 0 }]}
99
+ >
100
+ {children}
101
+ </Text>
102
+ {room > 0 && probe > 0 && (
103
+ <Text
104
+ {...rest}
105
+ key={probe}
106
+ accessible={false}
107
+ importantForAccessibility="no-hide-descendants"
108
+ pointerEvents="none"
109
+ style={[style, { position: 'absolute', left: 0, top: 0, opacity: 0, width: probe, maxWidth: probe, margin: 0, alignSelf: 'auto' }]}
110
+ onLayout={e => probed(e.nativeEvent.layout.height)}
111
+ >
112
+ {children}
113
+ </Text>
114
+ )}
115
+ </View>
116
+ )
117
+ }
@@ -14,6 +14,19 @@ interface State {
14
14
  /**
15
15
  * Error Boundary to catch JavaScript errors and prevent app crashes
16
16
  * This is especially important for production builds where crashes are more severe
17
+ *
18
+ * Styling here is deliberately literal -- hex colours and a font name, no
19
+ * imports beyond react-native. This is the screen that renders when something
20
+ * else has already failed, so it must not depend on a theme provider, a token
21
+ * module or a hook that could be part of what broke. The values below are the
22
+ * app's dark palette (src/theme/tokens.ts) copied in by hand for that reason;
23
+ * if that palette moves, this is a known place to update by hand. It stays
24
+ * dark in both schemes because a class component cannot read the scheme hook,
25
+ * and a crash screen that is always the same is easier to recognise anyway.
26
+ *
27
+ * Nunito is embedded at build time (app.config.js), so naming it needs no
28
+ * font loading and cannot fail here. The stack trace stays monospace: it is
29
+ * read as code, column alignment matters more than the brand face.
17
30
  */
18
31
  export class ErrorBoundary extends Component<Props, State> {
19
32
  constructor(props: Props) {
@@ -94,7 +107,7 @@ export class ErrorBoundary extends Component<Props, State> {
94
107
  const styles = StyleSheet.create({
95
108
  container: {
96
109
  flex: 1,
97
- backgroundColor: '#1a1a1a'
110
+ backgroundColor: '#0b0b0d'
98
111
  },
99
112
  scrollView: {
100
113
  flex: 1
@@ -104,47 +117,51 @@ const styles = StyleSheet.create({
104
117
  paddingTop: 60
105
118
  },
106
119
  title: {
120
+ fontFamily: 'Nunito',
107
121
  fontSize: 24,
108
- fontWeight: 'bold',
109
- color: '#ff6b6b',
122
+ fontWeight: '700',
123
+ color: '#f75d59',
110
124
  marginBottom: 16
111
125
  },
112
126
  message: {
127
+ fontFamily: 'Nunito',
113
128
  fontSize: 16,
114
- color: '#ffffff',
129
+ color: '#f3f3f1',
115
130
  marginBottom: 24,
116
131
  lineHeight: 24
117
132
  },
118
133
  errorBox: {
119
- backgroundColor: '#2d2d2d',
134
+ backgroundColor: '#161619',
120
135
  padding: 16,
121
- borderRadius: 8,
136
+ borderRadius: 12,
122
137
  marginBottom: 16,
123
138
  borderLeftWidth: 4,
124
- borderLeftColor: '#ff6b6b'
139
+ borderLeftColor: '#f75d59'
125
140
  },
126
141
  errorTitle: {
142
+ fontFamily: 'Nunito',
127
143
  fontSize: 14,
128
- fontWeight: 'bold',
129
- color: '#ff6b6b',
144
+ fontWeight: '700',
145
+ color: '#f75d59',
130
146
  marginBottom: 8
131
147
  },
132
148
  errorText: {
133
149
  fontSize: 12,
134
- color: '#cccccc',
150
+ color: '#98989c',
135
151
  fontFamily: 'monospace',
136
152
  lineHeight: 18
137
153
  },
138
154
  button: {
139
- backgroundColor: '#4CAF50',
155
+ backgroundColor: '#f3f3f1',
140
156
  padding: 16,
141
- borderRadius: 8,
157
+ borderRadius: 12,
142
158
  alignItems: 'center',
143
159
  marginTop: 16
144
160
  },
145
161
  buttonText: {
146
- color: '#ffffff',
162
+ fontFamily: 'Nunito',
163
+ color: '#2d2d31',
147
164
  fontSize: 16,
148
- fontWeight: 'bold'
165
+ fontWeight: '700'
149
166
  }
150
167
  })