@bsv/expo-wallet-toolbox 0.25.0 → 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.
- package/CHANGELOG.md +43 -0
- package/core/context/WalletContext.tsx +11 -15
- package/core/i18n/translations.tsx +221 -36
- package/core/identity/handleRegistry/client.ts +110 -16
- package/core/identity/handleRegistry/registration.ts +115 -17
- package/core/index.ts +8 -0
- package/core/net/wocLimiter.ts +133 -0
- package/core/pay/beefRepair.ts +3 -1
- package/core/pay/rails/address.ts +2 -2
- package/core/profiles/profileStore.ts +4 -1
- package/core/services/arcadeBroadcastProvider.ts +6 -0
- package/core/services/exchangeRate.ts +8 -1
- package/core/services/groupSpendingLimit.ts +26 -0
- package/core/services/signingPermissionPolicy.ts +14 -8
- package/core/services/vault/ceremony.ts +13 -0
- package/core/services/vault/ceremonyHost.ts +58 -0
- package/core/services/vault/failedVaultSpend.ts +40 -0
- package/core/services/vault/outputAuthority.ts +13 -6
- package/core/services/vault/transfers.ts +56 -12
- package/core/services/vault/wocLookup.ts +5 -2
- package/core/storage/encryptedDbImage.ts +11 -2
- package/core/theme/tokens.ts +26 -12
- package/package.json +2 -1
- package/ui/components/QRScanner.tsx +24 -22
- package/ui/components/pay/MessageBoxConfig.tsx +10 -16
- package/ui/components/pay/NearbyAdvisoryModal.tsx +6 -13
- package/ui/components/pay/NearbyFlow.tsx +72 -35
- package/ui/components/pay/PayForm.tsx +27 -19
- package/ui/components/pay/PaymentSuccessOverlay.tsx +8 -6
- package/ui/components/pay/UniversalSend.tsx +4 -1
- package/ui/components/ui/AlertCard.tsx +3 -2
- package/ui/components/ui/BalancedText.tsx +117 -0
- package/ui/components/ui/ErrorBoundary.tsx +31 -14
- package/ui/components/ui/GroupedList.tsx +28 -22
- package/ui/components/ui/ListRow.tsx +126 -35
- package/ui/components/ui/PermissionSheet.tsx +31 -24
- package/ui/components/ui/PresenceRow.tsx +15 -23
- package/ui/components/ui/Sheet.tsx +11 -17
- package/ui/components/ui/Toast.tsx +13 -17
- package/ui/components/vault/EnrollWizard.tsx +446 -196
- package/ui/components/vault/KeyChooser.tsx +7 -20
- package/ui/components/vault/VaultCeremonySheet.tsx +44 -36
- package/ui/components/wallet/AmountInput.tsx +11 -17
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +13 -17
- package/ui/index.ts +1 -1
- package/ui/screens/TrustScreen.tsx +49 -61
- package/ui/screens/VaultScreen.tsx +99 -60
- package/ui/screens/VaultTransferScreen.tsx +34 -27
- package/ui/screens/WalletCheckScreen.tsx +25 -24
- package/ui/screens/WalletConfigScreen.tsx +66 -72
|
@@ -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: '#
|
|
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: '
|
|
109
|
-
color: '#
|
|
122
|
+
fontWeight: '700',
|
|
123
|
+
color: '#f75d59',
|
|
110
124
|
marginBottom: 16
|
|
111
125
|
},
|
|
112
126
|
message: {
|
|
127
|
+
fontFamily: 'Nunito',
|
|
113
128
|
fontSize: 16,
|
|
114
|
-
color: '#
|
|
129
|
+
color: '#f3f3f1',
|
|
115
130
|
marginBottom: 24,
|
|
116
131
|
lineHeight: 24
|
|
117
132
|
},
|
|
118
133
|
errorBox: {
|
|
119
|
-
backgroundColor: '#
|
|
134
|
+
backgroundColor: '#161619',
|
|
120
135
|
padding: 16,
|
|
121
|
-
borderRadius:
|
|
136
|
+
borderRadius: 12,
|
|
122
137
|
marginBottom: 16,
|
|
123
138
|
borderLeftWidth: 4,
|
|
124
|
-
borderLeftColor: '#
|
|
139
|
+
borderLeftColor: '#f75d59'
|
|
125
140
|
},
|
|
126
141
|
errorTitle: {
|
|
142
|
+
fontFamily: 'Nunito',
|
|
127
143
|
fontSize: 14,
|
|
128
|
-
fontWeight: '
|
|
129
|
-
color: '#
|
|
144
|
+
fontWeight: '700',
|
|
145
|
+
color: '#f75d59',
|
|
130
146
|
marginBottom: 8
|
|
131
147
|
},
|
|
132
148
|
errorText: {
|
|
133
149
|
fontSize: 12,
|
|
134
|
-
color: '#
|
|
150
|
+
color: '#98989c',
|
|
135
151
|
fontFamily: 'monospace',
|
|
136
152
|
lineHeight: 18
|
|
137
153
|
},
|
|
138
154
|
button: {
|
|
139
|
-
backgroundColor: '#
|
|
155
|
+
backgroundColor: '#f3f3f1',
|
|
140
156
|
padding: 16,
|
|
141
|
-
borderRadius:
|
|
157
|
+
borderRadius: 12,
|
|
142
158
|
alignItems: 'center',
|
|
143
159
|
marginTop: 16
|
|
144
160
|
},
|
|
145
161
|
buttonText: {
|
|
146
|
-
|
|
162
|
+
fontFamily: 'Nunito',
|
|
163
|
+
color: '#2d2d31',
|
|
147
164
|
fontSize: 16,
|
|
148
|
-
fontWeight: '
|
|
165
|
+
fontWeight: '700'
|
|
149
166
|
}
|
|
150
167
|
})
|
|
@@ -5,6 +5,13 @@ import { useTheme, spacing, radii, typography } from '@bsv/expo-wallet-toolbox'
|
|
|
5
5
|
interface GroupedListSection {
|
|
6
6
|
header?: string
|
|
7
7
|
footer?: string
|
|
8
|
+
/**
|
|
9
|
+
* Draw the rows on a lifted card. Default. `card={false}` puts them straight
|
|
10
|
+
* on the canvas, which is how this app's own settings page is laid out
|
|
11
|
+
* (src/settings/Rows.tsx) — used by the wallet configuration screen so the
|
|
12
|
+
* two read as one design.
|
|
13
|
+
*/
|
|
14
|
+
card?: boolean
|
|
8
15
|
children: React.ReactNode
|
|
9
16
|
}
|
|
10
17
|
|
|
@@ -25,20 +32,10 @@ export const GroupedList: React.FC<GroupedListProps> = ({ sections }) => {
|
|
|
25
32
|
{sections.map((section, idx) => (
|
|
26
33
|
<View key={idx} style={styles.section}>
|
|
27
34
|
{section.header && (
|
|
28
|
-
<Text style={[styles.header, { color: colors.
|
|
35
|
+
<Text style={[styles.header, { color: colors.textSecondary }]}>{section.header.toUpperCase()}</Text>
|
|
29
36
|
)}
|
|
30
|
-
<View
|
|
31
|
-
|
|
32
|
-
styles.group,
|
|
33
|
-
{
|
|
34
|
-
backgroundColor: colors.backgroundElevated,
|
|
35
|
-
borderColor: colors.separator
|
|
36
|
-
}
|
|
37
|
-
]}
|
|
38
|
-
>
|
|
39
|
-
{section.children}
|
|
40
|
-
</View>
|
|
41
|
-
{section.footer && <Text style={[styles.footer, { color: colors.textTertiary }]}>{section.footer}</Text>}
|
|
37
|
+
<View style={[styles.group]}>{section.children}</View>
|
|
38
|
+
{section.footer && <Text style={[styles.footer, { color: colors.textSecondary }]}>{section.footer}</Text>}
|
|
42
39
|
</View>
|
|
43
40
|
))}
|
|
44
41
|
</View>
|
|
@@ -48,16 +45,17 @@ export const GroupedList: React.FC<GroupedListProps> = ({ sections }) => {
|
|
|
48
45
|
/**
|
|
49
46
|
* Standalone section for inline use without the GroupedList wrapper.
|
|
50
47
|
*/
|
|
51
|
-
export const GroupedSection: React.FC<GroupedListSection> = ({ header, footer, children }) => {
|
|
48
|
+
export const GroupedSection: React.FC<GroupedListSection> = ({ header, footer, card = true, children }) => {
|
|
52
49
|
const { colors } = useTheme()
|
|
53
50
|
|
|
54
51
|
return (
|
|
55
52
|
<View style={styles.section}>
|
|
56
|
-
{header && <Text style={[styles.header, { color: colors.
|
|
53
|
+
{header && <Text style={[styles.header, { color: colors.textSecondary }]}>{header.toUpperCase()}</Text>}
|
|
57
54
|
<View
|
|
58
55
|
style={[
|
|
59
56
|
styles.group,
|
|
60
|
-
{
|
|
57
|
+
card && {
|
|
58
|
+
...styles.card,
|
|
61
59
|
backgroundColor: colors.backgroundElevated,
|
|
62
60
|
borderColor: colors.separator
|
|
63
61
|
}
|
|
@@ -65,7 +63,7 @@ export const GroupedSection: React.FC<GroupedListSection> = ({ header, footer, c
|
|
|
65
63
|
>
|
|
66
64
|
{children}
|
|
67
65
|
</View>
|
|
68
|
-
{footer && <Text style={[styles.footer, { color: colors.
|
|
66
|
+
{footer && <Text style={[styles.footer, { color: colors.textSecondary }]}>{footer}</Text>}
|
|
69
67
|
</View>
|
|
70
68
|
)
|
|
71
69
|
}
|
|
@@ -75,20 +73,27 @@ const styles = StyleSheet.create({
|
|
|
75
73
|
flex: 1
|
|
76
74
|
},
|
|
77
75
|
section: {
|
|
78
|
-
marginBottom: spacing.
|
|
76
|
+
marginBottom: spacing.lg
|
|
79
77
|
},
|
|
80
78
|
// Tracked small caps, matching the day headings in the activity list — a
|
|
81
79
|
// section header is a label for the block under it, not a line of prose.
|
|
82
80
|
header: {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
fontFamily: 'Nunito',
|
|
82
|
+
fontSize: 11,
|
|
83
|
+
lineHeight: 16,
|
|
84
|
+
fontWeight: '600',
|
|
85
|
+
letterSpacing: 1.1,
|
|
86
86
|
paddingHorizontal: spacing.xl,
|
|
87
|
-
paddingBottom:
|
|
87
|
+
paddingBottom: 6
|
|
88
88
|
},
|
|
89
89
|
// A card lifted off the canvas: the border does the work in dark, the shadow
|
|
90
90
|
// in light, and the radius says "object" in both.
|
|
91
91
|
group: {
|
|
92
|
+
marginHorizontal: spacing.sm
|
|
93
|
+
},
|
|
94
|
+
// A card lifted off the canvas: the border does the work in dark, the shadow
|
|
95
|
+
// in light, and the radius says "object" in both.
|
|
96
|
+
card: {
|
|
92
97
|
borderRadius: radii.lg,
|
|
93
98
|
marginHorizontal: spacing.lg,
|
|
94
99
|
borderWidth: StyleSheet.hairlineWidth,
|
|
@@ -101,6 +106,7 @@ const styles = StyleSheet.create({
|
|
|
101
106
|
},
|
|
102
107
|
footer: {
|
|
103
108
|
...typography.footnote,
|
|
109
|
+
fontFamily: 'Nunito',
|
|
104
110
|
paddingHorizontal: spacing.xl,
|
|
105
111
|
paddingTop: spacing.sm
|
|
106
112
|
}
|
|
@@ -1,7 +1,45 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { StyleSheet, Text, View } from 'react-native'
|
|
3
|
-
import { useTheme, spacing
|
|
3
|
+
import { useTheme, spacing } from '@bsv/expo-wallet-toolbox'
|
|
4
4
|
import PressableScale from './PressableScale'
|
|
5
|
+
import {
|
|
6
|
+
ArrowLeftRight,
|
|
7
|
+
Banknote,
|
|
8
|
+
Bell,
|
|
9
|
+
Bitcoin,
|
|
10
|
+
Bug,
|
|
11
|
+
ChevronDown,
|
|
12
|
+
ChevronRight,
|
|
13
|
+
CircleAlert,
|
|
14
|
+
CircleCheckBig,
|
|
15
|
+
CirclePlus,
|
|
16
|
+
CircleX,
|
|
17
|
+
Clock,
|
|
18
|
+
CloudUpload,
|
|
19
|
+
Download,
|
|
20
|
+
FlaskConical,
|
|
21
|
+
Globe,
|
|
22
|
+
KeyRound,
|
|
23
|
+
LockOpen,
|
|
24
|
+
LogOut,
|
|
25
|
+
Mail,
|
|
26
|
+
QrCode,
|
|
27
|
+
Radio,
|
|
28
|
+
Receipt,
|
|
29
|
+
RefreshCw,
|
|
30
|
+
Send,
|
|
31
|
+
Server,
|
|
32
|
+
Settings,
|
|
33
|
+
Share2,
|
|
34
|
+
ShieldCheck,
|
|
35
|
+
Terminal,
|
|
36
|
+
Trash2,
|
|
37
|
+
Vault,
|
|
38
|
+
Wifi,
|
|
39
|
+
Wrench,
|
|
40
|
+
Zap,
|
|
41
|
+
type LucideIcon
|
|
42
|
+
} from 'lucide-react-native'
|
|
5
43
|
|
|
6
44
|
/**
|
|
7
45
|
* @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
|
|
@@ -9,7 +47,8 @@ import PressableScale from './PressableScale'
|
|
|
9
47
|
* that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
|
|
10
48
|
* Both icon sets are loaded lazily, only when actually rendering, same
|
|
11
49
|
* pattern as this package's other native-module-boundary fixes (expo-router,
|
|
12
|
-
* expo-blur).
|
|
50
|
+
* expo-blur). They are now only reached by a row whose icon name has no
|
|
51
|
+
* lucide equivalent below.
|
|
13
52
|
*/
|
|
14
53
|
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
15
54
|
type MaterialCommunityIconsComponent = typeof import('@expo/vector-icons').MaterialCommunityIcons
|
|
@@ -30,13 +69,65 @@ function loadMaterialCommunityIcons(): MaterialCommunityIconsComponent {
|
|
|
30
69
|
return materialCommunityIconsComponent
|
|
31
70
|
}
|
|
32
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Every glyph this app draws comes from lucide -- its settings rows
|
|
74
|
+
* (src/settings/Rows.tsx), its headers, its sheets -- so the rows here draw
|
|
75
|
+
* from it too, at the same 16px and the same default stroke. Two icon
|
|
76
|
+
* families in one list is visible at a glance: Ionicons' filled-corner,
|
|
77
|
+
* closed shapes next to lucide's open 2px strokes read as two apps.
|
|
78
|
+
*
|
|
79
|
+
* The prop stays an Ionicons (or MaterialCommunityIcons) name, because that
|
|
80
|
+
* is this component's published API and every call site passes one. This maps
|
|
81
|
+
* each name used across the package to its nearest lucide counterpart; a name
|
|
82
|
+
* with no entry falls through to the set it was written for, so a row added
|
|
83
|
+
* upstream still draws something rather than nothing.
|
|
84
|
+
*/
|
|
85
|
+
const LUCIDE: Record<string, LucideIcon> = {
|
|
86
|
+
'add-circle-outline': CirclePlus,
|
|
87
|
+
'alert-circle-outline': CircleAlert,
|
|
88
|
+
'bug-outline': Bug,
|
|
89
|
+
'cash-outline': Banknote,
|
|
90
|
+
'checkmark-done-circle-outline': CircleCheckBig,
|
|
91
|
+
'close-circle-outline': CircleX,
|
|
92
|
+
'cloud-upload-outline': CloudUpload,
|
|
93
|
+
'construct-outline': Wrench,
|
|
94
|
+
'download-outline': Download,
|
|
95
|
+
'flash-outline': Zap,
|
|
96
|
+
'flask-outline': FlaskConical,
|
|
97
|
+
'globe-outline': Globe,
|
|
98
|
+
'key-outline': KeyRound,
|
|
99
|
+
'lock-open': LockOpen,
|
|
100
|
+
'log-out-outline': LogOut,
|
|
101
|
+
'logo-bitcoin': Bitcoin,
|
|
102
|
+
'mail-outline': Mail,
|
|
103
|
+
'notifications-outline': Bell,
|
|
104
|
+
'qr-code-outline': QrCode,
|
|
105
|
+
'radio-outline': Radio,
|
|
106
|
+
'receipt-outline': Receipt,
|
|
107
|
+
'refresh-outline': RefreshCw,
|
|
108
|
+
// MaterialCommunityIcons' `safe` -- the one concept Ionicons had no glyph
|
|
109
|
+
// for, and the reason iconFamily exists. lucide has it.
|
|
110
|
+
safe: Vault,
|
|
111
|
+
'send-outline': Send,
|
|
112
|
+
'server-outline': Server,
|
|
113
|
+
'settings-outline': Settings,
|
|
114
|
+
'share-outline': Share2,
|
|
115
|
+
'shield-checkmark-outline': ShieldCheck,
|
|
116
|
+
'swap-horizontal-outline': ArrowLeftRight,
|
|
117
|
+
'terminal-outline': Terminal,
|
|
118
|
+
'time-outline': Clock,
|
|
119
|
+
'trash-outline': Trash2,
|
|
120
|
+
'wifi-outline': Wifi
|
|
121
|
+
}
|
|
122
|
+
|
|
33
123
|
interface ListRowProps {
|
|
34
124
|
label: string
|
|
35
125
|
/** Secondary line under the label. Settings rows use this for the explaining copy. */
|
|
36
126
|
subtitle?: string
|
|
37
127
|
value?: string
|
|
38
128
|
/** Ionicons name by default; a MaterialCommunityIcons name when
|
|
39
|
-
* `iconFamily="material-community"`.
|
|
129
|
+
* `iconFamily="material-community"`. Drawn as its lucide equivalent, which
|
|
130
|
+
* is what the rest of this app draws. */
|
|
40
131
|
icon?: keyof IoniconsComponent['glyphMap'] | keyof MaterialCommunityIconsComponent['glyphMap']
|
|
41
132
|
/** Ionicons covers almost everything here, but a few concepts have no glyph
|
|
42
133
|
* in it (e.g. a bank vault — `lock-closed` reads as a generic padlock).
|
|
@@ -72,16 +163,11 @@ export const ListRow: React.FC<ListRowProps> = ({
|
|
|
72
163
|
testID
|
|
73
164
|
}) => {
|
|
74
165
|
const { colors } = useTheme()
|
|
75
|
-
const
|
|
76
|
-
const
|
|
166
|
+
const Glyph = icon ? LUCIDE[icon as string] : undefined
|
|
167
|
+
const Chevron = chevronDown ? ChevronDown : ChevronRight
|
|
77
168
|
|
|
78
169
|
const content = (
|
|
79
|
-
<View
|
|
80
|
-
style={[
|
|
81
|
-
styles.container,
|
|
82
|
-
!isLast && { borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: colors.separator }
|
|
83
|
-
]}
|
|
84
|
-
>
|
|
170
|
+
<View style={styles.container}>
|
|
85
171
|
{icon && (
|
|
86
172
|
<View
|
|
87
173
|
style={[
|
|
@@ -91,18 +177,20 @@ export const ListRow: React.FC<ListRowProps> = ({
|
|
|
91
177
|
: { backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
|
|
92
178
|
]}
|
|
93
179
|
>
|
|
94
|
-
{
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
180
|
+
{Glyph ? (
|
|
181
|
+
<Glyph size={16} color={iconColor || colors.textPrimary} />
|
|
182
|
+
) : iconFamily === 'material-community' ? (
|
|
183
|
+
React.createElement(loadMaterialCommunityIcons(), {
|
|
184
|
+
name: icon as never,
|
|
185
|
+
size: 16,
|
|
186
|
+
color: iconColor || colors.textPrimary
|
|
187
|
+
})
|
|
100
188
|
) : (
|
|
101
|
-
|
|
102
|
-
name
|
|
103
|
-
size
|
|
104
|
-
color
|
|
105
|
-
|
|
189
|
+
React.createElement(loadIonicons(), {
|
|
190
|
+
name: icon as never,
|
|
191
|
+
size: 16,
|
|
192
|
+
color: iconColor || colors.textPrimary
|
|
193
|
+
})
|
|
106
194
|
)}
|
|
107
195
|
</View>
|
|
108
196
|
)}
|
|
@@ -124,12 +212,7 @@ export const ListRow: React.FC<ListRowProps> = ({
|
|
|
124
212
|
</Text>
|
|
125
213
|
)}
|
|
126
214
|
{showChevron && onPress && !destructive && (
|
|
127
|
-
<
|
|
128
|
-
name={chevronDown ? 'chevron-down' : 'chevron-forward'}
|
|
129
|
-
size={18}
|
|
130
|
-
color={colors.textQuaternary}
|
|
131
|
-
style={styles.chevron}
|
|
132
|
-
/>
|
|
215
|
+
<Chevron size={16} color={colors.textSecondary} style={styles.chevron} />
|
|
133
216
|
)}
|
|
134
217
|
</View>
|
|
135
218
|
</View>
|
|
@@ -158,16 +241,17 @@ const styles = StyleSheet.create({
|
|
|
158
241
|
alignItems: 'center',
|
|
159
242
|
minHeight: 44,
|
|
160
243
|
paddingVertical: spacing.md,
|
|
161
|
-
paddingHorizontal: spacing.
|
|
244
|
+
paddingHorizontal: spacing.md,
|
|
245
|
+
borderRadius: 19.04
|
|
162
246
|
},
|
|
163
247
|
// A well the glyph sits in, tinted by the row's own colour rather than
|
|
164
248
|
// flooded with it. A grid of saturated tiles reads as decoration and makes
|
|
165
249
|
// every row shout equally; the tint keeps the category cue and drops the
|
|
166
250
|
// shouting.
|
|
167
251
|
iconContainer: {
|
|
168
|
-
width:
|
|
169
|
-
height:
|
|
170
|
-
borderRadius:
|
|
252
|
+
width: 36,
|
|
253
|
+
height: 36,
|
|
254
|
+
borderRadius: 19.04,
|
|
171
255
|
borderWidth: StyleSheet.hairlineWidth,
|
|
172
256
|
alignItems: 'center',
|
|
173
257
|
justifyContent: 'center',
|
|
@@ -177,10 +261,15 @@ const styles = StyleSheet.create({
|
|
|
177
261
|
flex: 1
|
|
178
262
|
},
|
|
179
263
|
label: {
|
|
180
|
-
|
|
264
|
+
fontFamily: 'Nunito',
|
|
265
|
+
fontSize: 14,
|
|
266
|
+
lineHeight: 20,
|
|
267
|
+
fontWeight: '500'
|
|
181
268
|
},
|
|
182
269
|
subtitle: {
|
|
183
|
-
|
|
270
|
+
fontFamily: 'Nunito',
|
|
271
|
+
fontSize: 12,
|
|
272
|
+
lineHeight: 16,
|
|
184
273
|
marginTop: 1
|
|
185
274
|
},
|
|
186
275
|
trailing: {
|
|
@@ -190,7 +279,9 @@ const styles = StyleSheet.create({
|
|
|
190
279
|
marginLeft: spacing.sm
|
|
191
280
|
},
|
|
192
281
|
value: {
|
|
193
|
-
|
|
282
|
+
fontFamily: 'Nunito',
|
|
283
|
+
fontSize: 13,
|
|
284
|
+
lineHeight: 18,
|
|
194
285
|
maxWidth: 200
|
|
195
286
|
},
|
|
196
287
|
chevron: {
|