@onekeyfe/react-native-native-list 6.8.0-9 → 6.8.0-alpha.540

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 (49) hide show
  1. package/android/build.gradle +3 -0
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +18 -4
  3. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +70 -33
  4. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +3 -2
  5. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +8 -1
  6. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +21 -4
  7. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +24 -3
  8. package/android/src/main/java/com/onekey/nativelist/NativeListRowUpdates.kt +34 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +11 -4
  10. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +84 -9
  11. package/android/src/main/res/values/native_scroll_coordinator_ids.xml +1 -0
  12. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentitySubtitleBindingTest.kt +177 -0
  13. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +2 -0
  14. package/docs/SPEC.md +127 -2
  15. package/docs/STYLE_SPEC.md +7 -1
  16. package/ios/NativeListAccessoryStack.swift +22 -0
  17. package/ios/NativeListDataRowRenderer.swift +12 -5
  18. package/ios/NativeListIdentityRenderer.swift +36 -58
  19. package/ios/NativeListLeadingVisual.swift +8 -0
  20. package/ios/NativeListMarketRenderer.swift +6 -2
  21. package/ios/NativeListModels.swift +7 -0
  22. package/ios/NativeListResolvedText.swift +9 -7
  23. package/ios/NativeListSectionHeaderRenderer.swift +9 -43
  24. package/ios/NativeListTextStyles.swift +72 -12
  25. package/ios/RNCNativeListView.swift +124 -20
  26. package/ios/tests/NativeListLifecycleTests.swift +105 -0
  27. package/lib/module/validation.js +21 -10
  28. package/lib/module/web/NativeListWebEngine.js +213 -23
  29. package/lib/module/web/templates/ActivityRowRenderer.js +1 -1
  30. package/lib/module/web/templates/IdentityRowRenderer.js +12 -1
  31. package/lib/module/web/templates/MarketRowRenderer.js +2 -0
  32. package/lib/module/web/templates/MediaTileRowRenderer.js +1 -0
  33. package/lib/module/web/templates/RowElements.js +2 -2
  34. package/lib/module/web/templates/RowText.js +2 -0
  35. package/lib/typescript/src/models.d.ts +15 -1
  36. package/lib/typescript/src/web/NativeListWebEngine.d.ts +8 -1
  37. package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +6 -2
  38. package/lib/typescript/src/web/templates/RowVisual.d.ts +1 -1
  39. package/package.json +1 -1
  40. package/src/models.ts +15 -0
  41. package/src/validation.ts +67 -4
  42. package/src/web/NativeListWebEngine.ts +382 -27
  43. package/src/web/templates/ActivityRowRenderer.ts +1 -1
  44. package/src/web/templates/IdentityRowRenderer.ts +23 -1
  45. package/src/web/templates/MarketRowRenderer.ts +2 -0
  46. package/src/web/templates/MediaTileRowRenderer.ts +1 -0
  47. package/src/web/templates/RowElements.ts +3 -2
  48. package/src/web/templates/RowText.ts +6 -0
  49. package/src/web/templates/RowVisual.ts +2 -1
@@ -7,6 +7,7 @@ import android.animation.AnimatorListenerAdapter
7
7
  import android.content.Context
8
8
  import android.graphics.Canvas
9
9
  import android.graphics.Color
10
+ import android.graphics.Matrix
10
11
  import android.graphics.Paint
11
12
  import android.graphics.Path
12
13
  import android.graphics.Rect
