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

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 (144) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +245 -9
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +29 -3
  5. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  6. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  7. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +87 -7
  8. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +193 -10
  9. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +147 -33
  10. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +145 -2
  12. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +51 -0
  13. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  14. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
  16. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  17. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  18. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1920 -109
  19. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +29 -0
  20. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  21. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  22. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  23. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  24. package/docs/ROW_TEMPLATES.md +60 -9
  25. package/docs/SPEC.md +1004 -17
  26. package/docs/STYLE_SPEC.md +6 -0
  27. package/ios/HybridNativeList.swift +21 -2
  28. package/ios/NativeListAccessoryStack.swift +235 -39
  29. package/ios/NativeListActivityDetailsView.swift +18 -8
  30. package/ios/NativeListActivityRenderer.swift +8 -2
  31. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  32. package/ios/NativeListDataRowRenderer.swift +155 -27
  33. package/ios/NativeListDesignAssets.swift +9 -0
  34. package/ios/NativeListIdentityRenderer.swift +191 -30
  35. package/ios/NativeListLeadingVisual.swift +119 -22
  36. package/ios/NativeListMessageRenderer.swift +34 -1
  37. package/ios/NativeListModels.swift +42 -2
  38. package/ios/NativeListRendererRegistry.swift +1 -0
  39. package/ios/NativeListResolvedText.swift +2 -1
  40. package/ios/NativeListRowHost.swift +14 -0
  41. package/ios/NativeListSectionHeaderRenderer.swift +88 -0
  42. package/ios/RNCNativeListView.swift +1031 -55
  43. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
  44. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
  45. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +1 -0
  46. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +1 -0
  47. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +1 -0
  48. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +1 -0
  49. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
  50. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
  51. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +1 -0
  52. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +1 -0
  53. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
  54. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
  55. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +1 -0
  56. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +1 -0
  57. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +1 -0
  58. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +1 -0
  59. package/ios/tests/NativeListAccessoryStackTests.swift +89 -0
  60. package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
  61. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  62. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  63. package/ios/tests/NativeListLifecycleTests.swift +2720 -3
  64. package/lib/module/NativeList.js +200 -32
  65. package/lib/module/NativeList.web.js +262 -32
  66. package/lib/module/index.js +1 -1
  67. package/lib/module/models.js +1 -0
  68. package/lib/module/selection.js +1 -1
  69. package/lib/module/validation.js +776 -52
  70. package/lib/module/web/NativeListWebEngine.js +919 -79
  71. package/lib/module/web/templates/ActivityRowRenderer.js +487 -7
  72. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  73. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  74. package/lib/module/web/templates/IdentityRowRenderer.js +90 -4
  75. package/lib/module/web/templates/MarketRowRenderer.js +8 -3
  76. package/lib/module/web/templates/MarketTableRowRenderer.js +577 -0
  77. package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
  78. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  79. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  80. package/lib/module/web/templates/RowRendererRegistry.js +8 -3
  81. package/lib/module/web/templates/SectionHeaderRowRenderer.js +70 -3
  82. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  83. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  84. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  85. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  86. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  87. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  88. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  89. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  90. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  91. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  92. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  93. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  94. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  95. package/lib/typescript/src/NativeList.d.ts +3 -3
  96. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  97. package/lib/typescript/src/NativeList.types.d.ts +29 -1
  98. package/lib/typescript/src/NativeList.web.d.ts +2 -2
  99. package/lib/typescript/src/index.d.ts +2 -2
  100. package/lib/typescript/src/models.d.ts +176 -10
  101. package/lib/typescript/src/validation.d.ts +15 -0
  102. package/lib/typescript/src/web/NativeListWebEngine.d.ts +58 -1
  103. package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
  104. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  105. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  106. package/lib/typescript/src/web/templates/MarketTableRowRenderer.d.ts +17 -0
  107. package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
  108. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +10 -4
  109. package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
  110. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  111. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  112. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  114. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  115. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  116. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  117. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  118. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  119. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  120. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  121. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  122. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  123. package/package.json +3 -3
  124. package/react-native-native-list.podspec +1 -0
  125. package/src/NativeList.nitro.ts +2 -0
  126. package/src/NativeList.tsx +391 -82
  127. package/src/NativeList.types.ts +34 -1
  128. package/src/NativeList.web.tsx +420 -65
  129. package/src/index.ts +2 -0
  130. package/src/models.ts +210 -3
  131. package/src/selection.ts +1 -0
  132. package/src/validation.ts +1635 -76
  133. package/src/web/NativeListWebEngine.ts +1476 -112
  134. package/src/web/templates/ActivityRowRenderer.ts +732 -8
  135. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  136. package/src/web/templates/DataRowRenderer.ts +93 -20
  137. package/src/web/templates/IdentityRowRenderer.ts +150 -5
  138. package/src/web/templates/MarketRowRenderer.ts +19 -3
  139. package/src/web/templates/MarketTableRowRenderer.ts +755 -0
  140. package/src/web/templates/MediaTileRowRenderer.ts +313 -5
  141. package/src/web/templates/MessageRowRenderer.ts +23 -7
  142. package/src/web/templates/RowContainerStyle.ts +2 -0
  143. package/src/web/templates/RowRendererRegistry.ts +21 -6
  144. package/src/web/templates/SectionHeaderRowRenderer.ts +89 -5
