@onekeyfe/react-native-native-list 6.8.0-3 → 6.8.0-31
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/android/build.gradle +3 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +18 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +12 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +166 -36
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +8 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +6 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +21 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +24 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRowUpdates.kt +34 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +11 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentLayout.kt +71 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentsView.kt +126 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +84 -9
- package/android/src/main/res/values/native_scroll_coordinator_ids.xml +1 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentitySubtitleBindingTest.kt +177 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +2 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListTitleSegmentLayoutTest.kt +130 -0
- package/docs/ROW_TEMPLATES.md +8 -1
- package/docs/SPEC.md +312 -5
- package/docs/STYLE_SPEC.md +7 -1
- package/ios/NativeListAccessoryStack.swift +22 -0
- package/ios/NativeListActivityDetailsView.swift +45 -1
- package/ios/NativeListDataRowRenderer.swift +12 -5
- package/ios/NativeListIdentityRenderer.swift +145 -66
- package/ios/NativeListLeadingVisual.swift +8 -0
- package/ios/NativeListMarketRenderer.swift +6 -2
- package/ios/NativeListModels.swift +7 -0
- package/ios/NativeListResolvedText.swift +9 -7
- package/ios/NativeListSectionHeaderRenderer.swift +9 -43
- package/ios/NativeListTextStyles.swift +72 -12
- package/ios/NativeListTitleSegmentLayout.swift +72 -0
- package/ios/NativeListTitleSegmentsLabel.swift +92 -0
- package/ios/RNCNativeListView.swift +203 -45
- package/ios/tests/NativeListActivityPresentationTests.swift +137 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +155 -0
- package/ios/tests/NativeListLifecycleTests.swift +298 -24
- package/ios/tests/NativeListMediaVisibilityTests.swift +2 -1
- package/lib/module/models.js +2 -0
- package/lib/module/validation.js +96 -13
- package/lib/module/web/NativeListWebEngine.js +427 -100
- package/lib/module/web/templates/ActivityRowRenderer.js +1 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +134 -3
- package/lib/module/web/templates/MarketRowRenderer.js +2 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +1 -0
- package/lib/module/web/templates/RowElements.js +2 -2
- package/lib/module/web/templates/RowText.js +2 -0
- package/lib/typescript/src/models.d.ts +35 -1
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +17 -2
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +6 -2
- package/lib/typescript/src/web/templates/RowVisual.d.ts +1 -1
- package/package.json +1 -1
- package/src/models.ts +38 -0
- package/src/validation.ts +196 -6
- package/src/web/NativeListWebEngine.ts +671 -112
- package/src/web/templates/ActivityRowRenderer.ts +1 -1
- package/src/web/templates/IdentityRowRenderer.ts +208 -3
- package/src/web/templates/MarketRowRenderer.ts +2 -0
- package/src/web/templates/MediaTileRowRenderer.ts +1 -0
- package/src/web/templates/RowElements.ts +3 -2
- package/src/web/templates/RowText.ts +6 -0
- package/src/web/templates/RowVisual.ts +2 -1
package/android/src/test/java/com/margelo/nitro/nativelist/NativeListTitleSegmentLayoutTest.kt
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
package com.margelo.nitro.nativelist
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.assertEquals
|
|
4
|
+
import org.junit.Assert.assertFalse
|
|
5
|
+
import org.junit.Assert.assertNull
|
|
6
|
+
import org.junit.Assert.assertTrue
|
|
7
|
+
import org.junit.Test
|
|
8
|
+
|
|
9
|
+
class NativeListTitleSegmentLayoutTest {
|
|
10
|
+
// Wallet / Account as recipient rows send it: the wallet shrinks, the
|
|
11
|
+
// account is capped at 70% of the line.
|
|
12
|
+
private fun walletFirst(wallet: Float, account: Float, line: Float) =
|
|
13
|
+
nativeListTitleSegmentWidths(
|
|
14
|
+
listOf(wallet, 20f, account),
|
|
15
|
+
listOf(true, false, false),
|
|
16
|
+
listOf(null, null, 0.7f),
|
|
17
|
+
line,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
private fun assertWidths(expected: List<Float>, actual: List<Float>) {
|
|
21
|
+
assertEquals(expected.size, actual.size)
|
|
22
|
+
expected.zip(actual).forEach { (want, got) -> assertEquals(want, got, 0.001f) }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Test
|
|
26
|
+
fun keepsNaturalWidthsWhenTheyFit() = assertWidths(listOf(80f, 20f, 90f), walletFirst(80f, 90f, 300f))
|
|
27
|
+
|
|
28
|
+
@Test
|
|
29
|
+
fun theShrinkingRunGivesWayFirst() = assertWidths(listOf(130f, 20f, 100f), walletFirst(200f, 100f, 250f))
|
|
30
|
+
|
|
31
|
+
@Test
|
|
32
|
+
fun aCappedRunStopsAtItsShareOfTheLine() = assertWidths(listOf(70f, 20f, 210f), walletFirst(100f, 400f, 300f))
|
|
33
|
+
|
|
34
|
+
@Test
|
|
35
|
+
fun theAccountShrinksWhenTheWalletMustStayWhole() =
|
|
36
|
+
assertWidths(
|
|
37
|
+
listOf(210f, 20f, 70f),
|
|
38
|
+
nativeListTitleSegmentWidths(
|
|
39
|
+
listOf(300f, 20f, 150f),
|
|
40
|
+
listOf(false, false, true),
|
|
41
|
+
listOf(0.7f, null, null),
|
|
42
|
+
300f,
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
@Test
|
|
47
|
+
fun runsThatDoNotShrinkAreCutFromTheEnd() {
|
|
48
|
+
assertWidths(
|
|
49
|
+
listOf(100f, 50f, 0f),
|
|
50
|
+
nativeListTitleSegmentWidths(
|
|
51
|
+
listOf(100f, 100f, 100f),
|
|
52
|
+
listOf(false, false, true),
|
|
53
|
+
listOf(null, null, null),
|
|
54
|
+
150f,
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
assertWidths(
|
|
58
|
+
listOf(100f, 20f),
|
|
59
|
+
nativeListTitleSegmentWidths(listOf(100f, 100f), listOf(false, false), listOf(null, null), 120f),
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@Test
|
|
64
|
+
fun aNonPositiveLineLeavesNothing() {
|
|
65
|
+
assertWidths(listOf(0f, 0f, 0f), walletFirst(80f, 90f, 0f))
|
|
66
|
+
assertWidths(listOf(0f, 0f, 0f), walletFirst(80f, 90f, -10f))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Runs replace `title` except where `title` is highlighted; wallet sidebar
|
|
70
|
+
// rows keep the plain title without runs or a leading glyph.
|
|
71
|
+
@Test
|
|
72
|
+
fun titleDecorationsFollowTheRowContract() {
|
|
73
|
+
assertTrue(nativeListShowsTitleRuns("", 2, 0))
|
|
74
|
+
assertTrue(nativeListShowsTitleRuns("accountSelector", 2, 0))
|
|
75
|
+
assertFalse(nativeListShowsTitleRuns("", 0, 0))
|
|
76
|
+
assertFalse(nativeListShowsTitleRuns("", 2, 1))
|
|
77
|
+
assertFalse(nativeListShowsTitleRuns("walletSidebar", 2, 0))
|
|
78
|
+
assertTrue(nativeListAllowsTitleDecorations(""))
|
|
79
|
+
assertFalse(nativeListAllowsTitleDecorations("walletSidebar"))
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Two runs that do not shrink and one line that holds only the first: the
|
|
83
|
+
// first is drawn in full, so it has to carry the ellipsis.
|
|
84
|
+
@Test
|
|
85
|
+
fun aWholeRunCutFromTheEndPutsTheEllipsisOnTheLastRunShown() {
|
|
86
|
+
val natural = listOf(100f, 100f)
|
|
87
|
+
val widths = nativeListTitleSegmentWidths(natural, listOf(false, false), listOf(null, null), 100f)
|
|
88
|
+
assertWidths(listOf(100f, 0f), widths)
|
|
89
|
+
assertEquals(0, nativeListTitleSegmentOverflowIndex(natural, listOf(false, false), widths))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// The shrinking run may give up its whole width: the runs that stay whole
|
|
93
|
+
// fit, so none of them is cut for an ellipsis.
|
|
94
|
+
@Test
|
|
95
|
+
fun noEllipsisIsAddedWhenOnlyTheShrinkingRunDisappears() {
|
|
96
|
+
val natural = listOf(100f, 60f)
|
|
97
|
+
val shrink = listOf(false, true)
|
|
98
|
+
val widths = nativeListTitleSegmentWidths(natural, shrink, listOf(null, null), 100f)
|
|
99
|
+
assertWidths(listOf(100f, 0f), widths)
|
|
100
|
+
assertNull(nativeListTitleSegmentOverflowIndex(natural, shrink, widths))
|
|
101
|
+
// A fixed run cut behind the shrinking one still counts.
|
|
102
|
+
assertEquals(
|
|
103
|
+
0,
|
|
104
|
+
nativeListTitleSegmentOverflowIndex(
|
|
105
|
+
listOf(100f, 50f, 100f),
|
|
106
|
+
listOf(false, true, false),
|
|
107
|
+
listOf(100f, 0f, 0f),
|
|
108
|
+
),
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@Test
|
|
113
|
+
fun noEllipsisIsAddedWhenTheLineFitsOrIsCutInsideARun() {
|
|
114
|
+
val fixed = listOf(false, false, false)
|
|
115
|
+
assertNull(nativeListTitleSegmentOverflowIndex(listOf(80f, 20f, 90f), fixed, listOf(80f, 20f, 90f)))
|
|
116
|
+
// Cut inside a run: that run truncates by itself.
|
|
117
|
+
assertNull(nativeListTitleSegmentOverflowIndex(listOf(100f, 100f), fixed, listOf(100f, 40f)))
|
|
118
|
+
assertNull(
|
|
119
|
+
nativeListTitleSegmentOverflowIndex(listOf(100f, 100f, 100f), fixed, listOf(100f, 40f, 0f))
|
|
120
|
+
)
|
|
121
|
+
assertNull(nativeListTitleSegmentOverflowIndex(listOf(100f, 100f), fixed, listOf(0f, 0f)))
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@Test
|
|
125
|
+
fun aRunFoldsLineBreaksIntoSpaces() {
|
|
126
|
+
assertEquals("Main Wallet", nativeListTitleRunText("Main\nWallet"))
|
|
127
|
+
assertEquals("a b c", nativeListTitleRunText("a\r\nb\rc"))
|
|
128
|
+
assertEquals("Account #1", nativeListTitleRunText("Account #1"))
|
|
129
|
+
}
|
|
130
|
+
}
|
package/docs/ROW_TEMPLATES.md
CHANGED
|
@@ -54,7 +54,14 @@ separately from source implementation in STYLE_SPEC §9.
|
|
|
54
54
|
|
|
55
55
|
- **Use:** an identifiable asset, account, wallet, network or setting.
|
|
56
56
|
- **Required data:** `leading`, `title`; optional `subtitle`, `tertiary`, `badges`,
|
|
57
|
-
`trailing`, `leadingAction`, `titleIcon`, Web-only `secondaryTitleIcon`,
|
|
57
|
+
`trailing`, `leadingAction`, `titleIcon`, Web-only `secondaryTitleIcon`, `titleSegments`,
|
|
58
|
+
`titleLeadingIcon`, match ranges and structured subtitle segments.
|
|
59
|
+
- **Title runs:** optional `titleSegments` draw 1...4 runs with their own tone and
|
|
60
|
+
weight in place of `title`, on one line. One run may shrink; the others keep
|
|
61
|
+
their width under an optional `maxWidthRatio` cap. `title` stays the spoken
|
|
62
|
+
text. See SPEC.md.
|
|
63
|
+
- **Leading title icon:** optional `titleLeadingIcon` draws a 16-point glyph 6
|
|
64
|
+
points before the title; it is decorative unless labelled.
|
|
58
65
|
- **Static title icon:** optional 20-point icon immediately after the title with
|
|
59
66
|
a 4-point gap. It has no click action; an optional Web `hoverActionKey`
|
|
60
67
|
emits an icon-anchored tooltip request on hover or touch. A trailing `button` is the fixed small
|
package/docs/SPEC.md
CHANGED
|
@@ -116,6 +116,17 @@ Status: implemented in local source for the Select Address and Swap selectors;
|
|
|
116
116
|
native device and broader Web runtime verification remain pending. These fields travel in snapshot/patch JSON
|
|
117
117
|
and do not change the Nitro ABI.
|
|
118
118
|
|
|
119
|
+
Snapshot and patch validation requires a boolean for `collapseEmptyTrailing`;
|
|
120
|
+
a patch with `null` restores the default. Automatic height uses the same
|
|
121
|
+
trailing geometry, font features and tracking as the rendered text.
|
|
122
|
+
|
|
123
|
+
An `identity` row may set `collapseEmptyTrailing: true`: when it has no trailing
|
|
124
|
+
accessories, iOS drops the (empty) trailing column and its 12-point gap so the
|
|
125
|
+
text column reaches the row's trailing padding, as a React Native `ListItem`
|
|
126
|
+
without children does. Omission keeps the legacy iOS reservation. Android and
|
|
127
|
+
Web already give an empty trailing column no width or gap, so the flag does not
|
|
128
|
+
change them.
|
|
129
|
+
|
|
119
130
|
An `identity` row may opt into `subtitleLines: 0`, meaning the complete subtitle
|
|
120
131
|
wraps at its measured text-column width without a line cap. Existing omitted,
|
|
121
132
|
one-line and two-line behavior stays unchanged. An identity row with
|
|
@@ -193,6 +204,15 @@ names through the same DOM helper; their previous coverage does not expand.
|
|
|
193
204
|
Image preserves raw path order, fill rules, fixed colors, opacity and viewBoxes.
|
|
194
205
|
NativeList retains its layout, button bounds, actions and snapshot interfaces.
|
|
195
206
|
|
|
207
|
+
The registries are aliases and native geometry, not a whitelist. iOS and Android
|
|
208
|
+
already resolve any other name through image's `OneKeyNamedSVG` catalog. Web now
|
|
209
|
+
does the same: a name missing from the Web registry is passed to
|
|
210
|
+
`createNamedIcon` unchanged, so every host-catalog icon (for example
|
|
211
|
+
`DeleteOutline`, `MinusCircleSolid`) renders as artwork on all three platforms.
|
|
212
|
+
Only a name the host catalog also lacks keeps the legacy text glyph. The
|
|
213
|
+
trailing `drag` accessory renders the `DragOutline` artwork on Web instead of
|
|
214
|
+
`≡` when the host provides it.
|
|
215
|
+
|
|
196
216
|
Focused SDK fixture acceptance covers native attached lifecycle/rebinding,
|
|
197
217
|
legacy iOS asset comparisons, shared alpha semantics and real Web/Electron
|
|
198
218
|
source/lib consumers. This is not full App, balance, transaction or signed
|
|
@@ -202,7 +222,8 @@ Identity trailing accessories stack vertically, except for the pairs every
|
|
|
202
222
|
platform lays out side by side: `value` + `checkbox`, `valuePair` + `menu`,
|
|
203
223
|
`valuePair` + an `icon` named `DotVerSolid` whose `actionKey` is `menu`,
|
|
204
224
|
`valuePair` + `chevron`, a `RefreshCcwOutline` icon without an action key +
|
|
205
|
-
`chevron`, and `PencilOutline`
|
|
225
|
+
`chevron`, and a `PencilOutline` icon followed by a `DragOutline` icon or a
|
|
226
|
+
`drag` accessory. iOS decides this in
|
|
206
227
|
`configureTrailingStack`; Android in `nativeListIdentityTrailingIsHorizontal`
|
|
207
228
|
(JVM test `NativeListIdentityTrailingAxisTest`). The `valuePair` + menu-icon
|
|
208
229
|
pair is the Swap token selector's balance column and row menu; stacking it
|
|
@@ -241,6 +262,112 @@ and Web acceptance must cover narrow addresses, dynamic type/fonts, long press
|
|
|
241
262
|
versus tap, keyboard interaction, and the horizontal warning border. Source or
|
|
242
263
|
build success alone is not runtime evidence.
|
|
243
264
|
|
|
265
|
+
### Identity title segments and leading title icon
|
|
266
|
+
|
|
267
|
+
Status: implemented in source for iOS, Android and Web; device and Web runtime
|
|
268
|
+
acceptance is pending. These fields travel in snapshot/patch JSON and do not
|
|
269
|
+
change the Nitro ABI. They serve recipient rows whose title is a wallet and an
|
|
270
|
+
account name in two styles, and address book rows marked by an icon before the
|
|
271
|
+
name.
|
|
272
|
+
|
|
273
|
+
`identity.titleSegments` is an optional list of 1...4 runs drawn on the title
|
|
274
|
+
line in place of `title`:
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
titleSegments?: readonly {
|
|
278
|
+
text: string;
|
|
279
|
+
tone?: 'primary' | 'secondary';
|
|
280
|
+
fontWeight?: 'regular' | 'medium';
|
|
281
|
+
shrink?: boolean;
|
|
282
|
+
maxWidthRatio?: number; // (0, 1]
|
|
283
|
+
}[];
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
- `title` stays required. It is the spoken label and the fallback text, so it
|
|
287
|
+
carries the same words as the runs; every renderer exposes `title`, not the
|
|
288
|
+
runs, to accessibility.
|
|
289
|
+
- Each run uses the title's font family, size and line height, including
|
|
290
|
+
`style.title` and the configured fonts. `tone` picks the primary or secondary
|
|
291
|
+
text color and defaults to the title color; `fontWeight` picks the weight and
|
|
292
|
+
defaults to the title weight. `style.title` only supplies those defaults: its
|
|
293
|
+
color and weight never replace a run's own `tone` or `fontWeight`, its
|
|
294
|
+
`lineHeight` is the line height of the runs on every platform, and its
|
|
295
|
+
`offsetY` moves the runs as it moves a plain title.
|
|
296
|
+
- The runs share one line. `titleLines` and `style.title.lines` do not apply
|
|
297
|
+
to them, for drawing or for auto-height measurement; a row that draws `title`
|
|
298
|
+
instead (it has `titleMatch`, or is a wallet sidebar row) keeps them for
|
|
299
|
+
both. A hard line break inside a run's text is drawn as one space; `title`
|
|
300
|
+
keeps it for the spoken label.
|
|
301
|
+
- Layout. The runs take the whole width the title line leaves after the
|
|
302
|
+
leading title icon and the title accessories (title icon, title image,
|
|
303
|
+
suffixes, badges), so those accessories sit at the line's end rather than
|
|
304
|
+
right after the text. W is that width:
|
|
305
|
+
1. A run's base width is its natural width, capped at `maxWidthRatio x W`
|
|
306
|
+
when given. A run longer than its cap truncates at the cap with a tail
|
|
307
|
+
ellipsis.
|
|
308
|
+
2. At most one run sets `shrink: true`. Every other run keeps its base width.
|
|
309
|
+
3. The shrinking run gets `min(base, W - sum of the other runs)` and
|
|
310
|
+
truncates with a tail ellipsis; it may shrink to zero width.
|
|
311
|
+
4. When the runs that do not shrink exceed W on their own, the line is cut at
|
|
312
|
+
its end. Native renderers end the last visible run with an ellipsis, also
|
|
313
|
+
when the cut falls exactly between two runs and that run fits in full; Web
|
|
314
|
+
clips it. This divergence is accepted: callers avoid the case with
|
|
315
|
+
`maxWidthRatio`. A shrinking run that gave up its whole width (rule 3) is
|
|
316
|
+
not such a cut: the runs that stay whole are drawn whole. A last visible
|
|
317
|
+
run narrower than the ellipsis is drawn whole as well, without one.
|
|
318
|
+
- Development validation rejects an empty, sparse or oversized list, blank or
|
|
319
|
+
oversized text (the 4096-code-unit text bound), unknown keys, tones or
|
|
320
|
+
weights, a ratio outside `(0, 1]`, more than one shrinking run, `titleMatch`
|
|
321
|
+
on the same row (its ranges index `title`), and
|
|
322
|
+
`presentation: 'walletSidebar'`. Production treats the runs as decoration:
|
|
323
|
+
an invalid list is dropped and the row shows `title`. Renderers draw `title`
|
|
324
|
+
instead of runs on a row that also has `titleMatch`, and ignore runs and the
|
|
325
|
+
leading icon with `presentation: 'walletSidebar'`.
|
|
326
|
+
|
|
327
|
+
`identity.titleLeadingIcon` is an optional `{ name, tintColor?,
|
|
328
|
+
accessibilityLabel? }`: a 16-point glyph before the title text or its runs,
|
|
329
|
+
with a 6-point gap, vertically centered on the title line. It keeps its 16
|
|
330
|
+
points: a long title, or its shrinking run, truncates first, and auto-height
|
|
331
|
+
measurement takes the glyph and its gap (22 points) out of the title's width.
|
|
332
|
+
The name comes from the same closed icon set as `titleIcon`; an unmapped name
|
|
333
|
+
leaves an empty 16-point slot, without a fallback text glyph. `tintColor` is a
|
|
334
|
+
hex `#RRGGBB` or `#RRGGBBAA` color and defaults to the theme's `iconSubdued`.
|
|
335
|
+
With `accessibilityLabel` the glyph is an image with that name; without it the
|
|
336
|
+
glyph is hidden from accessibility. It has no action of its own. Development validation
|
|
337
|
+
rejects unknown keys, a blank name, a malformed color and
|
|
338
|
+
`presentation: 'walletSidebar'`; production drops an invalid icon.
|
|
339
|
+
|
|
340
|
+
Both fields are identity patch fields. Omission in a full snapshot removes
|
|
341
|
+
them; omission in a patch keeps the current value. Development validation of a
|
|
342
|
+
patch on its own (`validatePatches`, `serializePatches`) applies the rules above
|
|
343
|
+
to a replacement. A production patch that
|
|
344
|
+
supplies an invalid replacement clears the current value, as `null` does, so
|
|
345
|
+
the row shows `title` instead of stale runs or a stale glyph. Rebind and recycle remove the
|
|
346
|
+
previous runs and glyph, so a row without them never shows another row's.
|
|
347
|
+
|
|
348
|
+
| Platform | Title runs | Leading icon |
|
|
349
|
+
| --- | --- | --- |
|
|
350
|
+
| iOS | `NativeListTitleSegmentsLabel` draws the runs at the widths that `NativeListTitleSegmentLayout.swift` allocates for its bounds; it fills the title row in place of the row's filler. | `NativeListIconImageView`, first in the title row stack. A plain title beside it drops below required horizontal compression resistance, as beside `titleIcon`, so the title truncates before the glyph narrows. |
|
|
351
|
+
| Android | `NativeListTitleSegmentsView`, a `TextView` whose text is rebuilt for each measured width from `NativeListTitleSegmentLayout.kt` and which measures to the width it is offered. `PackedTitleLineLayout.titleChild` names the flexible title view, so a view may precede it. | `OneKeyIconView`, first in the title line. |
|
|
352
|
+
| Web | A flex line that fills the title line: the shrinking run is `flex: 0 1 auto; min-width: 0`, the others `flex: 0 0 auto` with a `max-width` percentage for a cap. | An icon element before the title text. |
|
|
353
|
+
|
|
354
|
+
Conformance: `src/validation.ts` (`assertTitleSegments`,
|
|
355
|
+
`assertTitleLeadingIcon`, production sanitizing) with `validation.test.ts`;
|
|
356
|
+
`src/web/templates/IdentityRowRenderer.ts` with `IdentityTitleRunsWeb.test.ts`
|
|
357
|
+
(run styles under `style.title`, flex behavior, glyph size, accessibility,
|
|
358
|
+
rebind); `ios/NativeListTitleSegmentLayout.swift` (run widths, the overflow
|
|
359
|
+
ellipsis, one-line run text, the glyph's width, and when the runs and the
|
|
360
|
+
glyph show) with the SwiftPM `NativeListTitleSegmentLayoutTests`; the iOS
|
|
361
|
+
leading glyph beside a long plain title, wallet sidebar rows and the measured
|
|
362
|
+
height of a highlighted title, of a title beside the glyph and of runs with the
|
|
363
|
+
XCTest
|
|
364
|
+
`NativeListIdentityTitleIconLayoutTests`; `NativeListTitleSegmentLayout.kt`
|
|
365
|
+
with the JVM `NativeListTitleSegmentLayoutTest`. iOS, Android and Web runtime acceptance is pending: recipient rows
|
|
366
|
+
with long wallet and account names in both truncation directions, narrow rows,
|
|
367
|
+
dark mode, dynamic type and configured fonts, and recycling between rows with
|
|
368
|
+
and without runs or a leading icon. Source and build success alone are not
|
|
369
|
+
runtime evidence.
|
|
370
|
+
|
|
244
371
|
### DeFi position row controls
|
|
245
372
|
|
|
246
373
|
Status: implemented in local source, unreleased. Focused validation and Web
|
|
@@ -444,7 +571,13 @@ existing appearance.
|
|
|
444
571
|
|
|
445
572
|
Identity leading visuals consume the existing `borderColor` as a one-point/dp
|
|
446
573
|
solid bitmap border when supplied without `borderStyle: 'dashed'`; omission or
|
|
447
|
-
a dashed style clears the solid border on every bind.
|
|
574
|
+
a dashed style clears the solid border on every bind. An optional `borderWidth`
|
|
575
|
+
(`0 < width <= 4` logical units, default 1) sets that solid border's width; a
|
|
576
|
+
host hairline (`StyleSheet.hairlineWidth`) draws one physical pixel on iOS and
|
|
577
|
+
Android (rounded up to at least one pixel) and a fractional CSS border on Web.
|
|
578
|
+
Web insets the main image into the bordered frame's content box, as iOS and
|
|
579
|
+
Android do, and a sized `fallbackIcon` keeps its requested size there instead
|
|
580
|
+
of shrinking to the content box.
|
|
448
581
|
The image is inset by that border width. An overlay may optionally set
|
|
449
582
|
`fontWeight` to one of the existing text weight names
|
|
450
583
|
(`regular | medium | semibold | bold`). This changes only overlay text;
|
|
@@ -517,6 +650,20 @@ migration itself does not change any other protocol field.
|
|
|
517
650
|
|
|
518
651
|
## Lifecycle and concurrency
|
|
519
652
|
|
|
653
|
+
### Android account-selector subtitle updates
|
|
654
|
+
|
|
655
|
+
An already bound `identity` row with `presentation: 'accountSelector'` updates
|
|
656
|
+
its existing subtitle labels in place when only their text, formatted text
|
|
657
|
+
segments, tone, or the row's accessibility label changes. The same avatar
|
|
658
|
+
view and its active or completed request stay in place. Selection and
|
|
659
|
+
accessibility reflect the accepted row, and the updated labels are remeasured
|
|
660
|
+
to allocate their new widths. The comparison uses the last rendered content
|
|
661
|
+
even when a newer selection callback has arrived. Row selection and existing
|
|
662
|
+
checkbox state are applied separately and do not require a rebuild. A
|
|
663
|
+
different key, subtitle slot structure, other row content, or binding inputs
|
|
664
|
+
(such as theme or layout) uses the normal binding path. Recycling still
|
|
665
|
+
releases the row's image work.
|
|
666
|
+
|
|
520
667
|
### Updates before native host binding
|
|
521
668
|
|
|
522
669
|
Status: implemented in local source, unreleased. The delayed-host regression fails
|
|
@@ -553,6 +700,38 @@ image that already loaded. Common container styling clears what it wrote on the
|
|
|
553
700
|
next bind, including properties it set on template children. UI mutation remains on the platform
|
|
554
701
|
UI thread; [DESIGN.md](DESIGN.md) describes update and event ownership.
|
|
555
702
|
|
|
703
|
+
### iOS cell requests during snapshot replacement
|
|
704
|
+
|
|
705
|
+
Status: implemented, unreleased. On iOS 17.5 and 26.0, a focused UIKit fixture
|
|
706
|
+
reproduced the assertion on version 6.7.0-62 and completed the same layout
|
|
707
|
+
with the fix. Three focused UIKit tests passed on both runtimes, including
|
|
708
|
+
fixed-footer action routing. Consuming-app acceptance of the fix remains
|
|
709
|
+
pending.
|
|
710
|
+
|
|
711
|
+
When a snapshot removes rows, UIKit may request cells from its outgoing
|
|
712
|
+
snapshot while the new logical rows are already active. The iOS host MUST
|
|
713
|
+
provide a valid reusable cell for such requests. Until UIKit completes the
|
|
714
|
+
removal, the host retains only the removed row descriptors needed for pending
|
|
715
|
+
snapshot applications. These descriptors are presentation-only and cannot
|
|
716
|
+
emit actions, expose accessibility elements, or become selectable. Repeated
|
|
717
|
+
updates must preserve the descriptors still needed by in-flight applications
|
|
718
|
+
and must release them on completion or host disposal. A request with no
|
|
719
|
+
available descriptor receives an inert empty cell. The accepted snapshot,
|
|
720
|
+
patch validation, row identity, and structural-transition behavior retain
|
|
721
|
+
their existing contracts.
|
|
722
|
+
|
|
723
|
+
The action and interaction restrictions apply to the presenting collection
|
|
724
|
+
row. Its top-level key determines whether its actions can be delivered,
|
|
725
|
+
including actions whose payload comes from a child renderer. The fixed footer
|
|
726
|
+
is a separate host and retains its normal interaction, even when it shares a
|
|
727
|
+
key with a retiring row.
|
|
728
|
+
|
|
729
|
+
Conformance scrolls an unmaterialized outgoing row into UIKit's viewport
|
|
730
|
+
during removal and checks its renderer, inert state, and the binding of the
|
|
731
|
+
first filtered row. It also covers fixed-footer actions with a shared key
|
|
732
|
+
during a structural transition. A separate consuming-app check covers address
|
|
733
|
+
input in the Send recipient picker.
|
|
734
|
+
|
|
556
735
|
### Android vertical-drag React touch cancellation
|
|
557
736
|
|
|
558
737
|
Status: implemented; four real Android MotionEvent/JSTouchDispatcher regressions
|
|
@@ -593,6 +772,121 @@ and one native end, a tap produces touch-end, and cancellation/removal followed
|
|
|
593
772
|
by reuse leaves the next tap functional. This proves native touch delivery, not
|
|
594
773
|
execution of a JavaScript press handler or physical-device gesture feel.
|
|
595
774
|
|
|
775
|
+
### Handle-only reorder activation
|
|
776
|
+
|
|
777
|
+
`capabilities.reorderActivation` selects where a reorder may start. `row`
|
|
778
|
+
(default, also when omitted) keeps the existing behavior: a long press anywhere
|
|
779
|
+
on a reorderable row. `handle` restricts the start to the row's trailing `drag`
|
|
780
|
+
accessory; a long press elsewhere on the row is an ordinary press or long press
|
|
781
|
+
and never begins a reorder. Development and production reject any other value
|
|
782
|
+
and retain the currently accepted snapshot.
|
|
783
|
+
|
|
784
|
+
- **Gesture:** iOS and Android keep their reorder long-press duration (200 ms)
|
|
785
|
+
and movement tolerance. Web keeps its touch long press and mouse drag
|
|
786
|
+
threshold; only the pointer-down target is narrowed.
|
|
787
|
+
- **Hit area:** the visible `drag` accessory. Android accepts its 24dp glyph
|
|
788
|
+
slot plus 7dp on each side (its actual 38dp button frame). Android maps
|
|
789
|
+
the screen press into the handle's local coordinates at press and at
|
|
790
|
+
recognition, accounting for transforms and scrolling between ancestors.
|
|
791
|
+
iOS also uses the button frame. Recognition remains tied to the row and handle that
|
|
792
|
+
received the initial touch, even if the finger moves across a row boundary.
|
|
793
|
+
A removed handle or a recycled binding cancels a pending start and keeps
|
|
794
|
+
accepted data updates. An iOS or Android selection echo that retains the row
|
|
795
|
+
binding and its handle preserves the pending press.
|
|
796
|
+
- **Eligibility:** row reorder eligibility (`draggable`, a `drag` accessory,
|
|
797
|
+
`disabled`) is unchanged. A row without a `drag` accessory cannot start a
|
|
798
|
+
reorder in `handle` mode.
|
|
799
|
+
- **Accessory:** a `drag` without an action swallows a short tap on iOS and
|
|
800
|
+
passes it to the row on Android and Web. In Web handle mode a `drag` with
|
|
801
|
+
an `actionKey` can start a reorder and still emits its action on a short
|
|
802
|
+
tap. A recognized reorder suppresses the click generated by that press,
|
|
803
|
+
including release after cancellation. Overlapping pointer sequences retain
|
|
804
|
+
their own suppression until a matching click or new press with that pointer
|
|
805
|
+
ID, native cancellation, or 500 ms after release. A click without a pointer ID
|
|
806
|
+
matches the most recent release at the same action or row and client position
|
|
807
|
+
(within one CSS pixel), using the input type when the browser supplies it.
|
|
808
|
+
For a press and release on different elements, the match uses their nearest
|
|
809
|
+
shared ancestor as the click target. Releases outside the list cannot replace
|
|
810
|
+
that match. A new short tap or
|
|
811
|
+
keyboard activation can still emit the action. Icons beside the handle keep
|
|
812
|
+
their own actions.
|
|
813
|
+
Callers can use `pressDisabled` to disable row opening.
|
|
814
|
+
- **Web cursor:** in `handle` mode the row keeps the default cursor and the
|
|
815
|
+
handle shows `grab`.
|
|
816
|
+
- **Handle appearance:** every platform tints the `DragOutline` glyph
|
|
817
|
+
`iconSubdued`, matching `ListItem.IconButton`; Web centers it in a 24-point
|
|
818
|
+
box so it lines up with neighbouring icon buttons instead of the text line.
|
|
819
|
+
iOS and Android draw the handle as a medium tertiary button (38-point frame,
|
|
820
|
+
glyph inset 7), like the source `IconButton`, so a `PencilOutline` + `drag`
|
|
821
|
+
pair keeps 24 points between glyph slots (Android gives the second frame a
|
|
822
|
+
17dp start margin after its m=-7); Web applies the same 24-point gap.
|
|
823
|
+
- **Tertiary text gap:** when the first trailing accessory is a tertiary icon,
|
|
824
|
+
the text column ends 12 points before its glyph slot, as `ListItem` lays it
|
|
825
|
+
out. iOS absorbs the button's m=-7 on the text side (it clipped 9 points
|
|
826
|
+
early), Android adds the 12dp end margin the -7 had eaten (text ran into the
|
|
827
|
+
button), and Web already does this through CSS margins.
|
|
828
|
+
- **Leading action geometry:** an identity `leadingAction` reproduces
|
|
829
|
+
`ListItem.IconButton` (medium tertiary: 6-point padding plus a 1-point
|
|
830
|
+
border, m=-7) on all three platforms, so its glyph sits on a 24-point slot at
|
|
831
|
+
the 12-point row padding and the leading visual starts at 48. iOS and Android
|
|
832
|
+
use a 36-point frame with a 6-point inset and 6-point following gap; Web
|
|
833
|
+
applies the tertiary icon frame and reports the inner glyph slot's window
|
|
834
|
+
rect, including any ancestor transform. Web icon buttons use an explicit
|
|
835
|
+
accessibility label where supplied and otherwise retain their fallback
|
|
836
|
+
glyph as a name even when host SVG artwork is present.
|
|
837
|
+
|
|
838
|
+
- **Enclosing pans (iOS):** once a reorder has started, the list disables the
|
|
839
|
+
enabled `UIPanGestureRecognizer`s of its ancestors (for example a sheet's
|
|
840
|
+
dismiss pan or a pager) and restores them when the reorder finishes, is
|
|
841
|
+
cancelled by a structural update, or the list is torn down. Before the long
|
|
842
|
+
press is recognized those pans behave as before, so a quick pull still drags
|
|
843
|
+
the sheet. This applies to both activation modes. The NativeOverlay page
|
|
844
|
+
sheet combines temporary suppression with the current `dismissOnPanDown`
|
|
845
|
+
setting, including prop changes during the drag.
|
|
846
|
+
|
|
847
|
+
Toggling `reorderActivation` or `reorderable` cancels pending and active
|
|
848
|
+
pointer reorder without emitting a reorder event. An accepted full Web
|
|
849
|
+
snapshot supersedes a provisional reorder; accepted row patches retain their
|
|
850
|
+
content even if a gesture is cancelled. The capability travels in snapshot JSON;
|
|
851
|
+
the Nitro ABI is unchanged.
|
|
852
|
+
|
|
853
|
+
Web reorderable data rows, including wallet groups, show a visible focus
|
|
854
|
+
indicator and can receive keyboard focus even when `pressDisabled`. In
|
|
855
|
+
`handle` mode the focused row must have a rendered handle to start keyboard
|
|
856
|
+
sorting. Fixed footers and other rows outside the reorderable data set follow
|
|
857
|
+
their ordinary focus and action rules. Toggling sorting eligibility preserves
|
|
858
|
+
focus on unchanged inline controls.
|
|
859
|
+
|
|
860
|
+
Space starts the keyboard preview with the source row and its handle visible.
|
|
861
|
+
Arrow keys move it and reveal the new position using measured row heights.
|
|
862
|
+
Space on the focused source row commits. Escape restores the original order
|
|
863
|
+
and returns focus to the source while it is mounted, including when focus has
|
|
864
|
+
moved to another row. Tab, wheel input directed to the list's scroll owner,
|
|
865
|
+
virtualization of the source by another scroll, or recognition of a pointer
|
|
866
|
+
reorder discards the preview without emitting `onReorder` or reclaiming focus.
|
|
867
|
+
Independent nested scroll areas keep their own wheel input according to their
|
|
868
|
+
physical scroll direction, including vertical writing modes. A key event from
|
|
869
|
+
another row cannot commit the previous source's preview. An unchanged fixed
|
|
870
|
+
footer keeps its focused control and accepts its normal keyboard action after
|
|
871
|
+
rollback. If rollback recycles the key event's target, that event cannot
|
|
872
|
+
activate the newly bound row or control.
|
|
873
|
+
|
|
874
|
+
A short pointer click keeps its normal action during a keyboard preview.
|
|
875
|
+
A keyboard move or independent rollback invalidates any pending pointer
|
|
876
|
+
reorder from the previous geometry and lets a previous drop animation finish.
|
|
877
|
+
Once the pointer gesture qualifies as a reorder, it restores the original
|
|
878
|
+
order and reveals the selected row if needed. A full snapshot accepted during
|
|
879
|
+
that rollback supersedes the handoff, and the recognized gesture still
|
|
880
|
+
suppresses its release click.
|
|
881
|
+
Pointer displacement, including movement beyond the viewport edge, determines
|
|
882
|
+
movement from the restored position. A stationary long press keeps the
|
|
883
|
+
restored order.
|
|
884
|
+
|
|
885
|
+
Leading visual `borderWidth` supports values in (0, 4]. Development rejects
|
|
886
|
+
out-of-range widths; production discards the invalid width in full snapshots
|
|
887
|
+
and patches so the border uses its existing default of 1. Production also
|
|
888
|
+
discards invalid tracking and digit-spacing overrides so template defaults apply.
|
|
889
|
+
|
|
596
890
|
### Android reorder cancellation
|
|
597
891
|
|
|
598
892
|
Status: implemented; three real Android View/callback regressions verified on
|
|
@@ -1776,7 +2070,12 @@ secondary text and subscript text segments. Segments are caller-formatted and
|
|
|
1776
2070
|
never interpreted as numbers by NativeList. Omission preserves the legacy tree.
|
|
1777
2071
|
|
|
1778
2072
|
`presentation: stacked` places the amount lines after the identity column and
|
|
1779
|
-
right-aligns them. In
|
|
2073
|
+
right-aligns them. In stacked presentation the amount and fee columns stay at
|
|
2074
|
+
the width of their content (the widest amount line, including its 20pt icon);
|
|
2075
|
+
the identity column receives the remaining row width. That is the width measure
|
|
2076
|
+
uses for the description, on iOS and Android. On iOS the stacked amount column is
|
|
2077
|
+
capped at half the row width; amounts wider than that truncate.
|
|
2078
|
+
In `table`, the identity column includes its leading visual
|
|
1780
2079
|
and gap; identity, amounts and an optional fee use stable widths in the ratio
|
|
1781
2080
|
`1:1:0.6` after inter-column gaps. Without fee, identity and amounts split the
|
|
1782
2081
|
remaining width equally. Amount content stays start-aligned within its column;
|
|
@@ -1785,7 +2084,14 @@ Fee text length and leading visibility cannot move the amount column. These
|
|
|
1785
2084
|
native widths match the existing Web table layout. Fee supports label, primary
|
|
1786
2085
|
and secondary text with their own segments; `hidden` preserves its column width
|
|
1787
2086
|
while hiding its contents. Up to four uniquely keyed title badges use declared
|
|
1788
|
-
tones.
|
|
2087
|
+
tones. The badges follow the title text directly: while badges are present the
|
|
2088
|
+
title line packs at its start on every platform (iOS a slack-absorbing filler at
|
|
2089
|
+
the end of the title line, Android `PackedTitleLineLayout`, Web flex `0 1 auto`),
|
|
2090
|
+
so badges never drift toward the amount column, and a long title truncates in
|
|
2091
|
+
front of its badges (OK-67497). On iOS and Android the title spans the line when
|
|
2092
|
+
there are no badges, so `style.title.alignment` keeps its effect and a recycled row
|
|
2093
|
+
that lost its badges lays out the title exactly like a fresh row; Web keeps its
|
|
2094
|
+
existing content-sized title element. `descriptionActionKey` makes only the description emit that action with
|
|
1789
2095
|
source `description`; footer actions retain their existing source/keys and
|
|
1790
2096
|
disabled behavior. All actions use the current host binding epoch.
|
|
1791
2097
|
|
|
@@ -1855,7 +2161,8 @@ legacy Activity rows without rich fields retain their existing behavior.
|
|
|
1855
2161
|
|
|
1856
2162
|
Acceptance: 1/2/6/32 lines, changed keys/order, paired icons and network overlays,
|
|
1857
2163
|
small-number segments in amounts/fiat/fee (ceil(0.6 × parent font size), unchanged
|
|
1858
|
-
baseline, matching NumberSizeableText), badge tone/clear,
|
|
2164
|
+
baseline, matching NumberSizeableText), badge tone/clear, badges adjacent to
|
|
2165
|
+
short and truncated long titles, centered title after badges are cleared, hidden fee, disabled
|
|
1859
2166
|
actions, description anchors, dark/RTL/font scaling and explicit/automatic height.
|
|
1860
2167
|
|
|
1861
2168
|
|
package/docs/STYLE_SPEC.md
CHANGED
|
@@ -234,7 +234,7 @@ meaning is defined in the [catalog](ROW_TEMPLATES.md).
|
|
|
234
234
|
|
|
235
235
|
Every text role listed below accepts the same `NativeListTextStyle`:
|
|
236
236
|
`token`, `fontSize`, `fontWeight`, `color`, `lineHeight`, `lines`, `truncate`,
|
|
237
|
-
`alignment`, `verticalAlignment`, `offsetY`.
|
|
237
|
+
`alignment`, `verticalAlignment`, `offsetY`, `letterSpacing`, `tabularNumbers`.
|
|
238
238
|
Weights are `regular | medium | semibold | bold`; line counts are `1 | 2 | 3`;
|
|
239
239
|
`start | center | end` alignment follows layout direction on all three
|
|
240
240
|
platforms (`end` is the left edge in RTL). Colors must be
|
|
@@ -363,6 +363,8 @@ style: {
|
|
|
363
363
|
| `alignment` | Horizontal `start / center / end` inside the text region, respecting direction |
|
|
364
364
|
| `verticalAlignment` | `top / center / bottom` for the complete text block inside its allocated text region; no effect without spare height |
|
|
365
365
|
| `offsetY` | `-8…8` logical units of optical translation; does not change measurement, sibling spacing or hit areas |
|
|
366
|
+
| `letterSpacing` | `-4…10` logical units between glyphs. iOS sets `.kern`, so an explicit `0` also turns off pair kerning, matching React Native `letterSpacing: 0`; Android converts to em of the current text size and adds `'kern' 0`, matching React Native text there too; Web sets CSS `letter-spacing`. Omission keeps each platform's existing tracking |
|
|
367
|
+
| `tabularNumbers` | `true` draws equal-width digits, as the App's `SizableText` does by default: iOS swaps each run to the monospaced-number font feature, Android sets `tnum`, Web sets `font-variant-numeric: tabular-nums`. `false` explicitly selects proportional digits. Omission keeps each template's current digits, including selector defaults |
|
|
366
368
|
|
|
367
369
|
Single-line text does not wrap; explicit CR/LF line breaks become spaces (CRLF is
|
|
368
370
|
one break). Multi-line text wraps naturally, preserves explicit breaks, and
|
|
@@ -570,6 +572,10 @@ model fields, whatever the renderer's internal view names are.
|
|
|
570
572
|
| table layout | `$bodyXs` | 11 regular / 14 | sp(11) regular / dp(14) | — |
|
|
571
573
|
| `value` | `$bodyLg` | 16 / 24 | sp(16) medium / dp(24) | 14px / 20px / 500 **≠** |
|
|
572
574
|
|
|
575
|
+
Android history titles keep their default tracking when `style.title` omits
|
|
576
|
+
`letterSpacing`. Web network selector success badges inherit tabular numerals
|
|
577
|
+
from the section, independently of explicit digit styles on the title or value.
|
|
578
|
+
|
|
573
579
|
### action
|
|
574
580
|
|
|
575
581
|
| Key | Default | iOS | Android | Web |
|
|
@@ -7,6 +7,8 @@ final class NativeListAccessoryButton: NativeListIconButton {
|
|
|
7
7
|
var fixedTextLineHeight: CGFloat?
|
|
8
8
|
var rowTextOffsetY: CGFloat = 0
|
|
9
9
|
var helpBindingGeneration = 0
|
|
10
|
+
/// Marks the trailing `drag` accessory that can start a handle-only reorder.
|
|
11
|
+
var isReorderHandle = false
|
|
10
12
|
private var helpTrackingGeneration = 0
|
|
11
13
|
override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
|
12
14
|
helpTrackingGeneration = helpBindingGeneration
|
|
@@ -278,6 +280,14 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
278
280
|
}
|
|
279
281
|
isHidden = arrangedSubviews.allSatisfy { $0.isHidden }
|
|
280
282
|
}
|
|
283
|
+
func explicitTextStyle(for view: UIView, style: [String: Any]) -> [String: Any]? {
|
|
284
|
+
switch semanticValueButtons.firstIndex(where: { $0 === view }) {
|
|
285
|
+
case 0: return style.dictionary("value")
|
|
286
|
+
case 1: return style.dictionary("valueSecondary")
|
|
287
|
+
default: return nil
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
281
291
|
func updateSelection(
|
|
282
292
|
_ item: NativeListItem,
|
|
283
293
|
checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
|
|
@@ -339,6 +349,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
339
349
|
button.isHidden = true
|
|
340
350
|
button.isEnabled = true
|
|
341
351
|
button.isUserInteractionEnabled = true
|
|
352
|
+
button.isReorderHandle = false
|
|
342
353
|
button.alpha = 1
|
|
343
354
|
button.accessibilityIdentifier = nil
|
|
344
355
|
button.accessibilityLabel = nil
|
|
@@ -440,10 +451,15 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
440
451
|
case "drag":
|
|
441
452
|
var icon = accessory
|
|
442
453
|
icon["name"] = "DragOutline"
|
|
454
|
+
// ListItem draws the handle as a medium tertiary IconButton (38-point frame).
|
|
455
|
+
icon["buttonStyle"] = "tertiary"
|
|
443
456
|
if icon["tintColor"] == nil {
|
|
444
457
|
icon["tintColor"] = theme?["iconSubdued"] as? String ?? "#8D8D8D"
|
|
445
458
|
}
|
|
446
459
|
showAccessoryIcon(textIndex, icon)
|
|
460
|
+
if accessoryButtons.indices.contains(textIndex) {
|
|
461
|
+
accessoryButtons[textIndex].isReorderHandle = true
|
|
462
|
+
}
|
|
447
463
|
textIndex += 1
|
|
448
464
|
case "icon":
|
|
449
465
|
var icon = accessory
|
|
@@ -690,6 +706,8 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
690
706
|
button.layer.cornerRadius = size / 2
|
|
691
707
|
}
|
|
692
708
|
if isAccountIcon { contentGap = 5 }
|
|
709
|
+
// A leading tertiary button's m=-7 also pulls the text column 7 points closer.
|
|
710
|
+
if isTertiary && index == 0 && contentGap == nil { contentGap = 5 }
|
|
693
711
|
button.accessibilityIdentifier = data["testID"] as? String
|
|
694
712
|
button.accessibilityLabel = data["accessibilityLabel"] as? String
|
|
695
713
|
if !isDrillIn, !data.string("actionKey").isEmpty {
|
|
@@ -789,6 +807,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
789
807
|
var attributes: [NSAttributedString.Key: Any] = [:]
|
|
790
808
|
applyStyledFont(attributed, style, fallback: baseFont)
|
|
791
809
|
if style["color"] != nil { attributes[.foregroundColor] = color }
|
|
810
|
+
if style["letterSpacing"] != nil { attributes[.kern] = CGFloat(style.double("letterSpacing")) }
|
|
792
811
|
if style["alignment"] != nil || style["lineHeight"] != nil || style["lines"] != nil
|
|
793
812
|
|| style["truncate"] != nil
|
|
794
813
|
{
|
|
@@ -833,6 +852,9 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
833
852
|
range: range)
|
|
834
853
|
}
|
|
835
854
|
}
|
|
855
|
+
if let tabular = style["tabularNumbers"] as? Bool {
|
|
856
|
+
NativeListTextStyles.applyDigitSpacing(attributed, tabular: tabular, fallback: font)
|
|
857
|
+
}
|
|
836
858
|
button.setAttributedTitle(attributed, for: .normal)
|
|
837
859
|
}
|
|
838
860
|
|