@@ -2791,6 +2792,7 @@ class NativeListView(
2791
2792
  previous.selectionMode != next.selectionMode ||
2792
2793
  previous.rowPressToggles != next.rowPressToggles ||
2793
2794
  previous.reorderable != next.reorderable ||
2795
+ previous.reorderFromHandleOnly != next.reorderFromHandleOnly ||
2794
2796
  previous.pullToRefresh != next.pullToRefresh ||
2795
2797
  previous.refreshTriggerDistance != next.refreshTriggerDistance ||
2796
2798
  previous.refreshing != next.refreshing ||
@@ -4537,18 +4539,35 @@ class NativeListView(
4537
4539
  reorderTouchHandler = handler
4538
4540
  val movementLimit = dp(REORDER_ALLOWABLE_MOVEMENT_DP).toFloat()
4539
4541
  reorderTouchListener = object : RecyclerView.SimpleOnItemTouchListener() {
4540
- private var candidate: RecyclerView.ViewHolder? = null
4542
+ private var candidate: NativeListViewHolder? = null
4543
+ private var candidateItem: NativeListItem? = null
4544
+ private var candidateHandle: View? = null
4545
+ private var candidateBindingEpoch = 0L
4546
+ private var rawDownX = 0f
4547
+ private var rawDownY = 0f
4541
4548
  private var downX = 0f
4542
4549
  private var downY = 0f
4543
4550
  private var dragStarted = false
4544
4551
  private val startDrag = Runnable {
4545
4552
  val holder = candidate ?: return@Runnable
4546
- val position = holder.bindingAdapterPosition
4547
- val item = adapter.itemAt(position) ?: return@Runnable
4548
- if (!item.isReorderable) return@Runnable
4549
- if (item.type != "walletGroup" && recyclerView.isLayoutRequested) {
4553
+ val original = candidateItem ?: return@Runnable
4554
+ if (original.type != "walletGroup" && recyclerView.isLayoutRequested) {
4550
4555
  relayoutRecyclerViewImmediately()
4551
4556
  }
4557
+ val item = adapter.itemAt(holder.bindingAdapterPosition) ?: return@Runnable
4558
+ val acceptedIndex = acceptedKeyIndex?.get(original.key) ?: return@Runnable
4559
+ val current = config ?: return@Runnable
4560
+ val accepted = current.items.getOrNull(acceptedIndex) ?: return@Runnable
4561
+ if (item.key != original.key || accepted.key != original.key || !accepted.isReorderable)
4562
+ return@Runnable
4563
+ val handle = candidateHandle
4564
+ if (handle != null) {
4565
+ val controlled = current.selectionMode == "single" || current.selectionMode == "multiple"
4566
+ if (holder.rowView.bindingEpoch != candidateBindingEpoch ||
4567
+ (accepted.content != original.content && !isStableSelectionUpdate(original, accepted, controlled)) ||
4568
+ findReorderHandle(holder.itemView, rawDownX, rawDownY) !== handle
4569
+ ) return@Runnable
4570
+ }
4552
4571
  dragStarted = true
4553
4572
  beginDrag(holder)
4554
4573
  }
@@ -4562,6 +4581,8 @@ class NativeListView(
4562
4581
  private fun cancelPending() {
4563
4582
  handler.removeCallbacks(startDrag)
4564
4583
  candidate = null
4584
+ candidateItem = null
4585
+ candidateHandle = null
4565
4586
  }
4566
4587
 
4567
4588
  override fun onInterceptTouchEvent(recyclerView: RecyclerView, event: MotionEvent): Boolean {
@@ -4572,11 +4593,14 @@ class NativeListView(
4572
4593
  dragStarted = false
4573
4594
  downX = event.x
4574
4595
  downY = event.y
4596
+ rawDownX = event.rawX
4597
+ rawDownY = event.rawY
4575
4598
  val child = recyclerView.findChildViewUnder(event.x, event.y)
4576
4599
  candidate = child
4577
4600
  ?.let(recyclerView::getChildViewHolder)
4578
4601
  // Container-slot holders report binding position 0 in their own adapter.
4579
- ?.takeIf { holder -> holder is NativeListViewHolder && holder.bindingAdapter === adapter }
4602
+ ?.let { it as? NativeListViewHolder }
4603
+ ?.takeIf { holder -> holder.bindingAdapter === adapter }
4580
4604
  ?.takeIf { holder ->
4581
4605
  adapter.itemAt(holder.bindingAdapterPosition)?.let { item ->
4582
4606
  // OneKey patch: any wallet group member can initiate the group drag.
@@ -4586,10 +4610,14 @@ class NativeListView(
4586
4610
  // item.type != "walletGroup" ||
4587
4611
  // event.rawY in holderLocation[1].toFloat()..(holderLocation[1] + dp(68)).toFloat()
4588
4612
  // )
4613
+ candidateItem = item
4614
+ if (config?.reorderFromHandleOnly == true) {
4615
+ candidateHandle = findReorderHandle(holder.itemView, rawDownX, rawDownY)
4616
+ if (candidateHandle == null) return@let false
4617
+ candidateBindingEpoch = holder.rowView.bindingEpoch
4618
+ }
4589
4619
  item.isReorderable &&
4590
- (holder as? NativeListViewHolder)?.rowView?.canStartWalletGroupReorder(
4591
- event.y - holder.itemView.top,
4592
- ) != false
4620
+ holder.rowView.canStartWalletGroupReorder(event.y - holder.itemView.top)
4593
4621
  } == true
4594
4622
  }
4595
4623
  if (candidate != null) handler.postDelayed(startDrag, REORDER_LONG_PRESS_MS)
@@ -4607,6 +4635,53 @@ class NativeListView(
4607
4635
  }.also(recyclerView::addOnItemTouchListener)
4608
4636
  }
4609
4637
 
4638
+ /** Find the visible trailing handle whose button frame contains the initial press. */
4639
+ private fun findReorderHandle(root: View, rawX: Float, rawY: Float): View? {
4640
+ if (root.visibility != View.VISIBLE) return null
4641
+ if (root.getTag(R.id.onekey_native_list_reorder_handle) == true) {
4642
+ return root.takeIf { reorderHandleContainsScreenPoint(it, rawX, rawY) }
4643
+ }
4644
+ if (root is ViewGroup) {
4645
+ for (index in 0 until root.childCount) {
4646
+ findReorderHandle(root.getChildAt(index), rawX, rawY)?.let { return it }
4647
+ }
4648
+ }
4649
+ return null
4650
+ }
4651
+
4652
+ private fun reorderHandleContainsScreenPoint(handle: View, rawX: Float, rawY: Float): Boolean {
4653
+ val localToScreen = Matrix()
4654
+ var view = handle
4655
+ while (true) {
4656
+ val parent = view.parent as? View ?: break
4657
+ localToScreen.postConcat(view.matrix)
4658
+ localToScreen.postTranslate(
4659
+ (view.left - parent.scrollX).toFloat(),
4660
+ (view.top - parent.scrollY).toFloat(),
4661
+ )
4662
+ view = parent
4663
+ }
4664
+
4665
+ // The top-level View's screen origin already includes its transform and
4666
+ // the window offset. Subtract its mapped origin to apply the matrix once.
4667
+ val screenOrigin = IntArray(2)
4668
+ view.getLocationOnScreen(screenOrigin)
4669
+ val mappedOrigin = floatArrayOf(0f, 0f)
4670
+ view.matrix.mapPoints(mappedOrigin)
4671
+ localToScreen.postConcat(view.matrix)
4672
+ localToScreen.postTranslate(
4673
+ screenOrigin[0] - mappedOrigin[0],
4674
+ screenOrigin[1] - mappedOrigin[1],
4675
+ )
4676
+
4677
+ val screenToLocal = Matrix()
4678
+ if (!localToScreen.invert(screenToLocal)) return false
4679
+ val point = floatArrayOf(rawX, rawY)
4680
+ screenToLocal.mapPoints(point)
4681
+ return point[0] >= 0f && point[0] < handle.width &&
4682
+ point[1] >= 0f && point[1] < handle.height
4683
+ }
4684
+
4610
4685
  private fun prepareDisplacedReorderAnimation(view: View, helper: ItemTouchHelper) {
4611
4686
  val previousX = view.x
4612
4687
  val previousY = view.y
@@ -4,4 +4,5 @@
4
4
  <item name="onekey_native_scroll_coordinator_refresh_inset" type="id" />
5
5
  <item name="onekey_native_scroll_coordinator_command_listener" type="id" />
6
6
  <item name="onekey_native_scroll_coordinator_command_cancel_listener" type="id" />
7
+ <item name="onekey_native_list_reorder_handle" type="id" />
7
8
  </resources>
@@ -0,0 +1,177 @@
1
+ package com.margelo.nitro.nativelist
2
+
3
+ import android.app.Activity
4
+ import android.view.View
5
+ import android.view.ViewGroup
6
+ import android.widget.FrameLayout
7
+ import android.widget.TextView
8
+ import com.facebook.react.bridge.BridgeReactContext
9
+ import com.facebook.react.uimanager.ThemedReactContext
10
+ import org.json.JSONArray
11
+ import org.json.JSONObject
12
+ import org.junit.After
13
+ import org.junit.Assert.assertEquals
14
+ import org.junit.Assert.assertFalse
15
+ import org.junit.Assert.assertNull
16
+ import org.junit.Assert.assertSame
17
+ import org.junit.Assert.assertTrue
18
+ import org.junit.Before
19
+ import org.junit.Test
20
+ import org.junit.runner.RunWith
21
+ import org.robolectric.Robolectric
22
+ import org.robolectric.RobolectricTestRunner
23
+ import org.robolectric.annotation.Config
24
+
25
+ @RunWith(RobolectricTestRunner::class)
26
+ @Config(sdk = [34])
27
+ class NativeListIdentitySubtitleBindingTest {
28
+ private val controller = Robolectric.buildActivity(Activity::class.java)
29
+ private lateinit var row: NativeListIdentityRowView
30
+ private val checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String =
31
+ { _, _, fallback -> fallback }
32
+
33
+ @Before
34
+ fun setUp() {
35
+ val activity = controller.setup().visible().get()
36
+ val context = ThemedReactContext(BridgeReactContext(activity.application), activity, "test", 1)
37
+ row = NativeListIdentityRowView(context, NativeListFonts())
38
+ activity.setContentView(FrameLayout(activity).apply { addView(row) })
39
+ }
40
+
41
+ @After
42
+ fun tearDown() {
43
+ row.dispose()
44
+ controller.pause().stop().destroy()
45
+ }
46
+
47
+ @Test
48
+ fun longerPlainBalanceRemeasuresTheExistingLabelWithoutDetachingAvatar() {
49
+ bind(account("--"))
50
+ measureRow()
51
+ val balance = requireNotNull(label("--"))
52
+ val originalWidth = balance.measuredWidth
53
+ assertTrue(originalWidth > 0)
54
+ assertFalse(balance.isLayoutRequested)
55
+ val originalEpoch = row.bindingEpoch
56
+ val avatarDetachments = watchAvatarDetachments()
57
+
58
+ val updated = account("12345678.90")
59
+ bind(updated)
60
+ assertTrue(balance.isLayoutRequested)
61
+ measureRow()
62
+
63
+ assertSame(balance, label("12345678.90"))
64
+ assertTrue(balance.measuredWidth > originalWidth)
65
+ assertSame(updated, row.tag)
66
+ assertEquals("Account, 12345678.90", row.contentDescription)
67
+ assertEquals(originalEpoch, row.bindingEpoch)
68
+ assertEquals(0, avatarDetachments())
69
+ }
70
+
71
+ @Test
72
+ fun selectionEchoThenBalanceKeepsTheSubtitleAndAvatarAttached() {
73
+ bind(account("--", checkbox = "unchecked"))
74
+ val balance = requireNotNull(label("--"))
75
+ val originalEpoch = row.bindingEpoch
76
+ val avatarDetachments = watchAvatarDetachments()
77
+ val checkbox = descendants(row).filterIsInstance<OneKeyCheckboxView>().single()
78
+
79
+ row.bindSelection(
80
+ account("--", selected = true, checkbox = "checked"), null, "linear", 0, true, checkboxState,
81
+ )
82
+ assertEquals("CheckboxCheckedCustom", checkbox.iconName)
83
+ bind(account("12.34", selected = true, checkbox = "checked"))
84
+
85
+ assertSame(balance, label("12.34"))
86
+ assertEquals("CheckboxCheckedCustom", checkbox.iconName)
87
+ assertEquals(originalEpoch, row.bindingEpoch)
88
+ assertEquals(0, avatarDetachments())
89
+ }
90
+
91
+ @Test
92
+ fun subtitleUpdateUsesRenderedContentAfterSelectionHasAdvancedTheModel() {
93
+ bind(account("--", showAction = true))
94
+ val originalEpoch = row.bindingEpoch
95
+ val previousAction = requireNotNull(label("Manage"))
96
+
97
+ row.bindSelection(account("--", selected = true), null, "linear", 0, true, checkboxState)
98
+ assertSame(previousAction, label("Manage"))
99
+ bind(account("12.34", selected = true))
100
+
101
+ assertNull(label("Manage"))
102
+ assertEquals("12.34", label("12.34")?.text.toString())
103
+ assertTrue(row.bindingEpoch > originalEpoch)
104
+ }
105
+
106
+ @Test
107
+ fun formattedBalanceUpdateReusesTheLabelAndClearsOldSpansOnPlainText() {
108
+ bind(account("--"))
109
+ val balance = requireNotNull(label("--"))
110
+ val originalEpoch = row.bindingEpoch
111
+ bind(account("0.0004", formatted = true))
112
+ assertSame(balance, label("0.04"))
113
+ bind(account("1.23"))
114
+ assertSame(balance, label("1.23"))
115
+ assertEquals(originalEpoch, row.bindingEpoch)
116
+ }
117
+
118
+ private fun bind(item: NativeListItem) {
119
+ row.bind(
120
+ item, null, "linear", "vertical", 0, item.json.optBoolean("selected"), checkboxState,
121
+ useSourceScale = false,
122
+ )
123
+ }
124
+
125
+ private fun measureRow() {
126
+ row.measure(
127
+ View.MeasureSpec.makeMeasureSpec(640, View.MeasureSpec.EXACTLY),
128
+ View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
129
+ )
130
+ row.layout(0, 0, row.measuredWidth, row.measuredHeight)
131
+ }
132
+
133
+ private fun account(
134
+ balance: String,
135
+ showAction: Boolean = false,
136
+ formatted: Boolean = false,
137
+ selected: Boolean = false,
138
+ checkbox: String? = null,
139
+ ): NativeListItem {
140
+ val json = JSONObject("""
141
+ {"key":"account","type":"identity","presentation":"accountSelector","title":"Account",
142
+ "leading":{"kind":"account","fallbackText":"AC"},
143
+ "subtitleSegments":[{"text":"$balance"},{"text":"0x1234","separatorBefore":true}]}
144
+ """).put("accessibilityLabel", "Account, $balance").put("selected", selected)
145
+ if (showAction) {
146
+ json.put("trailing", JSONArray("""[{"kind":"button","label":"Manage","actionKey":"manage"}]"""))
147
+ }
148
+ if (checkbox != null) {
149
+ json.put("trailing", JSONArray().put(JSONObject().put("kind", "checkbox").put("state", checkbox)))
150
+ }
151
+ if (formatted) {
152
+ json.getJSONArray("subtitleSegments").getJSONObject(0)
153
+ .put("textSegments", JSONArray("""[{"text":"0.0"},{"text":"4","style":"subscript"}]"""))
154
+ }
155
+ return NativeListItem.parse(json)
156
+ }
157
+
158
+ private fun label(text: String): TextView? =
159
+ descendants(row).filterIsInstance<TextView>().singleOrNull { it.text.toString() == text && it.visibility == View.VISIBLE }
160
+
161
+ private fun watchAvatarDetachments(): () -> Int {
162
+ val avatar = descendants(row).single { it is NativeListLeadingVisual }
163
+ var detachments = 0
164
+ avatar.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
165
+ override fun onViewAttachedToWindow(view: View) = Unit
166
+ override fun onViewDetachedFromWindow(view: View) { detachments++ }
167
+ })
168
+ return { detachments }
169
+ }
170
+
171
+ private fun descendants(view: View): Sequence<View> = sequence {
172
+ yield(view)
173
+ if (view is ViewGroup) {
174
+ for (index in 0 until view.childCount) yieldAll(descendants(view.getChildAt(index)))
175
+ }
176
+ }
177
+ }
@@ -24,6 +24,8 @@ class NativeListIdentityTrailingAxisTest {
24
24
  listOf(d("icon", "RefreshCcwOutline"), d("chevron")) to true,
25
25
  listOf(d("icon", "RefreshCcwOutline", "refresh"), d("chevron")) to false,
26
26
  listOf(d("icon", "PencilOutline", "edit"), d("icon", "DragOutline")) to true,
27
+ listOf(d("icon", "PencilOutline", "edit"), d("drag")) to true,
28
+ listOf(d("icon", "InfoCircleOutline", "edit"), d("drag")) to false,
27
29
  listOf(d("value"), d("checkbox")) to true,
28
30
  listOf(d("valuePair"), d("icon", "DotVerSolid", "menu"), d("chevron")) to false,
29
31
  )
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` + `DragOutline` icons. iOS decides this in
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
@@ -444,7 +465,13 @@ existing appearance.
444
465
 
445
466
  Identity leading visuals consume the existing `borderColor` as a one-point/dp
446
467
  solid bitmap border when supplied without `borderStyle: 'dashed'`; omission or
447
- a dashed style clears the solid border on every bind.
468
+ a dashed style clears the solid border on every bind. An optional `borderWidth`
469
+ (`0 < width <= 4` logical units, default 1) sets that solid border's width; a
470
+ host hairline (`StyleSheet.hairlineWidth`) draws one physical pixel on iOS and
471
+ Android (rounded up to at least one pixel) and a fractional CSS border on Web.
472
+ Web insets the main image into the bordered frame's content box, as iOS and
473
+ Android do, and a sized `fallbackIcon` keeps its requested size there instead
474
+ of shrinking to the content box.
448
475
  The image is inset by that border width. An overlay may optionally set
449
476
  `fontWeight` to one of the existing text weight names
450
477
  (`regular | medium | semibold | bold`). This changes only overlay text;
@@ -517,6 +544,20 @@ migration itself does not change any other protocol field.
517
544
 
518
545
  ## Lifecycle and concurrency
519
546
 
547
+ ### Android account-selector subtitle updates
548
+
549
+ An already bound `identity` row with `presentation: 'accountSelector'` updates
550
+ its existing subtitle labels in place when only their text, formatted text
551
+ segments, tone, or the row's accessibility label changes. The same avatar
552
+ view and its active or completed request stay in place. Selection and
553
+ accessibility reflect the accepted row, and the updated labels are remeasured
554
+ to allocate their new widths. The comparison uses the last rendered content
555
+ even when a newer selection callback has arrived. Row selection and existing
556
+ checkbox state are applied separately and do not require a rebuild. A
557
+ different key, subtitle slot structure, other row content, or binding inputs
558
+ (such as theme or layout) uses the normal binding path. Recycling still
559
+ releases the row's image work.
560
+
520
561
  ### Updates before native host binding
521
562
 
522
563
  Status: implemented in local source, unreleased. The delayed-host regression fails
@@ -625,6 +666,90 @@ and one native end, a tap produces touch-end, and cancellation/removal followed
625
666
  by reuse leaves the next tap functional. This proves native touch delivery, not
626
667
  execution of a JavaScript press handler or physical-device gesture feel.
627
668
 
669
+ ### Handle-only reorder activation
670
+
671
+ `capabilities.reorderActivation` selects where a reorder may start. `row`
672
+ (default, also when omitted) keeps the existing behavior: a long press anywhere
673
+ on a reorderable row. `handle` restricts the start to the row's trailing `drag`
674
+ accessory; a long press elsewhere on the row is an ordinary press or long press
675
+ and never begins a reorder. Development and production reject any other value
676
+ and retain the currently accepted snapshot.
677
+
678
+ - **Gesture:** iOS and Android keep their reorder long-press duration (200 ms)
679
+ and movement tolerance. Web keeps its touch long press and mouse drag
680
+ threshold; only the pointer-down target is narrowed.
681
+ - **Hit area:** the visible `drag` accessory. Android accepts its 24dp glyph
682
+ slot plus 7dp on each side (its actual 38dp button frame). Android maps
683
+ the screen press into the handle's local coordinates at press and at
684
+ recognition, accounting for transforms and scrolling between ancestors.
685
+ iOS also uses the button frame. Recognition remains tied to the row and handle that
686
+ received the initial touch, even if the finger moves across a row boundary.
687
+ A removed handle or a recycled binding cancels a pending start and keeps
688
+ accepted data updates. An iOS or Android selection echo that retains the row
689
+ binding and its handle preserves the pending press.
690
+ - **Eligibility:** row reorder eligibility (`draggable`, a `drag` accessory,
691
+ `disabled`) is unchanged. A row without a `drag` accessory cannot start a
692
+ reorder in `handle` mode.
693
+ - **Accessory:** a `drag` without an action swallows a short tap on iOS and
694
+ passes it to the row on Android and Web. In Web handle mode a `drag` with
695
+ an `actionKey` can start a reorder and still emits its action on a short
696
+ tap. A recognized reorder suppresses the click generated by that press,
697
+ including release after cancellation. Overlapping pointer sequences retain
698
+ their own suppression until a matching click or new press with that pointer
699
+ ID, native cancellation, or 500 ms after release. A click without a pointer ID
700
+ matches the most recent release at the same action or row and client position
701
+ (within one CSS pixel), using the input type when the browser supplies it.
702
+ For a press and release on different elements, the match uses their nearest
703
+ shared ancestor as the click target. Releases outside the list cannot replace
704
+ that match. A new short tap or
705
+ keyboard activation can still emit the action. Icons beside the handle keep
706
+ their own actions.
707
+ Callers can use `pressDisabled` to disable row opening.
708
+ - **Web cursor:** in `handle` mode the row keeps the default cursor and the
709
+ handle shows `grab`.
710
+ - **Handle appearance:** every platform tints the `DragOutline` glyph
711
+ `iconSubdued`, matching `ListItem.IconButton`; Web centers it in a 24-point
712
+ box so it lines up with neighbouring icon buttons instead of the text line.
713
+ iOS and Android draw the handle as a medium tertiary button (38-point frame,
714
+ glyph inset 7), like the source `IconButton`, so a `PencilOutline` + `drag`
715
+ pair keeps 24 points between glyph slots (Android gives the second frame a
716
+ 17dp start margin after its m=-7); Web applies the same 24-point gap.
717
+ - **Tertiary text gap:** when the first trailing accessory is a tertiary icon,
718
+ the text column ends 12 points before its glyph slot, as `ListItem` lays it
719
+ out. iOS absorbs the button's m=-7 on the text side (it clipped 9 points
720
+ early), Android adds the 12dp end margin the -7 had eaten (text ran into the
721
+ button), and Web already does this through CSS margins.
722
+ - **Leading action geometry:** an identity `leadingAction` reproduces
723
+ `ListItem.IconButton` (medium tertiary: 6-point padding plus a 1-point
724
+ border, m=-7) on all three platforms, so its glyph sits on a 24-point slot at
725
+ the 12-point row padding and the leading visual starts at 48. iOS and Android
726
+ use a 36-point frame with a 6-point inset and 6-point following gap; Web
727
+ applies the tertiary icon frame and reports the inner glyph slot's window
728
+ rect, including any ancestor transform. Web icon buttons use an explicit
729
+ accessibility label where supplied and otherwise retain their fallback
730
+ glyph as a name even when host SVG artwork is present.
731
+
732
+ - **Enclosing pans (iOS):** once a reorder has started, the list disables the
733
+ enabled `UIPanGestureRecognizer`s of its ancestors (for example a sheet's
734
+ dismiss pan or a pager) and restores them when the reorder finishes, is
735
+ cancelled by a structural update, or the list is torn down. Before the long
736
+ press is recognized those pans behave as before, so a quick pull still drags
737
+ the sheet. This applies to both activation modes. The NativeOverlay page
738
+ sheet combines temporary suppression with the current `dismissOnPanDown`
739
+ setting, including prop changes during the drag.
740
+
741
+ Toggling `reorderActivation` or `reorderable` cancels pending and active
742
+ pointer reorder without emitting a reorder event. An accepted full Web
743
+ snapshot supersedes a provisional reorder; accepted row patches retain their
744
+ content even if a gesture is cancelled. Web keyboard sorting remains available
745
+ from the focused row if it has a rendered handle in `handle` mode. The
746
+ capability travels in snapshot JSON; the Nitro ABI is unchanged.
747
+
748
+ Leading visual `borderWidth` supports values in (0, 4]. Development rejects
749
+ out-of-range widths; production discards the invalid width in full snapshots
750
+ and patches so the border uses its existing default of 1. Production also
751
+ discards invalid tracking and digit-spacing overrides so template defaults apply.
752
+
628
753
  ### Android reorder cancellation
629
754
 
630
755
  Status: implemented; three real Android View/callback regressions verified on
@@ -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
 
@@ -397,13 +397,13 @@ private final class NativeListTableColumnView: UIStackView {
397
397
  let primaryStyle = style.dictionary("columns") ?? [:]
398
398
  let secondaryStyle = style.dictionary("columnSecondary") ?? [:]
399
399
  func font(_ textStyle: [String: Any], size: CGFloat, weight: NativeListFontWeight) -> UIFont {
400
- guard textStyle["fontSize"] != nil || textStyle["fontWeight"] != nil else {
401
- return nativeListFont(ofSize: size, weight: weight, fonts: fonts)
402
- }
403
- return nativeListFont(
400
+ let baseFont = nativeListFont(
404
401
  ofSize: CGFloat(textStyle.double("fontSize", default: Double(size))),
405
402
  weight: NativeListTextStyles.marketFontWeight(
406
403
  textStyle.string("fontWeight"), fallback: weight), fonts: fonts)
404
+ return (textStyle["tabularNumbers"] as? Bool).map {
405
+ NativeListTextStyles.digitSpacingFont(baseFont, tabular: $0)
406
+ } ?? baseFont
407
407
  }
408
408
  func color(_ textStyle: [String: Any], _ fallback: UIColor) -> UIColor {
409
409
  (textStyle["color"] as? String).map { UIColor(nativeListHex: $0, fallback: fallback) }
@@ -443,6 +443,10 @@ private final class NativeListTableColumnView: UIStackView {
443
443
  .font: primaryFont,
444
444
  .foregroundColor: color(primaryStyle, textColor(column.string("tone"), theme: theme)),
445
445
  ])
446
+ if primaryStyle["letterSpacing"] != nil {
447
+ attributed.addAttribute(.kern, value: CGFloat(primaryStyle.double("letterSpacing")),
448
+ range: NSRange(location: 0, length: attributed.length))
449
+ }
446
450
  attributed.setAttributedString(nativeListDataSegments(attributed, column.dictionaries("textSegments")))
447
451
  let primaryLength = attributed.length
448
452
  // Every badge run is the legacy " text " pill: both lead spaces sit inside the badge
@@ -451,7 +455,7 @@ private final class NativeListTableColumnView: UIStackView {
451
455
  // rows add no kern and stay byte-identical to legacy.
452
456
  if style["titleBadgeGap"] != nil, !badges.isEmpty, primaryLength > 0 {
453
457
  attributed.addAttribute(
454
- .kern, value: CGFloat(style.double("titleBadgeGap")),
458
+ .kern, value: CGFloat(style.double("titleBadgeGap") + primaryStyle.double("letterSpacing")),
455
459
  range: (attributed.string as NSString).rangeOfComposedCharacterSequence(
456
460
  at: primaryLength - 1))
457
461
  }
@@ -482,6 +486,9 @@ private final class NativeListTableColumnView: UIStackView {
482
486
  secondaryStyle,
483
487
  textColor(column.string("secondaryTone", default: "secondary"), theme: theme)),
484
488
  ]
489
+ if secondaryStyle["letterSpacing"] != nil {
490
+ attributes[.kern] = CGFloat(secondaryStyle.double("letterSpacing"))
491
+ }
485
492
  attributes.merge(paragraph(secondaryStyle, font: secondaryFont, spacing: nil)) { $1 }
486
493
  attributed.append(NSAttributedString(string: "\n", attributes: attributes))
487
494
  attributed.append(nativeListDataSegments(