@onekeyfe/react-native-native-list 6.7.0-20 → 6.7.0-22

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 (151) hide show
  1. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +5 -0
  2. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +29 -4
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -10
  4. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  5. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +15 -0
  6. package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
  7. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +33 -2
  8. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  10. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +13 -10
  11. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -338
  12. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +5 -0
  13. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +33 -8
  14. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +11 -5
  15. package/docs/ROW_TEMPLATES.md +10 -2
  16. package/docs/SPEC.md +432 -50
  17. package/ios/NativeListAccessoryStack.swift +6 -16
  18. package/ios/NativeListActivityDetailsView.swift +13 -4
  19. package/ios/NativeListDataRowRenderer.swift +15 -6
  20. package/ios/NativeListDesignAssets.swift +13 -84
  21. package/ios/NativeListGeneratedIcons.swift +55 -0
  22. package/ios/NativeListIconBinding.swift +171 -0
  23. package/ios/NativeListIdentityRenderer.swift +69 -13
  24. package/ios/NativeListLeadingVisual.swift +11 -9
  25. package/ios/NativeListMarketRenderer.swift +120 -31
  26. package/ios/NativeListMediaTileRenderer.swift +6 -2
  27. package/ios/NativeListMetricCardRenderer.swift +4 -2
  28. package/ios/NativeListSectionHeaderRenderer.swift +12 -4
  29. package/ios/RNCNativeListView.swift +21 -3
  30. package/ios/tests/NativeListAccessoryStackTests.swift +12 -0
  31. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  32. package/ios/tests/NativeListActivityPresentationTests.swift +97 -0
  33. package/ios/tests/NativeListLifecycleTests.swift +73 -4
  34. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  35. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  36. package/lib/module/NativeList.js +25 -6
  37. package/lib/module/NativeList.web.js +9 -12
  38. package/lib/module/models.js +2 -0
  39. package/lib/module/validation.js +695 -114
  40. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  41. package/lib/module/web/NativeListWebEngine.js +24 -332
  42. package/lib/module/web/templates/ActivityRowRenderer.js +4 -24
  43. package/lib/module/web/templates/IdentityRowRenderer.js +66 -4
  44. package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
  45. package/lib/module/web/templates/MediaTileRowRenderer.js +2 -12
  46. package/lib/typescript/src/NativeList.types.d.ts +2 -2
  47. package/lib/typescript/src/models.d.ts +27 -14
  48. package/lib/typescript/src/validation.d.ts +7 -2
  49. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  50. package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -1
  51. package/package.json +16 -10
  52. package/react-native-native-list.podspec +0 -5
  53. package/scripts/generate-icons.mjs +150 -0
  54. package/scripts/generate-icons.test.mjs +288 -0
  55. package/scripts/native-list-icons.json +260 -0
  56. package/src/NativeList.tsx +30 -10
  57. package/src/NativeList.types.ts +2 -2
  58. package/src/NativeList.web.tsx +10 -14
  59. package/src/models.ts +158 -153
  60. package/src/validation.ts +1757 -167
  61. package/src/web/NativeListGeneratedIcons.ts +28 -0
  62. package/src/web/NativeListWebEngine.ts +31 -415
  63. package/src/web/templates/ActivityRowRenderer.ts +15 -53
  64. package/src/web/templates/IdentityRowRenderer.ts +78 -4
  65. package/src/web/templates/MarketTableRowRenderer.ts +53 -33
  66. package/src/web/templates/MediaTileRowRenderer.ts +2 -15
  67. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  68. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  69. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  70. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  71. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  72. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  73. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  74. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  75. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  76. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  77. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  78. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  79. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  80. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  81. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  82. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  83. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  84. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  85. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  86. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  87. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  88. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
  89. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
  90. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +0 -1
  91. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +0 -1
  92. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  93. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  94. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +0 -1
  95. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +0 -1
  96. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  97. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  98. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  99. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  100. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
  101. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
  102. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  103. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  104. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  105. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  106. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  107. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  108. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  109. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  110. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  111. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  112. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  113. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  114. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +0 -1
  115. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +0 -1
  116. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  117. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  118. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  119. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  120. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
  121. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
  122. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  123. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  124. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  125. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  126. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  127. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  128. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  129. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  130. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  131. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  132. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  133. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  134. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  135. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  136. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  137. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  138. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  139. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  140. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  141. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  142. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  143. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  144. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  145. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  146. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  147. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
  148. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +0 -1
