@onekeyfe/react-native-native-list 3.0.179-alpha.302 → 3.0.179-alpha.303

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 (113) hide show
  1. package/README.md +3 -32
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +3 -22
  4. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
  5. package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
  6. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
  7. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
  8. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +1 -6
  9. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
  10. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
  11. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +4 -5
  12. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +7 -8
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
  16. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +15 -28
  17. package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
  18. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
  19. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -3
  20. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +4 -5
  21. package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
  22. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
  24. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +18 -104
  25. package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +5 -6
  26. package/common/fonts/Roobert-Bold.ttf +0 -0
  27. package/common/fonts/Roobert-Medium.ttf +0 -0
  28. package/common/fonts/Roobert-Regular.ttf +0 -0
  29. package/common/fonts/Roobert-SemiBold.ttf +0 -0
  30. package/docs/SPEC.md +19 -69
  31. package/docs/STYLE_SPEC.md +2 -12
  32. package/ios/HybridNativeList.swift +21 -15
  33. package/ios/NativeListAccessoryStack.swift +10 -14
  34. package/ios/NativeListActionRenderer.swift +4 -7
  35. package/ios/NativeListActivityDetailsView.swift +24 -63
  36. package/ios/NativeListActivityRenderer.swift +10 -19
  37. package/ios/NativeListDataRowRenderer.swift +19 -23
  38. package/ios/NativeListDesignAssets.swift +34 -43
  39. package/ios/NativeListIdentityRenderer.swift +19 -23
  40. package/ios/NativeListLeadingVisual.swift +4 -9
  41. package/ios/NativeListMarketRenderer.swift +11 -19
  42. package/ios/NativeListMediaTileRenderer.swift +7 -11
  43. package/ios/NativeListMessageRenderer.swift +10 -20
  44. package/ios/NativeListMetricCardRenderer.swift +12 -16
  45. package/ios/NativeListRailRenderer.swift +7 -9
  46. package/ios/NativeListRendererCell.swift +4 -6
  47. package/ios/NativeListRendererRegistry.swift +3 -8
  48. package/ios/NativeListResolvedText.swift +3 -3
  49. package/ios/NativeListRowHost.swift +2 -7
  50. package/ios/NativeListSectionHeaderRenderer.swift +19 -22
  51. package/ios/NativeListSystemRenderer.swift +16 -18
  52. package/ios/NativeListTextStyles.swift +12 -18
  53. package/ios/NativeListWalletGroupRenderer.swift +4 -6
  54. package/ios/RNCNativeListView.swift +92 -38
  55. package/ios/tests/NativeListActivityPresentationTests.swift +3 -5
  56. package/ios/tests/NativeListLifecycleTests.swift +2 -77
  57. package/lib/module/NativeList.js +24 -8
  58. package/lib/module/NativeList.web.js +3 -8
  59. package/lib/module/index.js +0 -1
  60. package/lib/module/web/NativeListWebEngine.js +24 -48
  61. package/lib/module/web/templates/ActionRowRenderer.js +1 -2
  62. package/lib/module/web/templates/IdentityRowRenderer.js +3 -4
  63. package/lib/module/web/templates/MarketRowRenderer.js +1 -2
  64. package/lib/module/web/templates/RowText.js +3 -13
  65. package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -3
  66. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +18 -9
  67. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -2
  68. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -5
  69. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +8 -2
  70. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +12 -7
  71. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -6
  72. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -1
  73. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +17 -6
  74. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -2
  75. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -2
  76. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -2
  77. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -3
  78. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -1
  79. package/lib/typescript/src/NativeList.nitro.d.ts +2 -1
  80. package/lib/typescript/src/NativeList.types.d.ts +4 -0
  81. package/lib/typescript/src/index.d.ts +0 -2
  82. package/lib/typescript/src/web/NativeListWebEngine.d.ts +1 -4
  83. package/lib/typescript/src/web/templates/RowText.d.ts +0 -1
  84. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +18 -9
  85. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -2
  86. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -5
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +8 -2
  88. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +12 -7
  89. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -6
  90. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -1
  91. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +17 -6
  92. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -2
  93. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -2
  94. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -2
  95. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -3
  96. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -1
  97. package/package.json +5 -4
  98. package/react-native-native-list.podspec +1 -0
  99. package/src/NativeList.nitro.ts +2 -1
  100. package/src/NativeList.tsx +25 -4
  101. package/src/NativeList.types.ts +4 -0
  102. package/src/NativeList.web.tsx +3 -10
  103. package/src/index.ts +0 -3
  104. package/src/web/NativeListWebEngine.ts +24 -53
  105. package/src/web/templates/ActionRowRenderer.ts +1 -2
  106. package/src/web/templates/IdentityRowRenderer.ts +3 -4
  107. package/src/web/templates/MarketRowRenderer.ts +2 -4
  108. package/src/web/templates/RowText.ts +3 -15
  109. package/src/web/templates/SectionHeaderRowRenderer.ts +3 -6
  110. package/LICENSE +0 -36
  111. package/lib/module/fonts.js +0 -44
  112. package/lib/typescript/src/fonts.d.ts +0 -10
  113. package/src/fonts.ts +0 -64
@@ -94,8 +94,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
94
94
  !["summary", "gallery"].contains(item.data.string("variant"))