@@ -4,6 +4,51 @@ final class NativeListIdentityCell: NativeListRendererCell {
4
4
  override class func appliesSizePreset(_ item: NativeListItem) -> Bool {
5
5
  !["walletSidebar", "networkSelector"].contains(item.data.string("presentation"))
6
6
  }
7
+ private class func configureTrailingStack(
8
+ _ stack: NativeListAccessoryStack, descriptors: [[String: Any]]
9
+ ) {
10
+ stack.axis = .vertical
11
+ stack.alignment = .trailing
12
+ stack.spacing = 2
13
+ if descriptors.contains(where: { $0.string("kind") == "checkbox" })
14
+ && descriptors.contains(where: { $0.string("kind") == "value" })
15
+ {
16
+ stack.axis = .horizontal
17
+ stack.alignment = .center
18
+ stack.spacing = 12
19
+ } else if descriptors.count == 2,
20
+ descriptors[0].string("kind") == "valuePair",
21
+ (descriptors[1].string("kind") == "menu"
22
+ || (descriptors[1].string("kind") == "icon"
23
+ && descriptors[1].string("name") == "DotVerSolid"
24
+ && descriptors[1].string("actionKey") == "menu"))
25
+ {
26
+ stack.axis = .horizontal
27
+ stack.alignment = .center
28
+ stack.spacing = 8
29
+ } else if descriptors.count == 2,
30
+ (descriptors[0].string("kind") == "valuePair"
31
+ && descriptors[1].string("kind") == "chevron")
32
+ || (descriptors[0].string("kind") == "icon"
33
+ && descriptors[0].string("name") == "RefreshCcwOutline"
34
+ && descriptors[0].string("actionKey").isEmpty
35
+ && descriptors[1].string("kind") == "chevron")
36
+ {
37
+ stack.axis = .horizontal
38
+ stack.alignment = .center
39
+ stack.spacing = 12
40
+ } else if descriptors.count == 2,
41
+ descriptors[0].string("kind") == "icon",
42
+ descriptors[0].string("name") == "PencilOutline",
43
+ descriptors[1].string("kind") == "icon",
44
+ descriptors[1].string("name") == "DragOutline"
45
+ {
46
+ stack.axis = .horizontal
47
+ stack.alignment = .center
48
+ // Source 36-point icon frames with -7 margins need a 10-point gap.
49
+ stack.spacing = 10
50
+ }
51
+ }
7
52
  override class func measure(
8
53
  _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
9
54
  fonts: NativeListFontFamilies
@@ -12,6 +57,47 @@ final class NativeListIdentityCell: NativeListRendererCell {
12
57
  return item.data.dictionaries("badges").isEmpty ? 68 : 92
13
58
  }
14
59
  if item.data.string("presentation") == "networkSelector" { return 47 }
60
+ if item.data.string("contentHeight") == "auto" {
61
+ let style = item.data.dictionary("style") ?? [:]
62
+ let horizontalPadding = CGFloat(style.double("horizontalPadding", default: layout == "table" ? 16 : 12))
63
+ let verticalPadding = CGFloat(style.double("verticalPadding", default: 8))
64
+ let imageWidth = CGFloat(style.dictionary("image")?.double("width", default: 40) ?? 40)
65
+ let imageHeight = CGFloat(style.dictionary("image")?.double("height", default: 40) ?? 40)
66
+ let leadingGap = CGFloat(style.double("leadingGap", default: 12))
67
+ let accessories = item.data.dictionaries("trailing")
68
+ let trailing = NativeListAccessoryStack(frame: .zero)
69
+ configureTrailingStack(trailing, descriptors: accessories)
70
+ trailing.bind(
71
+ item, descriptors: accessories, theme: theme, style: style,
72
+ defaultSpacing: trailing.spacing, checkboxState: { _, _, fallback in fallback }, fonts: fonts)
73
+ trailing.isHidden = false
74
+ let trailingSize = trailing.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)
75
+ let rightInset = style["horizontalPadding"] != nil
76
+ ? horizontalPadding : trailing.endInset ?? horizontalPadding
77
+ let contentGap = trailing.contentGap ?? 12
78
+ let textWidth = max(1,
79
+ width - horizontalPadding - rightInset - imageWidth - leadingGap
80
+ - trailingSize.width - contentGap)
81
+ let title = NativeListResolvedText(
82
+ item.data.string("title"), style: style.dictionary("title"), size: 16,
83
+ weight: .medium, color: .black, lineHeight: 24,
84
+ lines: item.data.int("titleLines", default: 1), fonts: fonts)
85
+ let subtitle = NativeListResolvedText(
86
+ item.data.string("subtitle"), style: style.dictionary("subtitle"), size: 14,
87
+ color: .black, lineHeight: 20,
88
+ lines: item.data.int("subtitleLines", default: 1),
89
+ breakMode: item.data.int("subtitleLines", default: 1) == 0 ? .byWordWrapping : .byTruncatingTail,
90
+ fonts: fonts)
91
+ let tertiary = NativeListResolvedText(
92
+ item.data.string("tertiary"), style: style.dictionary("tertiary"), size: 14,
93
+ color: .black, lineHeight: 20, lines: 1, fonts: fonts)
94
+ let textHeight = title.measure(width: textWidth)
95
+ + subtitle.measure(width: textWidth)
96
+ + tertiary.measure(width: textWidth)
97
+ + (item.data.string("subtitle").isEmpty ? 0 : CGFloat(style.double("lineGap", default: 0)))
98
+ return max(item.data.string("subtitle").isEmpty ? 56 : 60,
99
+ verticalPadding * 2 + max(imageHeight, textHeight, trailingSize.height))
100
+ }
15
101
  return !item.data.string("tertiary").isEmpty
16
102
  ? 72 : !item.data.string("subtitle").isEmpty ? 60 : 56
17
103
  }