@@ -91,7 +91,10 @@ final class NativeListIdentityCell: NativeListRendererCell {
91
91
  let tertiary = NativeListResolvedText(
92
92
  item.data.string("tertiary"), style: style.dictionary("tertiary"), size: 14,
93
93
  color: .black, lineHeight: 20, lines: 1, fonts: fonts)
94
- let textHeight = title.measure(width: textWidth)
94
+ let titleImageSize = CGFloat(item.data.dictionary("titleImage")?.dictionary("image")?.double("width") ?? 0)
95
+ let titleImageWidth = titleImageSize > 0
96
+ ? titleImageSize + 4 + (item.data.dictionary("titleIcon") == nil ? 0 : 24) : 0
97
+ let textHeight = max(titleImageSize, title.measure(width: max(1, textWidth - titleImageWidth)))
95
98
  + subtitle.measure(width: textWidth)
96
99
  + tertiary.measure(width: textWidth)
97
100
  + (item.data.string("subtitle").isEmpty ? 0 : CGFloat(style.double("lineGap", default: 0)))
@@ -106,7 +109,9 @@ final class NativeListIdentityCell: NativeListRendererCell {
106
109
  private let mainStack = UIStackView()
107
110
  private let titleRowStack = UIStackView()
108
111
  private let titleLabel = NativeListTextLabel()
109
- private let titleIconView = UIImageView()
112
+ private let titleIconView = NativeListIconImageView()
113
+ private var titleImageSlot: NativeListImageSlot?
114
+ private var titleImageConstraints: [NSLayoutConstraint] = []
110
115
  // Absorbs the title row's slack so the title keeps its intrinsic width and the
111
116
  // title icon / badge follow the text (OK-66041); Android's PackedTitleLineLayout
112
117
  // and the Web flex row already pack the title row at its start.
@@ -115,7 +120,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
115
120
  private let tertiaryLabel = NativeListTextLabel()
116
121
  private let badgeLabel = NativeListInsetLabel()
117
122
  private let trailingStack = NativeListAccessoryStack(frame: .zero)
118
- private let leadingActionButton = UIButton(type: .system)
123
+ private let leadingActionButton = NativeListIconButton(type: .system)
119
124
  private var leadingWidth: NSLayoutConstraint!
120
125
  private var leadingHeight: NSLayoutConstraint!
121
126
  private var leftInset: CGFloat = 12
@@ -131,7 +136,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
131
136
  private var currentItem: NativeListItem?
132
137
  private var currentTheme: [String: Any]?
133
138
  private var leadingActionKey: String?
134
- override var assetFields: [String] { ["leading"] }
139
+ override var assetFields: [String] { ["leading", "titleImage"] }
135
140
  override var defaultSeparatorInset: CGFloat { 60 }
136
141
  override var defaultCornerRadius: CGFloat {
137
142
  guard let item = currentItem else { return 0 }
@@ -203,6 +208,9 @@ final class NativeListIdentityCell: NativeListRendererCell {
203
208
  _ item: NativeListItem, theme: [String: Any]?, layout: String,
204
209
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
205
210
  ) {
211
+ let iconUpdate = NativeListIconUpdate(self)
212
+ defer { iconUpdate.finish() }
213
+
206
214
  selectorTypographyRestorers.reversed().forEach { $0() }
207
215
  selectorTypographyRestorers = []
208
216
  currentItem = item
@@ -241,6 +249,11 @@ final class NativeListIdentityCell: NativeListRendererCell {
241
249
  titleIconView.isHidden = true
242
250
  titleIconView.accessibilityLabel = nil
243
251
  titleIconView.isAccessibilityElement = false
252
+ titleImageSlot?.view.isHidden = true
253
+ titleImageSlot?.view.accessibilityLabel = nil
254
+ titleImageSlot?.view.isAccessibilityElement = false
255
+ NSLayoutConstraint.deactivate(titleImageConstraints)
256
+ titleImageConstraints = []
244
257
  titleRowStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
245
258
  titleRowStack.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
246
259
  for label in [titleLabel, subtitleLabel, tertiaryLabel, badgeLabel] {
@@ -288,7 +301,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
288
301
  bindIdentity(item, theme: theme, selected: item.data.bool("selected"), checkboxState)
289
302
  let style = item.data.dictionary("style") ?? [:]
290
303
  if let titleIcon = item.data.dictionary("titleIcon") {
291
- titleIconView.image = nativeListIcon(named: titleIcon.string("name"))
304
+ titleIconView.bindIcon(titleIcon.string("name"))
292
305
  titleIconView.tintColor = UIColor(
293
306
  nativeListHex: titleIcon.string("tintColor",
294
307
  default: theme?["iconSubdued"] as? String ?? "#8D8D8D"),
@@ -303,6 +316,38 @@ final class NativeListIdentityCell: NativeListRendererCell {
303
316
  // title at `.required` the icon's 999 width constraint collapsed to 0.
304
317
  titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
305
318
  }
319
+ if let descriptor = item.data.dictionary("titleImage"),
320
+ let image = descriptor.dictionary("image"), !image.string("uri").isEmpty
321
+ {
322
+ let size = CGFloat(image.double("width"))
323
+ let slot = titleImageSlot ?? NativeListImageSlot()
324
+ titleImageSlot = slot
325
+ let view = slot.view
326
+ if view.superview == nil {
327
+ let index = titleRowStack.arrangedSubviews.firstIndex(of: titleIconView)! + 1
328
+ titleRowStack.insertArrangedSubview(view, at: index)
329
+ }
330
+ view.clipsToBounds = true
331
+ view.setContentHuggingPriority(.required, for: .horizontal)
332
+ view.setContentCompressionResistancePriority(.required, for: .horizontal)
333
+ view.translatesAutoresizingMaskIntoConstraints = false
334
+ view.layer.cornerRadius = size / 2
335
+ view.isHidden = false
336
+ let label = descriptor.string("accessibilityLabel")
337
+ view.accessibilityLabel = label.isEmpty ? nil : label
338
+ view.isAccessibilityElement = !label.isEmpty
339
+ titleImageConstraints = [
340
+ view.widthAnchor.constraint(equalToConstant: size),
341
+ view.heightAnchor.constraint(equalToConstant: size),
342
+ ]
343
+ titleImageConstraints.forEach { $0.priority = UILayoutPriority(999) }
344
+ NSLayoutConstraint.activate(titleImageConstraints)
345
+ titleRowStack.setCustomSpacing(4, after: titleIconView.isHidden ? titleLabel : titleIconView)
346
+ titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
347
+ slot.bind(image, key: "\(item.key):titleImage", placeholder: "#00000000")
348
+ } else {
349
+ titleImageSlot?.recycle()
350
+ }
306
351
  if let ratio = style["leadingContentMaxWidthRatio"] as? NSNumber,
307
352
  root.arrangedSubviews.contains(visual)
308
353
  {
@@ -339,7 +384,8 @@ final class NativeListIdentityCell: NativeListRendererCell {
339
384
  } else {
340
385
  titleRowStack.setCustomSpacing(
341
386
  CGFloat(style.double("titleBadgeGap")),
342
- after: titleIconView.isHidden ? titleLabel : titleIconView)
387
+ after: titleImageSlot?.view.isHidden == false ? titleImageSlot!.view
388
+ : titleIconView.isHidden ? titleLabel : titleIconView)
343
389
  }
344
390
  }
345
391
  if style["trailingGap"] != nil { trailingStack.spacing = CGFloat(style.double("trailingGap")) }
@@ -364,6 +410,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
364
410
  }
365
411
  settleTitleRowFillerSpacing()
366
412
  applySelectorTypography(item)
413
+
367
414
  }
368
415
 
369
416
  /// The filler is the title row's last arranged view; the stack's default
@@ -379,6 +426,9 @@ final class NativeListIdentityCell: NativeListRendererCell {
379
426
  _ item: NativeListItem,
380
427
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
381
428
  ) {
429
+ let iconUpdate = NativeListIconUpdate(self)
430
+ defer { iconUpdate.finish() }
431
+
382
432
  currentItem = item
383
433
  trailingStack.updateSelection(item, checkboxState: checkboxState)
384
434
  if item.data.string("presentation") == "walletSidebar" {
@@ -396,6 +446,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
396
446
  NativeListTextStyles.applyStyledText(titleLabel, style, fonts: fonts)
397
447
  }
398
448
  }
449
+
399
450
  }
400
451
  override func layoutSubviews() {
401
452
  super.layoutSubviews()
@@ -413,6 +464,10 @@ final class NativeListIdentityCell: NativeListRendererCell {
413
464
  }
414
465
  override func recycleContent() {
415
466
  visual.recycle()
467
+ titleImageSlot?.recycle()
468
+ titleImageSlot?.view.isHidden = true
469
+ titleImageSlot?.view.accessibilityLabel = nil
470
+ titleImageSlot?.view.isAccessibilityElement = false
416
471
  trailingStack.reset()
417
472
  currentItem = nil
418
473
  }
@@ -563,13 +618,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
563
618
  fallback: .darkGray
564
619
  )
565
620
  leadingActionButton.tintColor = tintColor
566
- if let image = nativeListIcon(named: leadingAction.string("name")) {
567
- leadingActionButton.setImage(image, for: .normal)
568
- leadingActionButton.setImage(
569
- image.withTintColor(tintColor, renderingMode: .alwaysOriginal),
570
- for: .disabled
571
- )
572
- }
621
+ leadingActionButton.bindIcon(leadingAction.string("name"))
573
622
  leadingActionButton.isEnabled = !leadingAction.bool("disabled")
574
623
  leadingActionButton.alpha = leadingActionButton.isEnabled ? 1 : 0.4
575
624
  leadingActionKey = leadingAction.string("actionKey")
@@ -760,6 +809,13 @@ final class NativeListIdentityCell: NativeListRendererCell {
760
809
  let width = trailingStack.widthAnchor.constraint(equalTo: accessory.widthAnchor)
761
810
  width.isActive = true
762
811
  selectorConstraints.append(width)
812
+ } else if item.data.string("presentation") == "accountSelector" {
813
+ // Keep flexible space in the text column when there is no accessory button.
814
+ // Stay below visible controls' compression resistance and the hidden checkbox's width.
815
+ let width = trailingStack.widthAnchor.constraint(equalToConstant: 0)
816
+ width.priority = UILayoutPriority(749)
817
+ width.isActive = true
818
+ selectorConstraints.append(width)
763
819
  }
764
820
  }
765
821
  private func dataTextColor(_ tone: String, theme: [String: Any]?) -> UIColor {
@@ -14,16 +14,16 @@ final class NativeListLeadingVisual: UIView {
14
14
  var overlayTextFontSize: CGFloat = 10
15
15
  var overlayTextLineHeight: CGFloat?
16
16
  var overlayTextHorizontalInset: CGFloat?
17
- private let icon = UIImageView()
17
+ private let icon = NativeListIconImageView()
18
18
  private let unread = UIView()
19
19
  private let networkBackdrop = UIView()
20
20
  // Ring under the secondary token of an Activity pair (SPEC "Activity leading pair").
21
21
  private let pairBackdrop = UIView()
22
- private let corner = UIImageView()
22
+ private let corner = NativeListIconImageView()
23
23
  private let cornerBackdrop = UIView()
24
24
  private var slots: [NativeListImageSlot] = []
25
25
  private var overlaySlots: [NativeListImageSlot] = []
26
- private var overlayFallbackIcons: [UIImageView] = []
26
+ private var overlayFallbackIcons: [NativeListIconImageView] = []
27
27
  private var overlays: [(UIView, [String: Any])] = []
28
28
  private let dashedBorder = CAShapeLayer()
29
29
  private var visual: [String: Any] = [:]
@@ -54,6 +54,8 @@ final class NativeListLeadingVisual: UIView {
54
54
  isUnread: Bool, secondaryVisual: [String: Any]? = nil,
55
55
  fonts: NativeListFontFamilies
56
56
  ) {
57
+ let iconUpdate = NativeListIconUpdate(self)
58
+ defer { iconUpdate.finish() }
57
59
  self.fonts = fonts
58
60
  fallback.font = nativeListFont(ofSize: 13, weight: .bold, fonts: fonts)
59
61
  self.visual = visual
@@ -111,7 +113,7 @@ final class NativeListLeadingVisual: UIView {
111
113
  fallback.text = String(visual.string("fallbackText").prefix(2))
112
114
  fallback.textColor = UIColor(
113
115
  nativeListHex: visual.string("fallbackTextColor", default: "#8D8D8D"), fallback: .gray)
114
- icon.image = fallbackData.map { nativeListIcon(named: $0.string("name")) } ?? nil
116
+ icon.bindIcon(fallbackData?.string("name"))
115
117
  icon.tintColor = UIColor(
116
118
  nativeListHex: fallbackData?.string("tintColor", default: "#646464") ?? "#646464",
117
119
  fallback: .darkGray)
@@ -175,7 +177,7 @@ final class NativeListLeadingVisual: UIView {
175
177
  let badge = visual.dictionary("cornerIcon")
176
178
  corner.isHidden = badge == nil
177
179
  cornerBackdrop.isHidden = badge == nil
178
- corner.image = badge.flatMap { nativeListIcon(named: $0.string("name")) }
180
+ corner.bindIcon(badge?.string("name"))
179
181
  corner.tintColor = UIColor(
180
182
  nativeListHex: badge?.string("tintColor", default: "#646464") ?? "#646464",
181
183
  fallback: .darkGray)
@@ -187,12 +189,12 @@ final class NativeListLeadingVisual: UIView {
187
189
  overlays.removeAll(keepingCapacity: true)
188
190
  let descriptors = Array(visual.dictionaries("overlays").prefix(2))
189
191
  while overlaySlots.count < descriptors.count { overlaySlots.append(NativeListImageSlot()) }
190
- while overlayFallbackIcons.count < descriptors.count { overlayFallbackIcons.append(UIImageView()) }
192
+ while overlayFallbackIcons.count < descriptors.count { overlayFallbackIcons.append(NativeListIconImageView()) }
191
193
  for (index, data) in descriptors.enumerated() {
192
194
  let frame = index < previousOverlays.count ? previousOverlays[index].0 : UIView()
193
195
  let fallbackData = data.dictionary("fallbackIcon")
194
196
  let fallbackGlyph = overlayFallbackIcons[index]
195
- fallbackGlyph.image = fallbackData.flatMap { nativeListIcon(named: $0.string("name")) }
197
+ fallbackGlyph.bindIcon(fallbackData?.string("name"))
196
198
  fallbackGlyph.tintColor = UIColor(
197
199
  nativeListHex: fallbackData?.string("tintColor", default: "#646464") ?? "#646464",
198
200
  fallback: .darkGray)
@@ -243,8 +245,8 @@ final class NativeListLeadingVisual: UIView {
243
245
  child = label
244
246
  } else {
245
247
  overlaySlots[index].recycle()
246
- let glyph = frame.subviews.first as? UIImageView ?? UIImageView()
247
- glyph.image = nativeListIcon(named: data.string("name"))
248
+ let glyph = frame.subviews.first as? NativeListIconImageView ?? NativeListIconImageView()
249
+ glyph.bindIcon(data.string("name"))
248
250
  glyph.contentMode = .scaleAspectFit
249
251
  glyph.tintColor = UIColor(
250
252
  nativeListHex: data.string("tintColor", default: "#646464"), fallback: .darkGray)
@@ -22,11 +22,20 @@ final class NativeListMarketCell: NativeListRendererCell {
22
22
  private let marketSubtitleStack = UIStackView()
23
23
  private let marketSubtitleSpacer = UIView()
24
24
  private let trailingStack = UIStackView()
25
+ private let metricStacks = (0..<3).map { _ -> UIStackView in
26
+ let stack = UIStackView()
27
+ stack.axis = .vertical
28
+ stack.alignment = .fill
29
+ stack.spacing = 2
30
+ return stack
31
+ }
32
+ private let metricPrimaryLabels = (0..<3).map { _ in NativeListTextLabel() }
33
+ private let metricSecondaryLabels = (0..<3).map { _ in NativeListTextLabel() }
25
34
  private let accessoryButtons = (0..<2).map { _ in NativeListAccessoryButton(type: .system) }
26
35
  private let marketBadgeButtons = (0..<3).map { _ in NativeListAccessoryButton(type: .system) }
27
36
  private let badgeSlots = (0..<3).map { _ in NativeListImageSlot() }
28
37
  private var marketBadgeImages: [UIView] { badgeSlots.map { $0.view } }
29
- private let leadingActionButton = UIButton(type: .system)
38
+ private let leadingActionButton = NativeListIconButton(type: .system)
30
39
  private var leadingWidth: NSLayoutConstraint!
31
40
  private var leadingHeight: NSLayoutConstraint!
32
41
  private var selectorConstraints: [NSLayoutConstraint] = []
@@ -69,6 +78,10 @@ final class NativeListMarketCell: NativeListRendererCell {
69
78
  trailingStack.setContentHuggingPriority(.required, for: .horizontal)
70
79
  trailingStack.setContentCompressionResistancePriority(.required, for: .horizontal)
71
80
  accessoryButtons.forEach(trailingStack.addArrangedSubview)
81
+ for index in metricStacks.indices {
82
+ metricStacks[index].addArrangedSubview(metricPrimaryLabels[index])
83
+ metricStacks[index].addArrangedSubview(metricSecondaryLabels[index])
84
+ }
72
85
  visual.translatesAutoresizingMaskIntoConstraints = false
73
86
  leadingWidth = visual.widthAnchor.constraint(equalToConstant: 32)
74
87
  leadingHeight = visual.heightAnchor.constraint(equalToConstant: 32)
@@ -86,6 +99,9 @@ final class NativeListMarketCell: NativeListRendererCell {
86
99
  _ item: NativeListItem, theme: [String: Any]?, layout: String,
87
100
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
88
101
  ) {
102
+ let iconUpdate = NativeListIconUpdate(self)
103
+ defer { iconUpdate.finish() }
104
+
89
105
  NSLayoutConstraint.deactivate(selectorConstraints + accessorySizeConstraints)
90
106
  selectorConstraints = []
91
107
  accessorySizeConstraints = []
@@ -130,6 +146,14 @@ final class NativeListMarketCell: NativeListRendererCell {
130
146
  }
131
147
  }
132
148
  accessoryButtons.forEach(resetButton)
149
+ for label in metricPrimaryLabels + metricSecondaryLabels {
150
+ label.attributedText = nil
151
+ label.text = nil
152
+ label.isHidden = true
153
+ label.numberOfLines = 1
154
+ label.lineBreakMode = .byTruncatingTail
155
+ label.textAlignment = .natural
156
+ }
133
157
  bindMarket(item, theme: theme)
134
158
  let style = item.data.dictionary("style")
135
159
  for (label, descriptor) in [
@@ -145,6 +169,7 @@ final class NativeListMarketCell: NativeListRendererCell {
145
169
  ? .top
146
170
  : style?.dictionary("container")?.string("contentVerticalAlignment") == "bottom"
147
171
  ? .bottom : .center
172
+
148
173
  }
149
174
  private func resetButton(_ button: NativeListAccessoryButton) {
150
175
  button.setTitle(nil, for: .normal)
@@ -166,20 +191,38 @@ final class NativeListMarketCell: NativeListRendererCell {
166
191
  style.filter { ["lines", "truncate", "verticalAlignment", "offsetY"].contains($0.key) }
167
192
  }
168
193
  override func accessibilityText(_ item: NativeListItem) -> String {
169
- item.data.string(
170
- "accessibilityLabel",
171
- default: [
172
- item.data.string("title"), item.data.string("subtitle"), item.data.string("price"),
173
- item.data.dictionary("change")?.string("text") ?? "",
174
- ].filter { !$0.isEmpty }.joined(separator: ", "))
194
+ if let label = item.data["accessibilityLabel"] as? String { return label }
195
+ var parts = [item.data.string("title"), item.data.string("subtitle")]
196
+ let metrics = item.data.dictionaries("metrics")
197
+ if metrics.count == 2 || metrics.count == 3 {
198
+ for index in metrics.indices {
199
+ for label in [metricPrimaryLabels[index], metricSecondaryLabels[index]] where !label.isHidden {
200
+ if let text = label.text { parts.append(text) }
201
+ }
202
+ }
203
+ } else {
204
+ parts.append(item.data.string("price"))
205
+ parts.append(item.data.dictionary("change")?.string("text") ?? "")
206
+ }
207
+ return parts.filter { !$0.isEmpty }.joined(separator: ", ")
175
208
  }
176
209
  override func updateMarketQuote(_ item: NativeListItem, theme: [String: Any]?) {
177
210
  guard retainBoundItem(item) else { return }
178
- bindQuote(item, theme: theme)
211
+ let metrics = item.data.dictionaries("metrics")
212
+ if metrics.count == 2 || metrics.count == 3 {
213
+ updateMetricLabels(metrics, theme: theme)
214
+ } else {
215
+ bindQuote(item, theme: theme)
216
+ }
217
+ accessibilityLabel = accessibilityText(item)
179
218
  }
180
219
  override func recycleContent() {
181
220
  visual.recycle()
182
221
  badgeSlots.forEach { $0.recycle() }
222
+ for label in metricPrimaryLabels + metricSecondaryLabels {
223
+ label.attributedText = nil
224
+ label.text = nil
225
+ }
183
226
  imageSignature = ""
184
227
  }
185
228
  @objc private func leadingPressed() {
@@ -256,6 +299,61 @@ final class NativeListMarketCell: NativeListRendererCell {
256
299
  default: return .natural
257
300
  }
258
301
  }
302
+ private func metricColor(_ tone: String, theme: [String: Any]?) -> UIColor {
303
+ switch tone {
304
+ case "positive": return nativeListColor(theme, "positive", "#218358")
305
+ case "negative": return nativeListColor(theme, "negative", "#CE2C31")
306
+ case "secondary": return nativeListColor(theme, "secondaryText", "#646464")
307
+ default: return nativeListColor(theme, "primaryText", "#202020")
308
+ }
309
+ }
310
+ private func bindMetrics(
311
+ _ columns: [[String: Any]], theme: [String: Any]?, gap: CGFloat
312
+ ) {
313
+ for (index, column) in columns.enumerated() {
314
+ let stack = metricStacks[index]
315
+ root.addArrangedSubview(stack)
316
+ root.setCustomSpacing(gap, after: stack)
317
+ let weight = max(1, min(3, column.int("weight", default: 1)))
318
+ let width = stack.widthAnchor.constraint(
319
+ equalTo: mainStack.widthAnchor, multiplier: CGFloat(weight) / 2)
320
+ width.isActive = true
321
+ selectorConstraints.append(width)
322
+ }
323
+ updateMetricLabels(columns, theme: theme)
324
+ }
325
+ private func updateMetricLabels(_ columns: [[String: Any]], theme: [String: Any]?) {
326
+ for (index, column) in columns.enumerated() {
327
+ let alignment = marketTextAlignment(column.string("alignment", default: "end"))
328
+ let primary = metricPrimaryLabels[index]
329
+ let primaryText = column.string("text")
330
+ show(primary, primaryText, lines: 1)
331
+ let primaryColor = metricColor(column.string("tone"), theme: theme)
332
+ applyMarketTextStyle(
333
+ primary, data: nil, theme: theme, defaultSize: 14, defaultLineHeight: 20,
334
+ defaultWeight: .medium, defaultColor: primaryColor, defaultAlignment: alignment)
335
+ if !column.dictionaries("textSegments").isEmpty {
336
+ primary.attributedText = marketAttributedText(
337
+ primaryText, segments: column.dictionaries("textSegments"), style: nil,
338
+ defaultSize: 14, defaultLineHeight: 20, defaultWeight: .medium,
339
+ color: primaryColor, defaultAlignment: alignment)
340
+ }
341
+ let secondary = metricSecondaryLabels[index]
342
+ let secondaryText = column.string("secondaryText")
343
+ show(secondary, secondaryText, lines: 1)
344
+ let secondaryColor = metricColor(
345
+ column.string("secondaryTone", default: "secondary"), theme: theme)
346
+ applyMarketTextStyle(
347
+ secondary, data: nil, theme: theme, defaultSize: 12, defaultLineHeight: 16,
348
+ defaultWeight: .regular, defaultColor: secondaryColor, defaultAlignment: alignment)
349
+ if !column.dictionaries("secondaryTextSegments").isEmpty {
350
+ secondary.attributedText = marketAttributedText(
351
+ secondaryText, segments: column.dictionaries("secondaryTextSegments"), style: nil,
352
+ defaultSize: 12, defaultLineHeight: 16, defaultWeight: .regular,
353
+ color: secondaryColor, defaultAlignment: alignment)
354
+ }
355
+ }
356
+ }
259
357
  private func applyMarketTextStyle(
260
358
  _ label: UILabel,
261
359
  data: [String: Any]?,
@@ -404,13 +502,7 @@ final class NativeListMarketCell: NativeListRendererCell {
404
502
  fallback: .darkGray
405
503
  )
406
504
  leadingActionButton.tintColor = tintColor
407
- if let image = nativeListIcon(named: leadingAction.string("name")) {
408
- leadingActionButton.setImage(image, for: .normal)
409
- leadingActionButton.setImage(
410
- image.withTintColor(tintColor, renderingMode: .alwaysOriginal),
411
- for: .disabled
412
- )
413
- }
505
+ leadingActionButton.bindIcon(leadingAction.string("name"))
414
506
  leadingActionButton.isEnabled = !leadingAction.bool("disabled")
415
507
  leadingActionButton.alpha = leadingActionButton.isEnabled ? 1 : 0.4
416
508
  leadingActionButton.accessibilityIdentifier = leadingAction["testID"] as? String
@@ -533,11 +625,7 @@ final class NativeListMarketCell: NativeListRendererCell {
533
625
  button.titleEdgeInsets = .zero
534
626
  button.imageView?.contentMode = .scaleAspectFit
535
627
  if hasBuiltInIcon {
536
- button.setImage(
537
- nativeListIcon(
538
- named: "BadgeVerifiedSolid", size: CGSize(width: iconSize, height: iconSize)),
539
- for: .normal
540
- )
628
+ button.bindIcon("BadgeVerifiedSolid", size: CGSize(width: iconSize, height: iconSize))
541
629
  }
542
630
  // OneKey patch: match source badge metrics at physical-pixel precision.
543
631
  // let height = button.heightAnchor.constraint(equalToConstant: 18)
@@ -623,11 +711,18 @@ final class NativeListMarketCell: NativeListRendererCell {
623
711
  }
624
712
  marketSubtitleStack.isHidden = tertiaryLabel.isHidden && subtitleLabel.isHidden
625
713
  }
626
- root.addArrangedSubview(trailingStack)
627
- trailingStack.axis = .horizontal
628
- trailingStack.alignment = .center
629
- trailingStack.spacing = CGFloat(style?.double("trailingGap", default: 8) ?? 8)
630
- bindQuote(item, theme: theme)
714
+ let metrics = item.data.dictionaries("metrics")
715
+ if metrics.count == 2 || metrics.count == 3 {
716
+ let metricGap = CGFloat(style?.double("trailingGap", default: 8) ?? 8)
717
+ root.setCustomSpacing(metricGap, after: mainStack)
718
+ bindMetrics(metrics, theme: theme, gap: metricGap)
719
+ } else {
720
+ root.addArrangedSubview(trailingStack)
721
+ trailingStack.axis = .horizontal
722
+ trailingStack.alignment = .center
723
+ trailingStack.spacing = CGFloat(style?.double("trailingGap", default: 8) ?? 8)
724
+ bindQuote(item, theme: theme)
725
+ }
631
726
  }
632
727
  private func bindQuote(_ item: NativeListItem, theme: [String: Any]?) {
633
728
  NSLayoutConstraint.deactivate(accessorySizeConstraints)
@@ -696,11 +791,5 @@ final class NativeListMarketCell: NativeListRendererCell {
696
791
  if let changeStyle = style?.dictionary("change"), !textLayoutStyle(changeStyle).isEmpty {
697
792
  NativeListTextStyles.applyStyledButton(change, textLayoutStyle(changeStyle), fonts: fonts)
698
793
  }
699
- accessibilityLabel = item.data.string(
700
- "accessibilityLabel",
701
- default: [
702
- item.data.string("title"), item.data.string("subtitle"), item.data.string("price"),
703
- changeData.string("text"),
704
- ].filter { !$0.isEmpty }.joined(separator: ", "))
705
794
  }
706
795
  }
@@ -11,7 +11,7 @@ final class NativeListMediaTileCell: NativeListRendererCell {
11
11
  private let picture = UIView()
12
12
  private let image = NativeListMediaPreviewSlot()
13
13
  private let network = NativeListImageSlot()
14
- private let errorIcon = UIImageView()
14
+ private let errorIcon = NativeListIconImageView()
15
15
  private let title = NativeListTextLabel()
16
16
  private let subtitle = NativeListTextLabel()
17
17
  private let badge = NativeListTextLabel()
@@ -87,6 +87,9 @@ final class NativeListMediaTileCell: NativeListRendererCell {
87
87
  _ item: NativeListItem, theme: [String: Any]?, layout: String,
88
88
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
89
89
  ) {
90
+ let iconUpdate = NativeListIconUpdate(self)
91
+ defer { iconUpdate.finish() }
92
+
90
93
  let style = item.data.dictionary("style") ?? [:]
91
94
  imageStyle = style.dictionary("image") ?? [:]
92
95
  let hp = CGFloat(style.double("horizontalPadding", default: 10))
@@ -122,7 +125,7 @@ final class NativeListMediaTileCell: NativeListRendererCell {
122
125
  let state = item.data.string("imageState")
123
126
  let placeholder = theme?.string("strongBackground", default: "#0000000F") ?? "#0000000F"
124
127
  errorIcon.isHidden = state != "error"
125
- errorIcon.image = nativeListIcon(named: "ImageSquareWavesOutline")
128
+ errorIcon.bindIcon("ImageSquareWavesOutline")
126
129
  errorIcon.tintColor = UIColor(nativeListHex: "#00000044", fallback: .lightGray)
127
130
  let media = item.data.dictionary("media")
128
131
  if state != "empty", state != "error", let source = media?.dictionary("source") ?? item.data.dictionary("image") {
@@ -164,6 +167,7 @@ final class NativeListMediaTileCell: NativeListRendererCell {
164
167
  close.setTitle("×", for: .normal)
165
168
  close.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium, fonts: fonts)
166
169
  close.setTitleColor(nativeListColor(theme, "primaryText", "#202020"), for: .normal)
170
+
167
171
  }
168
172
  override func layoutSubviews() {
169
173
  let width = CGFloat(
@@ -374,7 +374,7 @@ final class NativeListMetricCardCell: NativeListRendererCell {
374
374
  }
375
375
 
376
376
  private final class NativeListMetricVisual: UIView {
377
- private let icon = UIImageView()
377
+ private let icon = NativeListIconImageView()
378
378
  private let image = NativeListImageSlot()
379
379
  init() {
380
380
  super.init(frame: .zero)
@@ -389,6 +389,8 @@ private final class NativeListMetricVisual: UIView {
389
389
  }
390
390
  required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
391
391
  func bind(_ visual: [String: Any], key: String, placeholder: String) {
392
+ let iconUpdate = NativeListIconUpdate(self)
393
+ defer { iconUpdate.finish() }
392
394
  backgroundColor = UIColor(
393
395
  nativeListHex: visual.string("backgroundColor", default: "#0000000F"), fallback: .lightGray)
394
396
  layer.cornerRadius = visual.string("shape") == "square" ? 0 : 8
@@ -397,7 +399,7 @@ private final class NativeListMetricVisual: UIView {
397
399
  image.view.isHidden = true
398
400
  if kind == "icon" {
399
401
  image.recycle()
400
- icon.image = nativeListIcon(named: visual.string("name"))
402
+ icon.bindIcon(visual.string("name"))
401
403
  icon.tintColor = UIColor(
402
404
  nativeListHex: visual.string("tintColor", default: "#00000072"), fallback: .darkGray)
403
405
  } else if let source = kind == "stackedImages"
@@ -124,8 +124,8 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
124
124
  private let trailingStack = UIStackView()
125
125
  private let accessoryButtons = [NativeListAccessoryButton(type: .system)]
126
126
  private let checkboxControl = NativeListAccessoryStack(frame: .zero)
127
- private let headerTitleIconImageView = UIImageView()
128
- private let headerValueIconImageView = UIImageView()
127
+ private let headerTitleIconImageView = NativeListIconImageView()
128
+ private let headerValueIconImageView = NativeListIconImageView()
129
129
  private var accessoryActions: [(String, NativeSelectionTarget?)] = []
130
130
  private var currentItem: NativeListItem?
131
131
  private var currentTheme: [String: Any]?
@@ -187,6 +187,9 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
187
187
  _ item: NativeListItem, theme: [String: Any]?, layout: String,
188
188
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
189
189
  ) {
190
+ let iconUpdate = NativeListIconUpdate(self)
191
+ defer { iconUpdate.finish() }
192
+
190
193
  selectorTypographyRestorers.reversed().forEach { $0() }
191
194
  selectorTypographyRestorers = []
192
195
  currentItem = item
@@ -297,6 +300,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
297
300
  width.isActive = true
298
301
  selectorConstraints.append(width)
299
302
  }
303
+
300
304
  }
301
305
  private func bindPositionHeaderFields(_ item: NativeListItem, theme: [String: Any]?) {
302
306
  let style = item.data.dictionary("style") ?? [:]
@@ -371,6 +375,9 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
371
375
  _ item: NativeListItem,
372
376
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
373
377
  ) {
378
+ let iconUpdate = NativeListIconUpdate(self)
379
+ defer { iconUpdate.finish() }
380
+
374
381
  currentItem = item
375
382
  checkboxControl.updateSelection(item, checkboxState: checkboxState)
376
383
  if item.data.string("variant") == "summary" {
@@ -382,6 +389,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
382
389
  applyTextStyle(item)
383
390
  applySelectorTypography(item)
384
391
  }
392
+
385
393
  }
386
394
  private func bindCheckbox(
387
395
  _ item: NativeListItem, _ descriptor: [String: Any],
@@ -523,7 +531,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
523
531
  topInset = 12
524
532
  bottomInset = -2
525
533
  if let icon = item.data.dictionary("titleIcon") {
526
- headerTitleIconImageView.image = nativeListIcon(named: icon.string("name"))
534
+ headerTitleIconImageView.bindIcon(icon.string("name"))
527
535
  headerTitleIconImageView.tintColor = UIColor(
528
536
  nativeListHex: icon.string("tintColor", default: "#646464"),
529
537
  fallback: .darkGray
@@ -593,7 +601,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
593
601
  for: .normal
594
602
  )
595
603
  if let icon = item.data.dictionary("valueIcon") {
596
- headerValueIconImageView.image = nativeListIcon(named: icon.string("name"))
604
+ headerValueIconImageView.bindIcon(icon.string("name"))
597
605
  headerValueIconImageView.tintColor = UIColor(
598
606
  nativeListHex: icon.string("tintColor", default: "#646464"),
599
607
  fallback: .darkGray
@@ -1524,13 +1524,16 @@ final class NativeListView: UIView {
1524
1524
  var sizeChanged = false
1525
1525
  var reorderStructureChanged = false
1526
1526
  let marketQuoteFields: Set<String> = [
1527
- "revision", "price", "priceSegments", "change", "accessibilityLabel",
1527
+ "revision", "price", "priceSegments", "change", "accessibilityLabel", "metrics",
1528
1528
  ]
1529
1529
  for (index, changes) in pending {
1530
1530
  let previous = current.items[index]
1531
1531
  var merged = current.items[index].data
1532
1532
  changes.forEach { key, value in
1533
- if key != "key" && key != "type" { merged[key] = value }
1533
+ if key != "key" && key != "type" {
1534
+ if value is NSNull { merged.removeValue(forKey: key) }
1535
+ else { merged[key] = value }
1536
+ }
1534
1537
  }
1535
1538
  guard let item = try? NativeListItem(data: merged) else { return }
1536
1539
  if rowHeight(previous, usingCompactReorderHeight: false) != rowHeight(item, usingCompactReorderHeight: false) ||
@@ -1547,13 +1550,28 @@ final class NativeListView: UIView {
1547
1550
  reorderStructureChanged = true
1548
1551
  }
1549
1552
  current.items[index] = item
1550
- if previous.type == "market", Set(changes.keys).isSubset(of: marketQuoteFields) {
1553
+ let previousMetrics = previous.data.dictionaries("metrics")
1554
+ let nextMetrics = item.data.dictionaries("metrics")
1555
+ let sameMetricStructure = previousMetrics.count == nextMetrics.count &&
1556
+ previousMetrics.indices.allSatisfy { metricIndex in
1557
+ let before = previousMetrics[metricIndex]
1558
+ let after = nextMetrics[metricIndex]
1559
+ return before.string("key") == after.string("key") &&
1560
+ before.int("weight", default: 1) == after.int("weight", default: 1) &&
1561
+ before.string("alignment", default: "end") ==
1562
+ after.string("alignment", default: "end")
1563
+ }
1564
+ if previous.type == "market", Set(changes.keys).isSubset(of: marketQuoteFields),
1565
+ sameMetricStructure
1566
+ {
1551
1567
  marketQuoteKeys.insert(item.key)
1552
1568
  } else {
1553
1569
  changedKeys.insert(item.key)
1554
1570
  }
1555
1571
  if let selected = changes["selected"] as? Bool {
1556
1572
  if selected { current.selectedKeys.insert(item.key) } else { current.selectedKeys.remove(item.key) }
1573
+ } else if changes["selected"] is NSNull {
1574
+ current.selectedKeys.remove(item.key)
1557
1575
  }
1558
1576
  }
1559
1577
  if !changedKeys.isEmpty { invalidateActionAnchor(reason: "snapshot") }