95
95
  }
96
96
  override class func measure(
97
- _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
98
- fonts: NativeListFontFamilies
97
+ _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String
99
98
  ) -> CGFloat? {
100
99
  if layout == "table" { return 28 }
101
100
  if item.data.string("presentation") == "networkSelector" { return 47 }
@@ -211,7 +210,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
211
210
  label.rowVerticalAlignment = nil
212
211
  }
213
212
  titleLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
214
- subtitleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
213
+ subtitleLabel.font = nativeListFont(ofSize: 14)
215
214
  subtitleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
216
215
  mainStack.alignment = .fill
217
216
  mainStack.spacing = 2
@@ -222,7 +221,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
222
221
  let value = accessoryButtons[0]
223
222
  value.setTitle(nil, for: .normal)
224
223
  value.setAttributedTitle(nil, for: .normal)
225
- value.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium, fonts: fonts)
224
+ value.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium)
226
225
  value.titleLabel?.numberOfLines = 1
227
226
  value.titleLabel?.lineBreakMode = .byTruncatingTail
228
227
  value.contentHorizontalAlignment = .center
@@ -276,13 +275,13 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
276
275
  private func applyTextStyle(_ item: NativeListItem) {
277
276
  let style = item.data.dictionary("style") ?? [:]
278
277
  if let title = style.dictionary("title") {
279
- NativeListTextStyles.applyStyledText(titleLabel, title, fonts: fonts)
278
+ NativeListTextStyles.applyStyledText(titleLabel, title)
280
279
  }
281
280
  if let subtitle = style.dictionary("subtitle") {
282
- NativeListTextStyles.applyStyledText(subtitleLabel, subtitle, fonts: fonts)
281
+ NativeListTextStyles.applyStyledText(subtitleLabel, subtitle)
283
282
  }
284
283
  if let value = style.dictionary("value") {
285
- NativeListTextStyles.applyStyledButton(accessoryButtons[0], value, fonts: fonts)
284
+ NativeListTextStyles.applyStyledButton(accessoryButtons[0], value)
286
285
  }
287
286
  }
288
287
  override func bindSelectionContent(
@@ -306,8 +305,8 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
306
305
  _ checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
307
306
  ) {
308
307
  checkboxControl.bind(
309
- item, descriptors: [descriptor], theme: currentTheme, style: [:], checkboxState: checkboxState,
310
- fonts: fonts)
308
+ item, descriptors: [descriptor], theme: currentTheme, style: [:], checkboxState: checkboxState
309
+ )
311
310
  }
312
311
  override func recycleContent() {
313
312
  checkboxControl.reset()
@@ -383,8 +382,8 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
383
382
  : isGallery || layout == "sectioned" ? .semibold : .regular
384
383
  titleLabel.font = nativeListFont(
385
384
  ofSize: isGallery ? 18 : isSummary ? 16 : isTable ? 11 : isHistory ? 12 : 14,
386
- weight: isHistory ? .semibold : headerWeight,
387
- fonts: fonts)
385
+ weight: isHistory ? .semibold : headerWeight
386
+ )
388
387
  titleLabel.textColor = nativeListColor(
389
388
  theme,
390
389
  isSummary || isGallery ? "primaryText" : "secondaryText",
@@ -422,7 +421,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
422
421
  if layout == "linear" {
423
422
  // TokenManager's section title is a plain body label with mt=10,
424
423
  // unlike the reusable 36-point SectionHeader used by sectioned lists.
425
- titleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
424
+ titleLabel.font = nativeListFont(ofSize: 14)
426
425
  topInset = 10
427
426
  bottomInset = 0
428
427
  }
@@ -483,12 +482,11 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
483
482
  color: nativeListColor(theme, "secondaryText", "#646464")
484
483
  )
485
484
  accessoryButtons[0].titleLabel?.font = nativeListFont(
486
- ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular, fonts: fonts)
485
+ ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular)
487
486
  setButtonLine(
488
487
  accessoryButtons[0],
489
488
  text: item.data.string("value"),
490
- font: nativeListFont(
491
- ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular, fonts: fonts),
489
+ font: nativeListFont(ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular),
492
490
  color: nativeListColor(theme, "secondaryText", "#646464"),
493
491
  lineHeight: 24
494
492
  )
@@ -499,7 +497,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
499
497
  trailingStack.axis = .horizontal
500
498
  trailingStack.alignment = .center
501
499
  trailingStack.spacing = 4
502
- accessoryButtons[0].titleLabel?.font = nativeListFont(ofSize: 11, fonts: fonts)
500
+ accessoryButtons[0].titleLabel?.font = nativeListFont(ofSize: 11)
503
501
  accessoryButtons[0].setTitleColor(
504
502
  nativeListColor(theme, "secondaryText", "#646464"),
505
503
  for: .normal
@@ -537,12 +535,12 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
537
535
  bottomInset = -8
538
536
  accessoryButtons[0].titleLabel?.font = nativeListTabularFont(
539
537
  ofSize: 16,
540
- weight: .medium,
541
- fonts: fonts)
538
+ weight: .medium
539
+ )
542
540
  setButtonLine(
543
541
  accessoryButtons[0],
544
542
  text: item.data.string("value"),
545
- font: nativeListTabularFont(ofSize: 16, weight: .medium, fonts: fonts),
543
+ font: nativeListTabularFont(ofSize: 16, weight: .medium),
546
544
  color: nativeListColor(theme, "primaryText", "#202020"),
547
545
  lineHeight: 24
548
546
  )