@@ -20,6 +106,11 @@ final class NativeListIdentityCell: NativeListRendererCell {
20
106
  private let mainStack = UIStackView()
21
107
  private let titleRowStack = UIStackView()
22
108
  private let titleLabel = NativeListTextLabel()
109
+ private let titleIconView = UIImageView()
110
+ // Absorbs the title row's slack so the title keeps its intrinsic width and the
111
+ // title icon / badge follow the text (OK-66041); Android's PackedTitleLineLayout
112
+ // and the Web flex row already pack the title row at its start.
113
+ private let titleRowFiller = UIView()
23
114
  private let subtitleLabel = NativeListTextLabel()
24
115
  private let tertiaryLabel = NativeListTextLabel()
25
116
  private let badgeLabel = NativeListInsetLabel()
@@ -75,7 +166,20 @@ final class NativeListIdentityCell: NativeListRendererCell {
75
166
  titleRowStack.axis = .horizontal
76
167
  titleRowStack.alignment = .center
77
168
  titleRowStack.addArrangedSubview(titleLabel)
169
+ titleRowStack.addArrangedSubview(titleIconView)
78
170
  titleRowStack.addArrangedSubview(badgeLabel)
171
+ titleRowStack.addArrangedSubview(titleRowFiller)
172
+ titleRowFiller.setContentHuggingPriority(UILayoutPriority(1), for: .horizontal)
173
+ titleRowFiller.setContentCompressionResistancePriority(UILayoutPriority(1), for: .horizontal)
174
+ titleIconView.translatesAutoresizingMaskIntoConstraints = false
175
+ let titleIconWidth = titleIconView.widthAnchor.constraint(equalToConstant: 20)
176
+ titleIconWidth.priority = UILayoutPriority(999)
177
+ NSLayoutConstraint.activate([
178
+ titleIconWidth,
179
+ titleIconView.heightAnchor.constraint(equalToConstant: 20),
180
+ ])
181
+ titleIconView.contentMode = .scaleAspectFit
182
+ titleIconView.setContentHuggingPriority(.required, for: .horizontal)
79
183
  [titleRowStack, subtitleLabel, tertiaryLabel].forEach(mainStack.addArrangedSubview)
80
184
  visual.translatesAutoresizingMaskIntoConstraints = false
81
185
  leadingWidth = visual.widthAnchor.constraint(equalToConstant: 40)
@@ -133,6 +237,10 @@ final class NativeListIdentityCell: NativeListRendererCell {
133
237
  titleRowStack.setCustomSpacing(UIStackView.spacingUseDefault, after: $0)
134
238
  }
135
239
  titleRowStack.spacing = 8
240
+ titleIconView.image = nil
241
+ titleIconView.isHidden = true
242
+ titleIconView.accessibilityLabel = nil
243
+ titleIconView.isAccessibilityElement = false
136
244
  titleRowStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
137
245
  titleRowStack.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
138
246
  for label in [titleLabel, subtitleLabel, tertiaryLabel, badgeLabel] {
@@ -165,6 +273,10 @@ final class NativeListIdentityCell: NativeListRendererCell {
165
273
  leadingWidth.constant = 40
166
274
  leadingHeight.constant = 40
167
275
  visual.glyphSize = 18
276
+ visual.bitmapBorderWidth =
277
+ item.data.dictionary("leading")?.string("borderColor").isEmpty == false
278
+ && item.data.dictionary("leading")?.string("borderStyle") != "dashed"
279
+ ? 1 : 0
168
280
  fallbackLabel.attributedText = nil
169
281
  fallbackLabel.font = nativeListFont(ofSize: 13, weight: .bold, fonts: fonts)
170
282
  trailingStack.reset()
@@ -175,6 +287,35 @@ final class NativeListIdentityCell: NativeListRendererCell {
175
287
  leadingActionButton.setImage(nil, for: .normal)
176
288
  bindIdentity(item, theme: theme, selected: item.data.bool("selected"), checkboxState)
177
289
  let style = item.data.dictionary("style") ?? [:]
290
+ if let titleIcon = item.data.dictionary("titleIcon") {
291
+ titleIconView.image = nativeListIcon(named: titleIcon.string("name"))
292
+ titleIconView.tintColor = UIColor(
293
+ nativeListHex: titleIcon.string("tintColor",
294
+ default: theme?["iconSubdued"] as? String ?? "#8D8D8D"),
295
+ fallback: .gray)
296
+ titleIconView.isHidden = false
297
+ let label = titleIcon.string("accessibilityLabel")
298
+ titleIconView.accessibilityLabel = label.isEmpty ? nil : label
299
+ titleIconView.isAccessibilityElement = !label.isEmpty
300
+ titleRowStack.setCustomSpacing(4, after: titleLabel)
301
+ // A long title truncates ahead of the 20pt glyph (Android caps the title
302
+ // at row width minus accessories, Web shrinks the title first); with the
303
+ // title at `.required` the icon's 999 width constraint collapsed to 0.
304
+ titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
305
+ }
306
+ if let ratio = style["leadingContentMaxWidthRatio"] as? NSNumber,
307
+ root.arrangedSubviews.contains(visual)
308
+ {
309
+ titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
310
+ let visualWidth = CGFloat(style.dictionary("image")?.double("width", default: 40) ?? 40)
311
+ let leadingGap = CGFloat(style.double("leadingGap", default: 12))
312
+ let constraint = mainStack.widthAnchor.constraint(
313
+ lessThanOrEqualTo: root.widthAnchor,
314
+ multiplier: CGFloat(ratio.doubleValue),
315
+ constant: -(visualWidth + leadingGap))
316
+ constraint.isActive = true
317
+ selectorConstraints.append(constraint)
318
+ }
178
319
  if style["horizontalPadding"] != nil {
179
320
  leftInset = CGFloat(style.double("horizontalPadding"))
180
321
  rightInset = -leftInset
@@ -196,7 +337,9 @@ final class NativeListIdentityCell: NativeListRendererCell {
196
337
  if walletBadgeLine != nil {
197
338
  mainStack.setCustomSpacing(CGFloat(style.double("titleBadgeGap")), after: titleRowStack)
198
339
  } else {
199
- titleRowStack.setCustomSpacing(CGFloat(style.double("titleBadgeGap")), after: titleLabel)
340
+ titleRowStack.setCustomSpacing(
341
+ CGFloat(style.double("titleBadgeGap")),
342
+ after: titleIconView.isHidden ? titleLabel : titleIconView)
200
343
  }
201
344
  }
202
345
  if style["trailingGap"] != nil { trailingStack.spacing = CGFloat(style.double("trailingGap")) }
@@ -219,8 +362,19 @@ final class NativeListIdentityCell: NativeListRendererCell {
219
362
  : style.dictionary("container")?.string("contentVerticalAlignment") == "bottom"
220
363
  ? .bottom : .center
221
364
  }
365
+ settleTitleRowFillerSpacing()
222
366
  applySelectorTypography(item)
223
367
  }
368
+
369
+ /// The filler is the title row's last arranged view; the stack's default
370
+ /// spacing before it would shave 8pt off the title's available width (visible
371
+ /// under `leadingContentMaxWidthRatio`), so the gap before the filler is zero.
372
+ private func settleTitleRowFillerSpacing() {
373
+ let visible = titleRowStack.arrangedSubviews.filter { $0 !== titleRowFiller && !$0.isHidden }
374
+ if let last = visible.last {
375
+ titleRowStack.setCustomSpacing(0, after: last)
376
+ }
377
+ }
224
378
  override func bindSelectionContent(
225
379
  _ item: NativeListItem,
226
380
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
@@ -440,9 +594,40 @@ final class NativeListIdentityCell: NativeListRendererCell {
440
594
  }
441
595
  root.addArrangedSubview(mainStack)
442
596
  show(titleLabel, item.data.string("title"), lines: item.data.int("titleLines", default: 1))
597
+ let titleSuffixes = item.data.dictionaries("titleSuffixes")
598
+ if !titleSuffixes.isEmpty {
599
+ titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
600
+ let minimumTitleWidth = titleLabel.widthAnchor.constraint(greaterThanOrEqualToConstant: 80)
601
+ minimumTitleWidth.priority = UILayoutPriority(751)
602
+ minimumTitleWidth.isActive = true
603
+ selectorConstraints.append(minimumTitleWidth)
604
+ for suffix in titleSuffixes {
605
+ let label = NativeListTextLabel()
606
+ label.font = nativeListFont(ofSize: 12, fonts: fonts)
607
+ label.textColor = dataTextColor(suffix.string("tone", default: "secondary"), theme: theme)
608
+ label.numberOfLines = 1
609
+ label.lineBreakMode = .byTruncatingTail
610
+ label.setContentHuggingPriority(.defaultHigh, for: .horizontal)
611
+ label.setContentCompressionResistancePriority(UILayoutPriority(749), for: .horizontal)
612
+ setLineHeight(label, text: suffix.string("text"), lineHeight: 16)
613
+ if let maxWidth = suffix["maxWidth"] as? NSNumber {
614
+ let limit = label.widthAnchor.constraint(lessThanOrEqualToConstant: CGFloat(truncating: maxWidth))
615
+ limit.isActive = true
616
+ selectorConstraints.append(limit)
617
+ }
618
+ titleRowStack.insertArrangedSubview(
619
+ label,
620
+ at: titleRowStack.arrangedSubviews.firstIndex(of: badgeLabel)
621
+ ?? titleRowStack.arrangedSubviews.count)
622
+ selectorViews.append(label)
623
+ }
624
+ }
443
625
  show(
444
626
  subtitleLabel, item.data.string("subtitle"), lines: item.data.int("subtitleLines", default: 1)
445
627
  )
628
+ if item.data.int("subtitleLines", default: 1) == 0 {
629
+ subtitleLabel.lineBreakMode = .byWordWrapping
630
+ }
446
631
  show(tertiaryLabel, item.data.string("tertiary"), lines: 1)
447
632
  if !item.data.string("subtitle").isEmpty, item.data.string("tertiary").isEmpty {
448
633
  mainStack.spacing = 0
@@ -556,32 +741,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
556
741
  }
557
742
  root.addArrangedSubview(trailingStack)
558
743
  let accessories = item.data.dictionaries("trailing")
559
- if accessories.contains(where: { $0.string("kind") == "checkbox" })
560
- && accessories.contains(where: { $0.string("kind") == "value" })
561
- {
562
- trailingStack.axis = .horizontal
563
- trailingStack.alignment = .center
564
- trailingStack.spacing = 12
565
- } else if accessories.count == 2,
566
- accessories[0].string("kind") == "valuePair",
567
- accessories[1].string("kind") == "menu"
568
- {
569
- trailingStack.axis = .horizontal
570
- trailingStack.alignment = .center
571
- trailingStack.spacing = 8
572
- } else if accessories.count == 2,
573
- accessories[0].string("kind") == "icon",
574
- accessories[0].string("name") == "PencilOutline",
575
- accessories[1].string("kind") == "icon",
576
- accessories[1].string("name") == "DragOutline"
577
- {
578
- trailingStack.axis = .horizontal
579
- trailingStack.alignment = .center
580
- // Each source IconButton has a 36-point frame and m=-7. XStack gap=$6
581
- // therefore places the physical frames 10 points apart (46-point
582
- // center distance), not 24 points apart.
583
- trailingStack.spacing = 10
584
- }
744
+ Self.configureTrailingStack(trailingStack, descriptors: accessories)
585
745
  trailingStack.bind(
586
746
  item, descriptors: accessories, theme: theme, style: item.data.dictionary("style") ?? [:],
587
747
  defaultSpacing: trailingStack.spacing, checkboxState: checkboxState, fonts: fonts)
@@ -590,12 +750,13 @@ final class NativeListIdentityCell: NativeListRendererCell {
590
750
  trailingStack.isHidden = false
591
751
  if let gap = trailingStack.contentGap { root.setCustomSpacing(gap, after: mainStack) }
592
752
  if let inset = trailingStack.endInset { rightInset = -inset }
593
- if item.data.string("presentation") == "accountSelector",
594
- accessories.count == 1,
753
+ if accessories.count == 1,
754
+ (item.data.string("presentation") == "accountSelector"
755
+ || accessories[0].string("kind") == "valuePair"),
595
756
  let accessory = trailingStack.firstVisibleControl
596
757
  {
597
758
  // The vertical trailing stack has no stable intrinsic width, so keep its
598
- // flexible space in the account title and subtitle column.
759
+ // flexible space in the title and subtitle column.
599
760
  let width = trailingStack.widthAnchor.constraint(equalTo: accessory.widthAnchor)
600
761
  width.isActive = true
601
762
  selectorConstraints.append(width)
@@ -17,19 +17,26 @@ final class NativeListLeadingVisual: UIView {
17
17
  private let icon = UIImageView()
18
18
  private let unread = UIView()
19
19
  private let networkBackdrop = UIView()
20
+ // Ring under the secondary token of an Activity pair (SPEC "Activity leading pair").
21
+ private let pairBackdrop = UIView()
20
22
  private let corner = UIImageView()
21
23
  private let cornerBackdrop = UIView()
22
24
  private var slots: [NativeListImageSlot] = []
23
25
  private var overlaySlots: [NativeListImageSlot] = []
26
+ private var overlayFallbackIcons: [UIImageView] = []
24
27
  private var overlays: [(UIView, [String: Any])] = []
25
28
  private let dashedBorder = CAShapeLayer()
26
29
  private var visual: [String: Any] = [:]
27
30
  private var imageStyle: [String: Any] = [:]
28
31
  private var sources: [([String: Any], String)] = []
32
+ // Roles inside `sources`: the token `networkImage` badge and the Activity
33
+ // `secondaryLeading` token; nil when absent.
34
+ private var networkIndex: Int?
35
+ private var pairIndex: Int?
29
36
 
30
37
  override init(frame: CGRect) {
31
38
  super.init(frame: frame)
32
- [fallback, icon, networkBackdrop, cornerBackdrop, corner, unread].forEach(addSubview)
39
+ [fallback, icon, pairBackdrop, networkBackdrop, cornerBackdrop, corner, unread].forEach(addSubview)
33
40
  fallback.textAlignment = .center
34
41
  fallback.font = nativeListFont(ofSize: 13, weight: .bold, fonts: fonts)
35
42
  icon.contentMode = .scaleAspectFit
@@ -56,11 +63,14 @@ final class NativeListLeadingVisual: UIView {
56
63
  kind == "token"
57
64
  ? "token"
58
65
  : kind == "network" ? "network" : ["account", "wallet"].contains(kind) ? "avatar" : "generic"
66
+ networkIndex = nil
67
+ pairIndex = nil
59
68
  sources =
60
69
  kind == "stackedImages"
61
70
  ? visual.dictionaries("images").prefix(3).map { ($0, "generic") }
62
71
  : kind == "icon" ? [] : visual.dictionary("image").map { [($0, variant)] } ?? []
63
72
  if kind == "token", !sources.isEmpty, let network = visual.dictionary("networkImage") {
73
+ networkIndex = sources.count
64
74
  sources.append((network, "network"))
65
75
  }
66
76
  if let secondaryVisual {
@@ -70,6 +80,9 @@ final class NativeListLeadingVisual: UIView {
70
80
  ? secondaryVisual.dictionaries("images").first
71
81
  : secondaryKind == "icon" ? nil : secondaryVisual.dictionary("image")
72
82
  if let source {
83
+ // A second token forms a pair only next to a primary image; without one
84
+ // it simply takes the primary's place (OK-66071).
85
+ if kind == "token", !sources.isEmpty { pairIndex = sources.count }
73
86
  sources.append(
74
87
  (
75
88
  source,
@@ -87,6 +100,7 @@ final class NativeListLeadingVisual: UIView {
87
100
  }
88
101
  let placeholder = theme?.string("strongBackground", default: "#0000000F") ?? "#0000000F"
89
102
  let fallbackIcon = visual.dictionary("fallbackIcon")
103
+ let fallbackBackground = fallbackIcon?.string("backgroundColor", default: placeholder) ?? placeholder
90
104
  let sourceFallback =
91
105
  kind != "icon" && !sources.isEmpty
92
106
  && sources[0].0.string("loadingStrategy", default: "none") != "none"
@@ -95,7 +109,8 @@ final class NativeListLeadingVisual: UIView {
95
109
  let restored = fallbackKey.map(NativeListSourceFallbackState.has) ?? false
96
110
  let fallbackData = kind == "icon" ? visual : fallbackIcon
97
111
  fallback.text = String(visual.string("fallbackText").prefix(2))
98
- fallback.textColor = UIColor(nativeListHex: "#8D8D8D", fallback: .gray)
112
+ fallback.textColor = UIColor(
113
+ nativeListHex: visual.string("fallbackTextColor", default: "#8D8D8D"), fallback: .gray)
99
114
  icon.image = fallbackData.map { nativeListIcon(named: $0.string("name")) } ?? nil
100
115
  icon.tintColor = UIColor(
101
116
  nativeListHex: fallbackData?.string("tintColor", default: "#646464") ?? "#646464",
@@ -106,7 +121,9 @@ final class NativeListLeadingVisual: UIView {
106
121
  nativeListHex: visual.string(
107
122
  "backgroundColor", default: sources.isEmpty ? placeholder : "#00000000"), fallback: .clear)
108
123
  backgroundColor =
109
- sourceFallback ? UIColor(nativeListHex: placeholder, fallback: .clear) : visualBackground
124
+ sources.isEmpty && fallbackIcon?["backgroundColor"] != nil || restored
125
+ ? UIColor(nativeListHex: fallbackBackground, fallback: .clear)
126
+ : sourceFallback ? UIColor(nativeListHex: placeholder, fallback: .clear) : visualBackground
110
127
  layer.borderWidth = kind == "icon" ? 1 / UIScreen.main.scale : 0
111
128
  layer.borderColor = UIColor(nativeListHex: "#0000001F", fallback: .clear).cgColor
112
129
  if bitmapBorderWidth > 0 {
@@ -121,12 +138,13 @@ final class NativeListLeadingVisual: UIView {
121
138
  continue
122
139
  }
123
140
  let source = sources[index]
124
- slot.view.isHidden = index > 0 || sourceFallback
141
+ slot.view.isHidden = index > 0 || restored
125
142
  slot.bind(
126
143
  source.0, key: "\(key):leading:\(index)", variant: source.1,
127
144
  fit: index == 0 ? style["contentFit"] as? String : nil, placeholder: placeholder
128
145
  ) { [weak self, weak slot] loaded in
129
146
  slot?.view.isHidden = !loaded && (index > 0 || sourceFallback)
147
+ if let self, index == self.pairIndex { self.syncPairBackdrop() }
130
148
  guard let self, index == 0, sourceFallback else { return }
131
149
  if let fallbackKey {
132
150
  if loaded {
@@ -136,13 +154,24 @@ final class NativeListLeadingVisual: UIView {
136
154
  }
137
155
  }
138
156
  self.backgroundColor =
139
- loaded ? visualBackground : UIColor(nativeListHex: placeholder, fallback: .clear)
157
+ loaded ? visualBackground : UIColor(nativeListHex: fallbackBackground, fallback: .clear)
140
158
  self.fallback.isHidden = loaded || fallbackIcon != nil
141
159
  self.icon.isHidden = loaded || fallbackIcon == nil
142
160
  }
143
161
  }
144
- networkBackdrop.isHidden = !(kind == "token" && sources.count > 1)
162
+ networkBackdrop.isHidden = networkIndex == nil
145
163
  networkBackdrop.backgroundColor = nativeListColor(theme, "rowBackground", "#FFFFFF")
164
+ pairBackdrop.backgroundColor = nativeListColor(theme, "rowBackground", "#FFFFFF")
165
+ syncPairBackdrop()
166
+ // Stacking order by role: primary, pair ring, secondary token, badge
167
+ // backdrop, badge, corner icon. Slots are reused across binds with
168
+ // different roles, so the order is restored on every bind.
169
+ bringSubviewToFront(pairBackdrop)
170
+ if let pairIndex { bringSubviewToFront(slots[pairIndex].view) }
171
+ bringSubviewToFront(networkBackdrop)
172
+ if let networkIndex { bringSubviewToFront(slots[networkIndex].view) }
173
+ bringSubviewToFront(cornerBackdrop)
174
+ bringSubviewToFront(corner)
146
175
  let badge = visual.dictionary("cornerIcon")
147
176
  corner.isHidden = badge == nil
148
177
  cornerBackdrop.isHidden = badge == nil
@@ -158,8 +187,17 @@ final class NativeListLeadingVisual: UIView {
158
187
  overlays.removeAll(keepingCapacity: true)
159
188
  let descriptors = Array(visual.dictionaries("overlays").prefix(2))
160
189
  while overlaySlots.count < descriptors.count { overlaySlots.append(NativeListImageSlot()) }
190
+ while overlayFallbackIcons.count < descriptors.count { overlayFallbackIcons.append(UIImageView()) }
161
191
  for (index, data) in descriptors.enumerated() {
162
192
  let frame = index < previousOverlays.count ? previousOverlays[index].0 : UIView()
193
+ let fallbackData = data.dictionary("fallbackIcon")
194
+ let fallbackGlyph = overlayFallbackIcons[index]
195
+ fallbackGlyph.image = fallbackData.flatMap { nativeListIcon(named: $0.string("name")) }
196
+ fallbackGlyph.tintColor = UIColor(
197
+ nativeListHex: fallbackData?.string("tintColor", default: "#646464") ?? "#646464",
198
+ fallback: .darkGray)
199
+ fallbackGlyph.contentMode = .scaleAspectFit
200
+ fallbackGlyph.isHidden = true
163
201
  frame.clipsToBounds = true
164
202
  frame.backgroundColor = UIColor(
165
203
  nativeListHex: data.string(
@@ -172,7 +210,9 @@ final class NativeListLeadingVisual: UIView {
172
210
  child = slot.view
173
211
  child.isHidden = true
174
212
  slot.bind(image, key: "\(key):overlay:\(index)", placeholder: placeholder) {
175
- [weak child] loaded in child?.isHidden = !loaded
213
+ [weak child, weak fallbackGlyph] loaded in
214
+ child?.isHidden = !loaded
215
+ fallbackGlyph?.isHidden = loaded || fallbackData == nil
176
216
  }
177
217
  } else if !data.string("text").isEmpty {
178
218
  overlaySlots[index].recycle()
@@ -181,7 +221,10 @@ final class NativeListLeadingVisual: UIView {
181
221
  label.textAlignment = .center
182
222
  // A line-height box is the legacy wallet text badge: regular weight, centered metrics.
183
223
  label.font = nativeListFont(
184
- ofSize: overlayTextFontSize, weight: overlayTextLineHeight == nil ? .medium : .regular,
224
+ ofSize: overlayTextFontSize,
225
+ weight: NativeListTextStyles.marketFontWeight(
226
+ data.string("fontWeight"),
227
+ fallback: overlayTextLineHeight == nil ? .medium : .regular),
185
228
  fonts: fonts)
186
229
  if let line = overlayTextLineHeight {
187
230
  let paragraph = NSMutableParagraphStyle()
@@ -207,11 +250,10 @@ final class NativeListLeadingVisual: UIView {
207
250
  nativeListHex: data.string("tintColor", default: "#646464"), fallback: .darkGray)
208
251
  child = glyph
209
252
  }
210
- if child.superview !== frame {
211
- frame.subviews.forEach { $0.removeFromSuperview() }
212
- frame.addSubview(child)
213
- }
214
- if frame.superview == nil { addSubview(frame) }
253
+ frame.subviews.forEach { $0.removeFromSuperview() }
254
+ frame.addSubview(child)
255
+ if data.dictionary("image") != nil && fallbackData != nil { frame.addSubview(fallbackGlyph) }
256
+ if frame.superview == nil { addSubview(frame) } else { bringSubviewToFront(frame) }
215
257
  overlays.append((frame, data))
216
258
  }
217
259
  previousOverlays.dropFirst(descriptors.count).forEach { $0.0.removeFromSuperview() }
@@ -253,20 +295,35 @@ final class NativeListLeadingVisual: UIView {
253
295
  }
254
296
  fallback.frame = bounds
255
297
  let fallbackIcon = visual.dictionary("fallbackIcon")
298
+ let explicitFallbackSize: CGFloat? = fallbackIcon.flatMap { data in
299
+ guard data["size"] != nil else { return nil }
300
+ let size = data.double("size")
301
+ return size > 0 ? CGFloat(size) : nil
302
+ }
256
303
  let iconSize: CGFloat =
257
- !sources.isEmpty && fallbackIcon != nil
304
+ explicitFallbackSize
305
+ ?? (!sources.isEmpty && fallbackIcon != nil
258
306
  ? min(bounds.width, bounds.height)
259
- * (fallbackIcon?.string("name") == "GlobusOutline" ? 1.2 : 1) : glyphSize
307
+ * (fallbackIcon?.string("name") == "GlobusOutline" ? 1.2 : 1) : glyphSize)
260
308
  icon.frame = CGRect(
261
309
  x: (bounds.width - iconSize) / 2, y: (bounds.height - iconSize) / 2, width: iconSize,
262
310
  height: iconSize)
263
- let tokenPair = kind == "token" && sources.count > 1
311
+ // Same geometry as Android's `nativeListLeadingSlotFrame` (SPEC "Activity leading pair").
312
+ let pairMember = (bounds.height * 0.6).rounded()
313
+ let pairRing: CGFloat = 2
264
314
  for (index, slot) in slots.prefix(sources.count).enumerated() {
265
315
  let frame: CGRect
266
- if sources.count == 1 || tokenPair && index == 0 {
267
- frame = bounds
268
- } else if tokenPair {
316
+ if index == networkIndex {
269
317
  frame = CGRect(x: bounds.width - 14, y: bounds.height - 14, width: 16, height: 16)
318
+ } else if pairIndex != nil {
319
+ frame =
320
+ index == pairIndex
321
+ ? CGRect(
322
+ x: bounds.width - pairMember - pairRing, y: bounds.height - pairMember - pairRing,
323
+ width: pairMember, height: pairMember)
324
+ : CGRect(x: 0, y: 0, width: pairMember, height: pairMember)
325
+ } else if sources.count == 1 || networkIndex != nil {
326
+ frame = bounds
270
327
  } else {
271
328
  let side = bounds.height * 0.72
272
329
  frame = CGRect(
@@ -278,10 +335,23 @@ final class NativeListLeadingVisual: UIView {
278
335
  slot.view.clipsToBounds =
279
336
  !(singleOuterMask && sources.count == 1 && overlays.isEmpty
280
337
  && visual.dictionary("cornerIcon") == nil)
338
+ let fillsFrame = index == 0 && pairIndex == nil && (sources.count == 1 || networkIndex != nil)
339
+ // Pair members keep the token shape at their own size (rounded NFTs use
340
+ // the box's 10pt rule scaled to the member).
341
+ let pairRadius: CGFloat = shape == "rounded" ? min(10, frame.height / 4) : frame.height / 2
281
342
  slot.view.layer.cornerRadius =
282
343
  index == 0 && singleOuterMask && sources.count == 1 && overlays.isEmpty
283
344
  && visual.dictionary("cornerIcon") == nil
284
- ? 0 : index == 0 && (sources.count == 1 || tokenPair) ? radius : frame.height / 2
345
+ ? 0
346
+ : fillsFrame
347
+ ? radius : pairIndex != nil && index != networkIndex ? pairRadius : frame.height / 2
348
+ }
349
+ if pairIndex != nil {
350
+ let box = pairMember + 2 * pairRing
351
+ pairBackdrop.frame = logical(
352
+ CGRect(x: bounds.width - box, y: bounds.height - box, width: box, height: box))
353
+ pairBackdrop.layer.cornerRadius =
354
+ shape == "rounded" ? min(10, pairMember / 4) + pairRing : box / 2
285
355
  }
286
356
  for (index, slot) in slots.enumerated() {
287
357
  if index == 0 && bitmapBorderWidth > 0 {
@@ -306,7 +376,8 @@ final class NativeListLeadingVisual: UIView {
306
376
  cornerBackdrop.frame = networkBackdrop.frame
307
377
  corner.frame = cornerBackdrop.frame.insetBy(dx: 1, dy: 1)
308
378
  unread.frame = logical(CGRect(x: bounds.width - 8, y: 0, width: 8, height: 8))
309
- for (frame, data) in overlays {
379
+ for (index, overlay) in overlays.enumerated() {
380
+ let (frame, data) = overlay
310
381
  let size = CGFloat(data.double("size", default: 20))
311
382
  // Legacy wallet text badges size to their text (tabular 12pt + 4) at the line height.
312
383
  let textBadgeLine =
@@ -331,9 +402,19 @@ final class NativeListLeadingVisual: UIView {
331
402
  height: height))
332
403
  frame.layer.cornerRadius = min(width, height) / 2
333
404
  let inset = CGFloat(data.double("padding", default: 0))
334
- frame.subviews.first?.frame = frame.bounds.insetBy(
405
+ let contentFrame = frame.bounds.insetBy(
335
406
  dx: data["text"] != nil ? overlayTextHorizontalInset ?? inset : inset,
336
407
  dy: data["text"] != nil && overlayTextHorizontalInset != nil ? 0 : inset)
408
+ frame.subviews.forEach { $0.frame = contentFrame }
409
+ let slot = overlaySlots[index].view
410
+ if data.dictionary("image") != nil {
411
+ let circularImage = inset > 0 && width == height
412
+ slot.layer.cornerRadius = circularImage ? min(contentFrame.width, contentFrame.height) / 2 : 0
413
+ slot.clipsToBounds = circularImage
414
+ } else {
415
+ slot.layer.cornerRadius = 0
416
+ slot.clipsToBounds = false
417
+ }
337
418
  }
338
419
  dashedBorder.isHidden = visual.string("borderStyle") != "dashed"
339
420
  dashedBorder.strokeColor =
@@ -346,9 +427,22 @@ final class NativeListLeadingVisual: UIView {
346
427
  UIBezierPath(ovalIn: bounds.insetBy(dx: dashedBorderWidth / 2, dy: dashedBorderWidth / 2))
347
428
  .cgPath
348
429
  }
430
+ /// The pair ring sits above the primary token, so it is shown only while the
431
+ /// secondary token image is actually displayed: hidden while that image loads,
432
+ /// after a failed load and once the slot is recycled, or it would cover the
433
+ /// primary's lower-right corner with a blank row-background disc.
434
+ private func syncPairBackdrop() {
435
+ guard let pairIndex, slots.indices.contains(pairIndex) else {
436
+ pairBackdrop.isHidden = true
437
+ return
438
+ }
439
+ pairBackdrop.isHidden = slots[pairIndex].view.isHidden
440
+ }
441
+
349
442
  func recycle() {
350
443
  slots.forEach { $0.recycle() }
351
444
  overlaySlots.forEach { $0.recycle() }
445
+ pairBackdrop.isHidden = true
352
446
  }
353
447
  /// Empty slot (legacy leading container without a visual): no image, fallback, fill,
354
448
  /// border or overlays from a previous binding.
@@ -364,6 +458,9 @@ final class NativeListLeadingVisual: UIView {
364
458
  icon.image = nil
365
459
  icon.isHidden = true
366
460
  networkBackdrop.isHidden = true
461
+ pairBackdrop.isHidden = true
462
+ networkIndex = nil
463
+ pairIndex = nil
367
464
  corner.isHidden = true
368
465
  cornerBackdrop.isHidden = true
369
466
  unread.isHidden = true