@@ -643,7 +641,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
643
641
  }
644
642
  for segment in segments {
645
643
  attributes[.font] = nativeListTabularFont(
646
- ofSize: segment.string("style") == "subscript" ? 10 : 16, weight: .medium, fonts: fonts)
644
+ ofSize: segment.string("style") == "subscript" ? 10 : 16, weight: .medium)
647
645
  value.append(NSAttributedString(string: segment.string("text"), attributes: attributes))
648
646
  }
649
647
  button.setAttributedTitle(value, for: .normal)
@@ -681,8 +679,7 @@ final class NativeListSectionHeaderCell: NativeListRendererCell {
681
679
  setButtonLine(
682
680
  valueButton,
683
681
  text: value,
684
- font: nativeListFont(
685
- ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular, fonts: fonts),
682
+ font: nativeListFont(ofSize: 16, weight: isExplicitNetworkHeader ? .medium : .regular),
686
683
  color: nativeListColor(currentTheme, "secondaryText", "#646464"),
687
684
  lineHeight: 24
688
685
  )
@@ -2,10 +2,9 @@ import UIKit
2
2
 
3
3
  final class NativeListSystemCell: NativeListRendererCell {
4
4
  override class func measure(
5
- _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
6
- fonts: NativeListFontFamilies
5
+ _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String
7
6
  ) -> CGFloat? {
8
- return NativeListSystemRenderer.measure(item, width: width, fonts: fonts)
7
+ return NativeListSystemRenderer.measure(item, width: width)
9
8
  }
10
9
  override class func appliesSizePreset(_ item: NativeListItem) -> Bool {
11
10
  NativeListSystemRenderer.appliesSizePreset(item)
@@ -76,8 +75,7 @@ final class NativeListSystemCell: NativeListRendererCell {
76
75
  label.text = nil
77
76
  label.isHidden = true
78
77
  label.font = nativeListFont(
79
- ofSize: label === titleLabel ? 16 : 14, weight: label === titleLabel ? .medium : .regular,
80
- fonts: fonts)
78
+ ofSize: label === titleLabel ? 16 : 14, weight: label === titleLabel ? .medium : .regular)
81
79
  label.textColor = nativeListColor(
82
80
  theme, label === titleLabel ? "primaryText" : "secondaryText",
83
81
  label === titleLabel ? "#202020" : "#646464")
@@ -92,7 +90,7 @@ final class NativeListSystemCell: NativeListRendererCell {
92
90
  button.setAttributedTitle(nil, for: .normal)
93
91
  button.setTitle(nil, for: .normal)
94
92
  button.isHidden = true
95
- button.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium, fonts: fonts)
93
+ button.titleLabel?.font = nativeListFont(ofSize: 16, weight: .medium)
96
94
  button.titleLabel?.numberOfLines = 1
97
95
  button.contentEdgeInsets = .zero
98
96
  button.contentHorizontalAlignment = .center
@@ -118,13 +116,13 @@ final class NativeListSystemCell: NativeListRendererCell {
118
116
  if style["trailingGap"] != nil { trailingStack.spacing = CGFloat(style.double("trailingGap")) }
119
117
  let warning = item.data.string("variant") == "warning"
120
118
  if warning, let text = style.dictionary("title") {
121
- NativeListTextStyles.applyStyledText(titleLabel, text, fonts: fonts)
119
+ NativeListTextStyles.applyStyledText(titleLabel, text)
122
120
  }
123
121
  if let text = style.dictionary("message") {
124
- NativeListTextStyles.applyStyledText(warning ? subtitleLabel : titleLabel, text, fonts: fonts)
122
+ NativeListTextStyles.applyStyledText(warning ? subtitleLabel : titleLabel, text)
125
123
  }
126
124
  if let text = style.dictionary("actionText") {
127
- NativeListTextStyles.applyStyledButton(button, text, fonts: fonts)
125
+ NativeListTextStyles.applyStyledButton(button, text)
128
126
  }
129
127
  contentInsets = UIEdgeInsets(
130
128
  top: topInset, left: leftInset, bottom: -bottomInset, right: -rightInset)
@@ -231,7 +229,7 @@ final class NativeListSystemCell: NativeListRendererCell {
231
229
  bottomInset = -(height - top - (message.isEmpty ? 30 : 61))
232
230
  if !message.isEmpty {
233
231
  show(titleLabel, message, lines: 2)
234
- titleLabel.font = nativeListTabularFont(ofSize: 16, fonts: fonts)
232
+ titleLabel.font = nativeListTabularFont(ofSize: 16)
235
233
  titleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
236
234
  titleLabel.textAlignment = .center
237
235
  setLineHeight(titleLabel, text: message, lineHeight: 24)
@@ -242,7 +240,7 @@ final class NativeListSystemCell: NativeListRendererCell {
242
240
  button.backgroundColor = .clear
243
241
  button.layer.cornerRadius = 15
244
242
  setButtonLine(
245
- button, text: text, font: nativeListTabularFont(ofSize: 14, weight: .medium, fonts: fonts),
243
+ button, text: text, font: nativeListTabularFont(ofSize: 14, weight: .medium),
246
244
  color: nativeListColor(theme, "secondaryText", "#646464"), lineHeight: 20)
247
245
  let textWidth = button.intrinsicContentSize.width
248
246
  selectorConstraints.append(contentsOf: [
@@ -286,7 +284,7 @@ final class NativeListSystemCell: NativeListRendererCell {
286
284
  root.addArrangedSubview(mainStack)
287
285
  mainStack.alignment = .center
288
286
  mainStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
289
- titleLabel.font = nativeListTabularFont(ofSize: 16, fonts: fonts)
287
+ titleLabel.font = nativeListTabularFont(ofSize: 16)
290
288
  titleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
291
289
  titleLabel.textAlignment = .center
292
290
  show(titleLabel, item.data.string("message"), lines: 1)
@@ -326,9 +324,9 @@ final class NativeListSystemCell: NativeListRendererCell {
326
324
  topInset = 14
327
325
  bottomInset = -14
328
326
  mainStack.spacing = 4
329
- titleLabel.font = nativeListFont(ofSize: 14, weight: .medium, fonts: fonts)
327
+ titleLabel.font = nativeListFont(ofSize: 14, weight: .medium)
330
328
  titleLabel.numberOfLines = 0
331
- subtitleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
329
+ subtitleLabel.font = nativeListFont(ofSize: 14)
332
330
  subtitleLabel.numberOfLines = 0
333
331
  show(titleLabel, item.data.string("title"), lines: 0)
334
332
  show(subtitleLabel, item.data.string("message"), lines: 0)
@@ -377,7 +375,7 @@ final class NativeListSystemCell: NativeListRendererCell {
377
375
  mainStack.alignment = variant == "loading" || alignsToStart ? .leading : .center
378
376
  if alignsToStart {
379
377
  mainStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
380
- titleLabel.font = nativeListFont(ofSize: 14, fonts: fonts)
378
+ titleLabel.font = nativeListFont(ofSize: 14)
381
379
  titleLabel.textColor = nativeListColor(theme, "secondaryText", "#646464")
382
380
  setLineHeight(titleLabel, text: titleLabel.text ?? "", lineHeight: 20)
383
381
  }
@@ -390,7 +388,7 @@ final class NativeListSystemCell: NativeListRendererCell {
390
388
  setButtonLine(
391
389
  accessoryButtons[0],
392
390
  text: "Retry",
393
- font: nativeListFont(ofSize: 14, weight: .medium, fonts: fonts),
391
+ font: nativeListFont(ofSize: 14, weight: .medium),
394
392
  color: nativeListColor(theme, "primaryText", "#202020"),
395
393
  lineHeight: 20
396
394
  )
@@ -514,7 +512,7 @@ enum NativeListSystemRenderer {
514
512
  static func appliesSizePreset(_ item: NativeListItem) -> Bool {
515
513
  !["warning", "spacer"].contains(item.data.string("variant"))
516
514
  }
517
- static func measure(_ item: NativeListItem, width: CGFloat, fonts: NativeListFontFamilies) -> CGFloat {
515
+ static func measure(_ item: NativeListItem, width: CGFloat) -> CGFloat {
518
516
  if item.type == "system", item.data.string("variant") == "spacer" {
519
517
  return CGFloat(item.data.int("height"))
520
518
  }
@@ -538,7 +536,7 @@ enum NativeListSystemRenderer {
538
536
  .font: nativeListFont(
539
537
  ofSize: fontSize,
540
538
  weight: NativeListTextStyles.marketFontWeight(
541
- textStyle?.string("fontWeight") ?? "", fallback: weight), fonts: fonts),
539
+ textStyle?.string("fontWeight") ?? "", fallback: weight)),
542
540
  .paragraphStyle: paragraph,
543
541
  ], context: nil
544
542
  ).height / lineHeight)
@@ -3,23 +3,21 @@ import UIKit
3
3
 
4
4
  // Apply semantic overrides after a renderer has restored its resolved defaults.
5
5
  enum NativeListTextStyles {
6
- static func applyStyledText(
7
- _ label: UILabel, _ style: [String: Any], fonts: NativeListFontFamilies
8
- ) {
6
+ static func applyStyledText(_ label: UILabel, _ style: [String: Any]) {
9
7
  let text = label.attributedText?.string ?? label.text ?? ""
10
8
  guard !text.isEmpty, !style.isEmpty else { return }
11
9
  let originalText = label.attributedText
12
10
  let textLabel = label as? NativeListTextLabel
13
11
  let baseFont =
14
12
  (originalText?.attribute(.font, at: 0, effectiveRange: nil) as? UIFont) ?? label.font
15
- ?? nativeListFont(ofSize: 14, fonts: fonts)
13
+ ?? nativeListFont(ofSize: 14)
16
14
  let size = CGFloat(style.double("fontSize", default: Double(baseFont.pointSize)))
17
15
  let font: UIFont
18
16
  if let weightName = style["fontWeight"] as? String {
19
17
  font = nativeListFont(
20
18
  ofSize: size,
21
- weight: marketFontWeight(weightName, fallback: .regular),
22
- fonts: fonts)
19
+ weight: marketFontWeight(weightName, fallback: .regular)
20
+ )
23
21
  } else {
24
22
  font = baseFont.withSize(size)
25
23
  }
@@ -55,7 +53,7 @@ enum NativeListTextStyles {
55
53
  paragraph.lineBreakMode = label.lineBreakMode
56
54
  }
57
55
  var attributes: [NSAttributedString.Key: Any] = [:]
58
- applyStyledFont(attributed, style, fallback: baseFont, fonts: fonts)
56
+ applyStyledFont(attributed, style, fallback: baseFont)
59
57
  if style["color"] != nil { attributes[.foregroundColor] = color }
60
58
  if style["alignment"] != nil || style["lines"] != nil || style["truncate"] != nil
61
59
  || style["lineHeight"] != nil
@@ -76,9 +74,7 @@ enum NativeListTextStyles {
76
74
  label.attributedText = attributed
77
75
  }
78
76
 
79
- static func applyStyledButton(
80
- _ button: UIButton, _ style: [String: Any], fonts: NativeListFontFamilies
81
- ) {
77
+ static func applyStyledButton(_ button: UIButton, _ style: [String: Any]) {
82
78
  let text =
83
79
  button.attributedTitle(for: .normal)?.string
84
80
  ?? button.title(for: .normal)
@@ -88,14 +84,14 @@ enum NativeListTextStyles {
88
84
  let accessory = button as? NativeListAccessoryButton
89
85
  let baseFont =
90
86
  (originalText?.attribute(.font, at: 0, effectiveRange: nil) as? UIFont) ?? button.titleLabel?
91
- .font ?? nativeListFont(ofSize: 14, fonts: fonts)
87
+ .font ?? nativeListFont(ofSize: 14)
92
88
  let size = CGFloat(style.double("fontSize", default: Double(baseFont.pointSize)))
93
89
  let font: UIFont
94
90
  if let weightName = style["fontWeight"] as? String {
95
91
  font = nativeListFont(
96
92
  ofSize: size,
97
- weight: marketFontWeight(weightName, fallback: .regular),
98
- fonts: fonts)
93
+ weight: marketFontWeight(weightName, fallback: .regular)
94
+ )
99
95
  } else {
100
96
  font = baseFont.withSize(size)
101
97
  }
@@ -120,7 +116,7 @@ enum NativeListTextStyles {
120
116
  : alignmentName == "end" ? .trailing : .center
121
117
  }
122
118
  var attributes: [NSAttributedString.Key: Any] = [:]
123
- applyStyledFont(attributed, style, fallback: baseFont, fonts: fonts)
119
+ applyStyledFont(attributed, style, fallback: baseFont)
124
120
  if style["color"] != nil { attributes[.foregroundColor] = color }
125
121
  if style["alignment"] != nil || style["lineHeight"] != nil || style["lines"] != nil
126
122
  || style["truncate"] != nil
@@ -157,8 +153,7 @@ enum NativeListTextStyles {
157
153
  }
158
154
 
159
155
  static func applyStyledFont(
160
- _ text: NSMutableAttributedString, _ style: [String: Any], fallback: UIFont,
161
- fonts: NativeListFontFamilies
156
+ _ text: NSMutableAttributedString, _ style: [String: Any], fallback: UIFont
162
157
  ) {
163
158
  guard style["fontSize"] != nil || style["fontWeight"] != nil else { return }
164
159
  text.enumerateAttribute(.font, in: NSRange(location: 0, length: text.length)) {
@@ -169,8 +164,7 @@ enum NativeListTextStyles {
169
164
  style["fontWeight"] == nil
170
165
  ? original.withSize(size)
171
166
  : nativeListFont(
172
- ofSize: size, weight: marketFontWeight(style.string("fontWeight"), fallback: .regular),
173
- fonts: fonts)
167
+ ofSize: size, weight: marketFontWeight(style.string("fontWeight"), fallback: .regular))
174
168
  text.addAttribute(.font, value: font, range: range)
175
169
  }
176
170
  }
@@ -55,8 +55,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
55
55
  }
56
56
  override class func appliesSizePreset(_ item: NativeListItem) -> Bool { false }
57
57
  override class func measure(
58
- _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
59
- fonts: NativeListFontFamilies
58
+ _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String
60
59
  ) -> CGFloat? {
61
60
  let members = memberItems(item)
62
61
  return members.reduce(
@@ -77,7 +76,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
77
76
  dragBadge.translatesAutoresizingMaskIntoConstraints = false
78
77
  dragBadge.horizontalInset = 6
79
78
  dragBadge.textAlignment = .center
80
- dragBadge.font = nativeListTabularFont(ofSize: 12, weight: .semibold, fonts: fonts)
79
+ dragBadge.font = nativeListTabularFont(ofSize: 12, weight: .semibold)
81
80
  dragBadge.layer.cornerRadius = 12
82
81
  dragBadge.layer.masksToBounds = true
83
82
  dragBadge.layer.borderWidth = 1
@@ -102,7 +101,6 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
102
101
  _ item: NativeListItem, theme: [String: Any]?, layout: String,
103
102
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
104
103
  ) {
105
- dragBadge.font = nativeListTabularFont(ofSize: 12, weight: .semibold, fonts: fonts)
106
104
  members = Self.memberItems(item)
107
105
  let keys = Set(members.map(\.key))
108
106
  for key in Array(memberViews.keys) where !keys.contains(key) {
@@ -136,7 +134,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
136
134
  view.cell.listStyle = listStyle
137
135
  view.cell.bind(
138
136
  item: member, theme: theme, layout: layout, selected: member.data.bool("selected"),
139
- checkboxState: checkboxState, fonts: fonts)
137
+ checkboxState: checkboxState)
140
138
  root.insertArrangedSubview(view.cell, at: index)
141
139
  }
142
140
  if let parent = members.first {
@@ -155,7 +153,7 @@ final class NativeListWalletGroupCell: NativeListRendererCell, UIGestureRecogniz
155
153
  compactCell?.listStyle = listStyle
156
154
  compactCell?.bind(
157
155
  item: parent, theme: theme, layout: layout, selected: parent.data.bool("selected"),
158
- checkboxState: checkboxState, fonts: fonts)
156
+ checkboxState: checkboxState)
159
157
  }
160
158
  let count = members.dropFirst().filter { ($0.data["draggable"] as? Bool) != false }.count
161
159
  dragBadge.text = count > 0 ? "+\(count)" : nil
@@ -4,26 +4,6 @@ import UIKit
4
4
  import UniformTypeIdentifiers
5
5
 
6
6
  final class NativeListView: UIView {
7
- private var fonts = NativeListFontFamilies()
8
-
9
- func setFontFamiliesJson(_ json: String) {
10
- guard let next = NativeListFontFamilies(json: json), next != fonts else { return }
11
- fonts = next
12
- if interactiveReorderSource != nil { cancelInteractiveReorderForStructuralUpdate() }
13
- sectionIndexView.refreshFonts(fonts)
14
- sectionIndexPreview.refreshFonts(fonts)
15
- invalidateActionAnchor(reason: "layout")
16
- configureFooterIfPresent()
17
- var snapshot = dataSource.snapshot()
18
- snapshot.reconfigureItems(snapshot.itemIdentifiers)
19
- dataSource.apply(snapshot, animatingDifferences: false)
20
- flowLayout.invalidateLayout()
21
- setNeedsLayout()
22
- }
23
-
24
- private func configureFooterIfPresent() {
25
- if let config { configureFooter(config) }
26
- }
27
7
  private var refreshEmittedForDrag = false
28
8
  private var minimumDragOffset: CGFloat = 0
29
9
  private var containerSlotHeights: [CGFloat] = [0, 0, 0]
@@ -31,11 +11,27 @@ final class NativeListView: UIView {
31
11
  // Each root therefore lives in a list-owned host whose origin the list alone controls, so a
32
12
  // React layout update can never move a slot out of its native position, even for a frame.
33
13
  private var reactContainerSlots: [(content: UIView, host: UIView)] = []
14
+ private let topOverlayHost = UIView()
15
+ private weak var topOverlayContent: UIView?
16
+ private var topEdgeInteraction: UIInteraction?
17
+ private var topEdgeMarker: UILabel?
18
+ private var originalTopEdgeStyle: AnyObject?
19
+ private var topScrollEdgeHard = false
20
+ private var requestedTopOverlayHeight: CGFloat = 0
21
+ private var appliedTopOverlayInset: CGFloat = 0
22
+
34
23
  private var lastLaidOutContentHeight: CGFloat?
35
24
  private var needsContentShrinkCorrection = false
36
25
  private var contentShrinkCorrectionScheduled = false
37
26
 
38
27
  @objc func mountContainerSlot(_ view: UIView, atIndex index: Int) {
28
+ if index == 3 {
29
+ topOverlayContent?.removeFromSuperview()
30
+ topOverlayContent = view
31
+ topOverlayHost.addSubview(view)
32
+ updateTopScrollEdge()
33
+ return
34
+ }
39
35
  let host = UIView()
40
36
  // Clipping to the reported height keeps new content from overlapping rows until the list
41
37
  // has reserved space for it.
@@ -48,6 +44,12 @@ final class NativeListView: UIView {
48
44
  }
49
45
 
50
46
  @objc func unmountContainerSlot(_ view: UIView) {
47
+ if topOverlayContent === view {
48
+ view.removeFromSuperview()
49
+ topOverlayContent = nil
50
+ updateTopScrollEdge()
51
+ return
52
+ }
51
53
  reactContainerSlots.removeAll { slot in
52
54
  guard slot.content === view else { return false }
53
55
  view.removeFromSuperview()
@@ -56,6 +58,66 @@ final class NativeListView: UIView {
56
58
  }
57
59
  }
58
60
 
61
+ func setTopScrollEdge(hard: Bool, overlayHeight: CGFloat) {
62
+ topScrollEdgeHard = hard
63
+ requestedTopOverlayHeight = overlayHeight.isFinite ? max(0, overlayHeight) : 0
64
+ updateTopScrollEdge()
65
+ setNeedsLayout()
66
+ }
67
+
68
+ private func updateTopScrollEdge() {
69
+ if #available(iOS 26.0, *) {
70
+ let hasOverlay = topScrollEdgeHard && topOverlayContent != nil
71
+ let enabled = hasOverlay && window != nil
72
+ let nextInset = hasOverlay ? requestedTopOverlayHeight : 0
73
+ if nextInset != appliedTopOverlayInset {
74
+ // Do not interrupt UIKit's rebound after a refresh has ended.
75
+ let wasReturningFromPull =
76
+ collectionView.contentOffset.y < -collectionView.adjustedContentInset.top - 0.5
77
+ let logicalOffset = collectionView.contentOffset.y + collectionView.contentInset.top
78
+ var inset = collectionView.contentInset
79
+ inset.top += nextInset - appliedTopOverlayInset
80
+ collectionView.contentInset = inset
81
+ appliedTopOverlayInset = nextInset
82
+ if !wasReturningFromPull {
83
+ collectionView.setContentOffset(
84
+ CGPoint(x: collectionView.contentOffset.x, y: logicalOffset - inset.top),
85
+ animated: false)
86
+ }
87
+ }
88
+ if enabled && topEdgeInteraction == nil {
89
+ originalTopEdgeStyle = collectionView.topEdgeEffect.style
90
+ // UIKit needs a native element to shape the edge effect around React-drawn content.
91
+ let marker = UILabel(frame: topOverlayHost.bounds)
92
+ marker.autoresizingMask = [.flexibleWidth, .flexibleHeight]
93
+ marker.text = " "
94
+ marker.textColor = .clear
95
+ marker.backgroundColor = .clear
96
+ marker.isUserInteractionEnabled = false
97
+ marker.isAccessibilityElement = false
98
+ marker.accessibilityElementsHidden = true
99
+ topOverlayHost.addSubview(marker)
100
+ topEdgeMarker = marker
101
+ let interaction = UIScrollEdgeElementContainerInteraction()
102
+ interaction.edge = .top
103
+ interaction.scrollView = collectionView
104
+ topOverlayHost.addInteraction(interaction)
105
+ topEdgeInteraction = interaction
106
+ } else if !enabled, let interaction = topEdgeInteraction {
107
+ topOverlayHost.removeInteraction(interaction)
108
+ (interaction as? UIScrollEdgeElementContainerInteraction)?.scrollView = nil
109
+ topEdgeInteraction = nil
110
+ topEdgeMarker?.removeFromSuperview()
111
+ topEdgeMarker = nil
112
+ if let originalTopEdgeStyle = originalTopEdgeStyle as? UIScrollEdgeEffect.Style {
113
+ collectionView.topEdgeEffect.style = originalTopEdgeStyle
114
+ }
115
+ originalTopEdgeStyle = nil
116
+ }
117
+ if enabled { collectionView.topEdgeEffect.style = .hard }
118
+ }
119
+ }
120
+
59
121
  func setContainerSlotHeightsJson(_ json: String) {
60
122
  guard let data = json.data(using: .utf8),
61
123
  let heights = try? JSONSerialization.jsonObject(with: data) as? [Double],
@@ -291,6 +353,7 @@ final class NativeListView: UIView {
291
353
  addSubview(footerContainer)
292
354
  addSubview(sectionIndexView)
293
355
  addSubview(sectionIndexPreview)
356
+ addSubview(topOverlayHost)
294
357
  footerContainer.addSubview(footerCell)
295
358
  collectionView.translatesAutoresizingMaskIntoConstraints = false
296
359
  footerContainer.translatesAutoresizingMaskIntoConstraints = false
@@ -442,11 +505,14 @@ final class NativeListView: UIView {
442
505
 
443
506
  override func didMoveToWindow() {
444
507
  super.didMoveToWindow()
508
+ updateTopScrollEdge()
445
509
  updateSectionIndexAttachment()
446
510
  }
447
511
 
448
512
  override func layoutSubviews() {
449
513
  super.layoutSubviews()
514
+ topOverlayHost.frame = CGRect(x: 0, y: 0, width: collectionView.bounds.width,
515
+ height: requestedTopOverlayHeight)
450
516
  updateSectionIndexAttachment()
451
517
  let direction = effectiveUserInterfaceLayoutDirection
452
518
  if let lastLayoutSize,
@@ -1600,8 +1666,7 @@ final class NativeListView: UIView {
1600
1666
  selected: item.data.bool("selected") || config.selectedKeys.contains(item.key),
1601
1667
  checkboxState: { [weak self] item, target, fallback in
1602
1668
  self?.resolveCheckboxState(item: item, target: target, fallback: fallback) ?? fallback
1603
- },
1604
- fonts: fonts
1669
+ }
1605
1670
  )
1606
1671
  if item.key == interactiveReorderCompactKey {
1607
1672
  cell.setWalletGroupReorderCompact(true)
@@ -1964,9 +2029,7 @@ final class NativeListView: UIView {
1964
2029
  ? floor((availableWidth - CGFloat((config?.gridColumns ?? 2) - 1) * (config?.itemSpacing ?? 0)) / CGFloat(config?.gridColumns ?? 2))
1965
2030
  : availableWidth
1966
2031
  let rowWidth = allocatedWidth ?? (config?.orientation == "horizontal" ? 280 : columnWidth)
1967
- if let height = NativeListRendererRegistry.measure(
1968
- item, width: rowWidth, theme: config?.theme, layout: config?.layout ?? "linear", fonts: fonts)
1969
- {
2032
+ if let height = NativeListRendererRegistry.measure(item, width: rowWidth, theme: config?.theme, layout: config?.layout ?? "linear") {
1970
2033
  return max(0, height + (NativeListRendererRegistry.appliesSizePreset(item) ? (item.data.string("size") == "small" ? -8 : item.data.string("size") == "large" ? 12 : 0) : 0))
1971
2034
  }
1972
2035
  return 56
@@ -2021,6 +2084,7 @@ final class NativeListView: UIView {
2021
2084
 
2022
2085
  func dispose() {
2023
2086
  guard !disposed else { return }
2087
+ setTopScrollEdge(hard: false, overlayHeight: 0)
2024
2088
  disposed = true
2025
2089
 
2026
2090
  disposeActionAnchor()
@@ -2347,7 +2411,7 @@ extension NativeListView: UICollectionViewDelegateFlowLayout {
2347
2411
  }
2348
2412
 
2349
2413
  private func railWidth(_ item: NativeListItem) -> CGFloat {
2350
- NativeListRailRenderer.Resolved(item, theme: config?.theme, fonts: fonts).horizontalWidth
2414
+ NativeListRailRenderer.Resolved(item, theme: config?.theme).horizontalWidth
2351
2415
  }
2352
2416
 
2353
2417
  func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
@@ -2600,11 +2664,6 @@ private struct NativeListSectionIndexEntry {
2600
2664
  }
2601
2665
 
2602
2666
  private final class NativeListSectionIndexPreviewView: UIView {
2603
- private var fonts = NativeListFontFamilies()
2604
- func refreshFonts(_ fonts: NativeListFontFamilies) {
2605
- self.fonts = fonts
2606
- label.font = nativeListFont(ofSize: 30, fonts: fonts)
2607
- }
2608
2667
  private let shapeLayer = CAShapeLayer()
2609
2668
  private let label = UILabel()
2610
2669
 
@@ -2620,7 +2679,7 @@ private final class NativeListSectionIndexPreviewView: UIView {
2620
2679
  layer.addSublayer(shapeLayer)
2621
2680
  label.textAlignment = .center
2622
2681
  label.adjustsFontForContentSizeCategory = true
2623
- label.font = nativeListFont(ofSize: 30, fonts: fonts)
2682
+ label.font = nativeListFont(ofSize: 30)
2624
2683
  label.isAccessibilityElement = false
2625
2684
  addSubview(label)
2626
2685
  }
@@ -2675,11 +2734,6 @@ private final class NativeListSectionIndexPreviewView: UIView {
2675
2734
  // OneKey patch: arbitrate index scrubbing against ancestor dismissal gestures.
2676
2735
  // private final class NativeListSectionIndexView: UIControl {
2677
2736
  private final class NativeListSectionIndexView: UIControl, UIGestureRecognizerDelegate {
2678
- private var fonts = NativeListFontFamilies()
2679
- func refreshFonts(_ fonts: NativeListFontFamilies) {
2680
- self.fonts = fonts
2681
- updateLabelStyles()
2682
- }
2683
2737
  private static let edgePadding: CGFloat = 8
2684
2738
  private static let labelSize: CGFloat = 14
2685
2739
  private static let labelSpacing: CGFloat = 16
@@ -2897,7 +2951,7 @@ private final class NativeListSectionIndexView: UIControl, UIGestureRecognizerDe
2897
2951
  label.backgroundColor = active ? activeColor : .clear
2898
2952
  label.layer.cornerRadius = Self.labelSize / 2
2899
2953
  label.layer.masksToBounds = active
2900
- label.font = nativeListFont(ofSize: 10, weight: active ? .medium : .regular, fonts: fonts)
2954
+ label.font = nativeListFont(ofSize: 10, weight: active ? .medium : .regular)
2901
2955
  }
2902
2956
  }
2903
2957
  }
@@ -21,7 +21,7 @@ final class NativeListActivityPresentationTests: XCTestCase {
21
21
  ],
22
22
  ])
23
23
  let view = NativeListActivityDetailsView()
24
- view.bind(item, theme: nil, fonts: NativeListFontFamilies())
24
+ view.bind(item, theme: nil)
25
25
  func labels(in view: UIView) -> [UILabel] {
26
26
  (view as? UILabel).map { [$0] } ?? view.subviews.flatMap { labels(in: $0) }
27
27
  }
@@ -87,13 +87,11 @@ final class NativeListActivityPresentationTests: XCTestCase {
87
87
  view.trailingAnchor.constraint(equalTo: container.trailingAnchor),
88
88
  view.topAnchor.constraint(equalTo: container.topAnchor),
89
89
  ])
90
- view.bind(item, theme: nil, fonts: NativeListFontFamilies())
90
+ view.bind(item, theme: nil)
91
91
  container.layoutIfNeeded()
92
92
  container.layoutIfNeeded()
93
93
  let rendered = ceil(view.frame.height) + vertical * 2
94
- XCTAssertEqual(
95
- NativeListActivityDetailsView.measure(data, width: width, fonts: NativeListFontFamilies()),
96
- rendered, accuracy: 1, name)
94
+ XCTAssertEqual(NativeListActivityDetailsView.measure(data, width: width), rendered, accuracy: 1, name)
97
95
  }
98
96
  }
99
97
  }