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

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/LICENSE +36 -0
  2. package/README.md +32 -3
  3. package/android/build.gradle +0 -1
  4. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +22 -3
  5. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
  6. package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
  7. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
  8. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
  9. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +6 -1
  10. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
  11. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
  12. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -4
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +8 -7
  16. package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
  17. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +28 -15
  18. package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
  19. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
  20. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +3 -2
  21. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -4
  22. package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
  24. package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
  25. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +104 -18
  26. package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +6 -5
  27. package/docs/SPEC.md +69 -19
  28. package/docs/STYLE_SPEC.md +12 -2
  29. package/ios/HybridNativeList.swift +15 -21
  30. package/ios/NativeListAccessoryStack.swift +14 -10
  31. package/ios/NativeListActionRenderer.swift +7 -4
  32. package/ios/NativeListActivityDetailsView.swift +63 -24
  33. package/ios/NativeListActivityRenderer.swift +19 -10
  34. package/ios/NativeListDataRowRenderer.swift +23 -19
  35. package/ios/NativeListDesignAssets.swift +43 -34
  36. package/ios/NativeListIdentityRenderer.swift +23 -19
  37. package/ios/NativeListLeadingVisual.swift +9 -4
  38. package/ios/NativeListMarketRenderer.swift +19 -11
  39. package/ios/NativeListMediaTileRenderer.swift +11 -7
  40. package/ios/NativeListMessageRenderer.swift +20 -10
  41. package/ios/NativeListMetricCardRenderer.swift +16 -12
  42. package/ios/NativeListRailRenderer.swift +9 -7
  43. package/ios/NativeListRendererCell.swift +6 -4
  44. package/ios/NativeListRendererRegistry.swift +8 -3
  45. package/ios/NativeListResolvedText.swift +3 -3
  46. package/ios/NativeListRowHost.swift +7 -2
  47. package/ios/NativeListSectionHeaderRenderer.swift +22 -19
  48. package/ios/NativeListSystemRenderer.swift +18 -16
  49. package/ios/NativeListTextStyles.swift +18 -12
  50. package/ios/NativeListWalletGroupRenderer.swift +6 -4
  51. package/ios/RNCNativeListView.swift +38 -92
  52. package/ios/tests/NativeListActivityPresentationTests.swift +5 -3
  53. package/ios/tests/NativeListLifecycleTests.swift +77 -2
  54. package/lib/module/NativeList.js +8 -24
  55. package/lib/module/NativeList.web.js +8 -3
  56. package/lib/module/fonts.js +44 -0
  57. package/lib/module/index.js +1 -0
  58. package/lib/module/web/NativeListWebEngine.js +48 -24
  59. package/lib/module/web/templates/ActionRowRenderer.js +2 -1
  60. package/lib/module/web/templates/IdentityRowRenderer.js +4 -3
  61. package/lib/module/web/templates/MarketRowRenderer.js +2 -1
  62. package/lib/module/web/templates/RowText.js +13 -3
  63. package/lib/module/web/templates/SectionHeaderRowRenderer.js +3 -2
  64. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
  65. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
  66. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
  67. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
  68. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
  69. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
  70. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
  71. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
  72. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
  73. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
  74. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
  75. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
  76. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
  77. package/lib/typescript/src/NativeList.nitro.d.ts +1 -2
  78. package/lib/typescript/src/NativeList.types.d.ts +0 -4
  79. package/lib/typescript/src/fonts.d.ts +10 -0
  80. package/lib/typescript/src/index.d.ts +2 -0
  81. package/lib/typescript/src/web/NativeListWebEngine.d.ts +4 -1
  82. package/lib/typescript/src/web/templates/RowText.d.ts +1 -0
  83. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
  84. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
  85. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
  87. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
  88. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
  89. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
  90. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
  91. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
  92. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
  93. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
  94. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
  95. package/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
  96. package/package.json +4 -5
  97. package/react-native-native-list.podspec +0 -1
  98. package/src/NativeList.nitro.ts +1 -2
  99. package/src/NativeList.tsx +4 -25
  100. package/src/NativeList.types.ts +0 -4
  101. package/src/NativeList.web.tsx +10 -3
  102. package/src/fonts.ts +64 -0
  103. package/src/index.ts +3 -0
  104. package/src/web/NativeListWebEngine.ts +53 -24
  105. package/src/web/templates/ActionRowRenderer.ts +2 -1
  106. package/src/web/templates/IdentityRowRenderer.ts +4 -3
  107. package/src/web/templates/MarketRowRenderer.ts +4 -2
  108. package/src/web/templates/RowText.ts +15 -3
  109. package/src/web/templates/SectionHeaderRowRenderer.ts +6 -3
  110. package/common/fonts/Roobert-Bold.ttf +0 -0
  111. package/common/fonts/Roobert-Medium.ttf +0 -0
  112. package/common/fonts/Roobert-Regular.ttf +0 -0
  113. package/common/fonts/Roobert-SemiBold.ttf +0 -0
@@ -15,9 +15,9 @@ import com.facebook.react.uimanager.ThemedReactContext
15
15
  import org.json.JSONArray
16
16
  import org.json.JSONObject
17
17
 
18
- internal class NativeListMetricCardRowView(context: ThemedReactContext) :
19
- NativeListRendererRowView(context) {
20
- private val visual = NativeListLeadingVisual(context)
18
+ internal class NativeListMetricCardRowView(context: ThemedReactContext, fonts: NativeListFonts) :
19
+ NativeListRendererRowView(context, fonts) {
20
+ private val visual = NativeListLeadingVisual(context, fonts)
21
21
  private val column = LinearLayout(context).apply { orientation = VERTICAL }
22
22
  private val titleLine =
23
23
  LinearLayout(context).apply {
@@ -136,7 +136,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
136
136
  ink: Int = color(theme, "secondaryText", "#0000009B"),
137
137
  ) {
138
138
  NativeListResolvedText.resolve(
139
- context,
139
+ context, fonts,
140
140
  value,
141
141
  style.optJSONObject(slot),
142
142
  size,
@@ -157,7 +157,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
157
157
  if (heading != null) {
158
158
  val spacing = heading.letterSpacing
159
159
  NativeListResolvedText.resolve(
160
- context,
160
+ context, fonts,
161
161
  data.optString("title").uppercase(),
162
162
  style.optJSONObject("title"),
163
163
  11f,
@@ -229,7 +229,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
229
229
  )
230
230
  text(detail, data.optString("subtitle"), "subtitle", 14f)
231
231
  NativeListResolvedText.resolve(
232
- context,
232
+ context, fonts,
233
233
  data.optJSONObject("badge")?.optString("text") ?: "",
234
234
  null,
235
235
  12f,
@@ -282,7 +282,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
282
282
  value = item.json.optString("title").uppercase(),
283
283
  size = 11f,
284
284
  lineHeight = 14,
285
- typeface = NativeListFonts.regular(context),
285
+ typeface = fonts.regular(context),
286
286
  textColor = color(theme, "disabledText", "#00000072"),
287
287
  letterSpacingDp = 1.2f,
288
288
  )
@@ -313,7 +313,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
313
313
  alignment = Gravity.START,
314
314
  valueSize = 18f,
315
315
  valueLineHeight = 24,
316
- valueTypeface = NativeListFonts.semibold(context),
316
+ valueTypeface = fonts.semibold(context),
317
317
  ),
318
318
  LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f),
319
319
  )
@@ -327,7 +327,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
327
327
  alignment = Gravity.END,
328
328
  valueSize = 14f,
329
329
  valueLineHeight = 20,
330
- valueTypeface = NativeListFonts.semibold(context),
330
+ valueTypeface = fonts.semibold(context),
331
331
  ),
332
332
  LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f),
333
333
  )
@@ -379,7 +379,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
379
379
  alignment = Gravity.START,
380
380
  valueSize = 16f,
381
381
  valueLineHeight = 24,
382
- valueTypeface = NativeListFonts.semibold(context),
382
+ valueTypeface = fonts.semibold(context),
383
383
  ),
384
384
  LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f),
385
385
  )
@@ -393,7 +393,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
393
393
  alignment = Gravity.END,
394
394
  valueSize = 14f,
395
395
  valueLineHeight = 20,
396
- valueTypeface = NativeListFonts.semibold(context),
396
+ valueTypeface = fonts.semibold(context),
397
397
  ),
398
398
  LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f),
399
399
  )
@@ -419,7 +419,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
419
419
  alignment = alignment,
420
420
  valueSize = 14f,
421
421
  valueLineHeight = 20,
422
- valueTypeface = NativeListFonts.medium(context),
422
+ valueTypeface = fonts.medium(context),
423
423
  ),
424
424
  LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f),
425
425
  )
@@ -441,7 +441,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
441
441
  alignment = Gravity.START,
442
442
  valueSize = 14f,
443
443
  valueLineHeight = 20,
444
- valueTypeface = NativeListFonts.medium(context),
444
+ valueTypeface = fonts.medium(context),
445
445
  )
446
446
  .apply {
447
447
  setPadding(dp(10), dp(10), dp(10), dp(10))
@@ -473,7 +473,7 @@ internal class NativeListMetricCardRowView(context: ThemedReactContext) :
473
473
  value = metric.optString("label"),
474
474
  size = 11f,
475
475
  lineHeight = 14,
476
- typeface = NativeListFonts.regular(context),
476
+ typeface = fonts.regular(context),
477
477
  textColor = color(theme, "disabledText", "#00000072"),
478
478
  gravity = alignment,
479
479
  )
@@ -9,6 +9,7 @@ import android.view.View
9
9
  import android.widget.LinearLayout
10
10
  import android.widget.TextView
11
11
  import androidx.core.graphics.PathParser
12
+ import com.facebook.react.common.assets.ReactFontManager
12
13
  import kotlin.math.roundToInt
13
14
 
14
15
  /** React Native color strings use CSS #RRGGBBAA ordering; Android expects #AARRGGBB. */
@@ -45,25 +46,37 @@ internal object NativeListScale {
45
46
  if (factor(resources) == 1f) value else (value * factor(resources)).roundToInt().toFloat()
46
47
  }
47
48
 
48
- internal object NativeListFonts {
49
- private val cache = mutableMapOf<String, Typeface>()
49
+ internal class NativeListFonts {
50
+ var generation = 0
51
+ private set
52
+ private var families: Map<String, String> = emptyMap()
50
53
 
51
- private fun load(context: android.content.Context, weight: String, fallback: String): Typeface =
52
- cache.getOrPut(weight) {
53
- try {
54
- Typeface.createFromAsset(context.assets, "fonts/Roobert-$weight.ttf")
55
- } catch (_: RuntimeException) {
56
- Typeface.create(fallback, Typeface.NORMAL)
57
- }
54
+ fun configure(json: String): Boolean {
55
+ val objectValue = runCatching { org.json.JSONObject(json) }.getOrNull() ?: return false
56
+ val next = linkedMapOf<String, String>()
57
+ val weights = setOf("regular", "medium", "semibold", "bold")
58
+ for (key in objectValue.keys()) {
59
+ val name = objectValue.opt(key) as? String ?: return false
60
+ if (key !in weights || name.isEmpty() || name.length > 128 || name.any { it.code < 32 || it.code == 127 }) return false
61
+ next[key] = name
58
62
  }
63
+ if (families == next) return false
64
+ families = next.toMap()
65
+ generation++
66
+ return true
67
+ }
59
68
 
60
- fun regular(context: android.content.Context) = load(context, "Regular", "sans-serif")
61
-
62
- fun medium(context: android.content.Context) = load(context, "Medium", "sans-serif-medium")
63
-
64
- fun semibold(context: android.content.Context) = load(context, "SemiBold", "sans-serif-medium")
69
+ private fun load(context: android.content.Context, weight: String, systemWeight: Int): Typeface {
70
+ val family = families[weight]
71
+ return if (family != null) ReactFontManager.getInstance().getTypeface(family, Typeface.NORMAL, context.assets)
72
+ else if (android.os.Build.VERSION.SDK_INT >= 28) Typeface.create(Typeface.DEFAULT, systemWeight, false)
73
+ else Typeface.create(if (systemWeight in 500..600) "sans-serif-medium" else "sans-serif", if (systemWeight >= 700) Typeface.BOLD else Typeface.NORMAL)
74
+ }
65
75
 
66
- fun bold(context: android.content.Context) = load(context, "Bold", "sans-serif")
76
+ fun regular(context: android.content.Context) = load(context, "regular", 400)
77
+ fun medium(context: android.content.Context) = load(context, "medium", 500)
78
+ fun semibold(context: android.content.Context) = load(context, "semibold", 600)
79
+ fun bold(context: android.content.Context) = load(context, "bold", 700)
67
80
  }
68
81
 
69
82
  internal class DottedUnderlineTextView(context: android.content.Context) :
@@ -6,8 +6,8 @@ import com.facebook.react.uimanager.ThemedReactContext
6
6
  import kotlin.math.roundToInt
7
7
  import org.json.JSONObject
8
8
 
9
- internal class NativeListRailRowView(context: ThemedReactContext) :
10
- NativeListRendererRowView(context) {
9
+ internal class NativeListRailRowView(context: ThemedReactContext, fonts: NativeListFonts) :
10
+ NativeListRendererRowView(context, fonts) {
11
11
  private val textLine =
12
12
  LinearLayout(context).apply {
13
13
  orientation = HORIZONTAL
@@ -56,7 +56,7 @@ internal class NativeListRailRowView(context: ThemedReactContext) :
56
56
  lineHeight: Int,
57
57
  ) {
58
58
  NativeListResolvedText.resolve(
59
- reactContext,
59
+ reactContext, fonts,
60
60
  value,
61
61
  style.optJSONObject(field),
62
62
  12f,
@@ -113,7 +113,7 @@ internal class NativeListRailRowView(context: ThemedReactContext) :
113
113
  // Legacy: a rail without a visual still reserves its empty 20dp slot and gap.
114
114
  val source =
115
115
  item.json.optJSONObject("visual") ?: JSONObject().put("backgroundColor", "#00000000")
116
- val view = visual ?: NativeListLeadingVisual(reactContext).also { visual = it }
116
+ val view = visual ?: NativeListLeadingVisual(reactContext, fonts).also { visual = it }
117
117
  view.bind(source, image, item.key, theme, false, sourceScale)
118
118
  val params = LayoutParams(leadingWidth, imageHeight).apply { marginEnd = leadingGap }
119
119
  if (view.parent == null) addView(view, 0, params) else view.layoutParams = params
@@ -3,7 +3,7 @@ package com.margelo.nitro.nativelist
3
3
  import com.facebook.react.uimanager.ThemedReactContext
4
4
 
5
5
  internal object NativeListRendererRegistry {
6
- private val factories: Map<NativeListRendererKey, (ThemedReactContext) -> NativeListRowHost> =
6
+ private val factories: Map<NativeListRendererKey, (ThemedReactContext, NativeListFonts) -> NativeListRowHost> =
7
7
  mapOf(
8
8
  NativeListRendererKey.SECTION_HEADER to ::NativeListSectionHeaderRowView,
9
9
  NativeListRendererKey.WALLET_GROUP to ::NativeListWalletGroupRowView,
@@ -37,6 +37,6 @@ internal object NativeListRendererRegistry {
37
37
 
38
38
  fun key(type: String) = keys.getValue(type)
39
39
 
40
- fun create(context: ThemedReactContext, viewType: Int): NativeListRowHost =
41
- factories.getValue(NativeListRendererKey.entries[viewType])(context)
40
+ fun create(context: ThemedReactContext, viewType: Int, fonts: NativeListFonts): NativeListRowHost =
41
+ factories.getValue(NativeListRendererKey.entries[viewType])(context, fonts)
42
42
  }
@@ -19,8 +19,8 @@ internal enum class NativeListRendererUpdate {
19
19
  }
20
20
 
21
21
  // Shared chrome and binding lifetime; each renderer owns its content views.
22
- internal abstract class NativeListRendererRowView(protected val reactContext: ThemedReactContext) :
23
- NativeListRowHost(reactContext) {
22
+ internal abstract class NativeListRendererRowView(protected val reactContext: ThemedReactContext, fonts: NativeListFonts) :
23
+ NativeListRowHost(reactContext, fonts) {
24
24
  protected abstract fun bindContent(
25
25
  item: NativeListItem,
26
26
  theme: JSONObject?,
@@ -188,6 +188,7 @@ internal abstract class NativeListRendererRowView(protected val reactContext: Th
188
188
  val signature =
189
189
  nativeListCanonical(
190
190
  JSONObject()
191
+ .put("fonts", fonts.generation)
191
192
  .put("theme", theme)
192
193
  .put("layout", layout)
193
194
  .put("orientation", listOrientation)
@@ -76,6 +76,7 @@ internal data class NativeListResolvedText(
76
76
  companion object {
77
77
  fun resolve(
78
78
  context: Context,
79
+ fonts: NativeListFonts,
79
80
  text: String,
80
81
  style: JSONObject?,
81
82
  size: Float,
@@ -95,10 +96,10 @@ internal data class NativeListResolvedText(
95
96
  context.resources.displayMetrics.scaledDensity
96
97
  val face =
97
98
  when (style?.optString("fontWeight", weight) ?: weight) {
98
- "medium" -> NativeListFonts.medium(context)
99
- "semibold" -> NativeListFonts.semibold(context)
100
- "bold" -> NativeListFonts.bold(context)
101
- else -> NativeListFonts.regular(context)
99
+ "medium" -> fonts.medium(context)
100
+ "semibold" -> fonts.semibold(context)
101
+ "bold" -> fonts.bold(context)
102
+ else -> fonts.regular(context)
102
103
  }
103
104
  val line =
104
105
  if (style?.has("lineHeight") == true) (style.optDouble("lineHeight") * density).roundToInt()
@@ -17,7 +17,7 @@ internal data class NativeListActionOrigin(
17
17
  )
18
18
 
19
19
  /** List-facing lifecycle shared by template renderers. */
20
- internal abstract class NativeListRowHost(context: ThemedReactContext) : LinearLayout(context) {
20
+ internal abstract class NativeListRowHost(context: ThemedReactContext, val fonts: NativeListFonts) : LinearLayout(context) {
21
21
  var bindingEpoch: Long = 0
22
22
  protected set
23
23
 
@@ -21,8 +21,8 @@ import kotlin.math.roundToInt
21
21
  import org.json.JSONArray
22
22
  import org.json.JSONObject
23
23
 
24
- internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
25
- NativeListRendererRowView(context) {
24
+ internal class NativeListSectionHeaderRowView(context: ThemedReactContext, fonts: NativeListFonts) :
25
+ NativeListRendererRowView(context, fonts) {
26
26
  private val mainColumn = LinearLayout(context)
27
27
  private val titleLine = PackedTitleLineLayout(context)
28
28
  private val title = DottedUnderlineTextView(context)
@@ -33,7 +33,7 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
33
33
  private val subtitle = NativeListTextView(context)
34
34
  private val trailingColumn = LinearLayout(context)
35
35
  private val trailingViews = listOf(NativeListTextView(context))
36
- private val checkboxControl = NativeListAccessoryStack(context)
36
+ private val checkboxControl = NativeListAccessoryStack(context, fonts)
37
37
  private val headerTitleIcon = OneKeyIconView(context)
38
38
  private val headerValueIcon = OneKeyIconView(context)
39
39
  private var currentItem: NativeListItem? = null
@@ -200,11 +200,11 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
200
200
  title.useSourceScale = sourceScale
201
201
  title.showsDottedUnderline = false
202
202
  subtitle.textSize = sp(14f)
203
- subtitle.typeface = NativeListFonts.regular(context)
203
+ subtitle.typeface = fonts.regular(context)
204
204
  subtitle.setTextColor(color(theme, "secondaryText", "#0000009B"))
205
205
  subtitle.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
206
206
  trailingViews[0].apply {
207
- typeface = NativeListFonts.medium(context)
207
+ typeface = fonts.medium(context)
208
208
  textSize = sp(16f)
209
209
  gravity = Gravity.END or Gravity.CENTER_VERTICAL
210
210
  setTextColor(color(theme, "primaryText", "#000000DF"))
@@ -238,11 +238,11 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
238
238
  item.hasExplicitHeight &&
239
239
  variant != "summary" &&
240
240
  (item.json.optJSONObject("checkbox") != null ||
241
- item.json.optString("titleActionKey").isEmpty()) -> NativeListFonts.semibold(context)
242
- network -> NativeListFonts.medium(context)
243
- layout == "table" -> NativeListFonts.regular(context)
244
- variant == "summary" -> NativeListFonts.medium(context)
245
- else -> NativeListFonts.semibold(context)
241
+ item.json.optString("titleActionKey").isEmpty()) -> fonts.semibold(context)
242
+ network -> fonts.medium(context)
243
+ layout == "table" -> fonts.regular(context)
244
+ variant == "summary" -> fonts.medium(context)
245
+ else -> fonts.semibold(context)
246
246
  }
247
247
  TextViewCompat.setLineHeight(
248
248
  title,
@@ -476,13 +476,13 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
476
476
  dp(verticalInset),
477
477
  )
478
478
  title.textSize = sp(14f)
479
- title.typeface = NativeListFonts.medium(context)
479
+ title.typeface = fonts.medium(context)
480
480
  TextViewCompat.setLineHeight(title, dp(20))
481
481
  } else if (isHistory) {
482
482
  setPadding(0, 0, 0, 0)
483
483
  title.text = item.json.optString("title").uppercase()
484
484
  title.textSize = sp(12f)
485
- title.typeface = NativeListFonts.semibold(context)
485
+ title.typeface = fonts.semibold(context)
486
486
  title.letterSpacing = 0.8f / sp(12f)
487
487
  TextViewCompat.setLineHeight(title, dp(16))
488
488
  } else if (!isTable && !isGallery && !isSummary) {
@@ -528,7 +528,7 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
528
528
  )
529
529
  trailingViews[0].accessibilityDelegate = selectorAccessibilityDelegate
530
530
  trailingViews[0].textSize = sp(16f)
531
- trailingViews[0].typeface = NativeListFonts.medium(context)
531
+ trailingViews[0].typeface = fonts.medium(context)
532
532
  TextViewCompat.setLineHeight(trailingViews[0], dp(24))
533
533
  // OneKey patch: the migrated media button shares the original 24-point text box.
534
534
  if (isExplicitNetworkHeader) trailingViews[0].setPadding(0, 0, 0, 0)
@@ -555,7 +555,7 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
555
555
  trailingColumn.gravity = Gravity.END or Gravity.CENTER_VERTICAL
556
556
  trailingViews[0].includeFontPadding = false
557
557
  trailingViews[0].textSize = sp(11f)
558
- trailingViews[0].typeface = NativeListFonts.regular(context)
558
+ trailingViews[0].typeface = fonts.regular(context)
559
559
  trailingViews[0].setTextColor(color(theme, "secondaryText", "#0000009B"))
560
560
  item.json.optJSONObject("valueIcon")?.let { icon ->
561
561
  headerValueIcon.visibility = VISIBLE
@@ -591,7 +591,7 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
591
591
  view.text = value
592
592
  view.textSize = sp(if (primary) 16f else 14f)
593
593
  view.typeface =
594
- if (primary) NativeListFonts.medium(context) else NativeListFonts.regular(context)
594
+ if (primary) fonts.medium(context) else fonts.regular(context)
595
595
  view.includeFontPadding = false
596
596
  view.fontFeatureSettings = "tnum"
597
597
  TextViewCompat.setLineHeight(view, dp(if (primary) 24 else 20))
@@ -633,7 +633,7 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
633
633
  }
634
634
  view.textSize = sp(fontSize.toFloat())
635
635
  view.typeface =
636
- if (medium) NativeListFonts.medium(context) else NativeListFonts.regular(context)
636
+ if (medium) fonts.medium(context) else fonts.regular(context)
637
637
  TextViewCompat.setLineHeight(view, dp(lineHeight))
638
638
  view.text = value
639
639
  }
@@ -651,10 +651,10 @@ internal class NativeListSectionHeaderRowView(context: ThemedReactContext) :
651
651
  style.optString("fontWeight").takeIf(String::isNotEmpty)?.let {
652
652
  view.typeface =
653
653
  when (it) {
654
- "medium" -> NativeListFonts.medium(context)
655
- "semibold" -> NativeListFonts.semibold(context)
656
- "bold" -> NativeListFonts.bold(context)
657
- else -> NativeListFonts.regular(context)
654
+ "medium" -> fonts.medium(context)
655
+ "semibold" -> fonts.semibold(context)
656
+ "bold" -> fonts.bold(context)
657
+ else -> fonts.regular(context)
658
658
  }
659
659
  }
660
660
  style.optString("color").takeIf(String::isNotEmpty)?.let {
@@ -20,8 +20,8 @@ import kotlin.math.roundToInt
20
20
  import org.json.JSONObject
21
21
 
22
22
  /** System owns status content; placement and actions remain in the list host. */
23
- internal class NativeListSystemRowView(context: ThemedReactContext) :
24
- NativeListRendererRowView(context) {
23
+ internal class NativeListSystemRowView(context: ThemedReactContext, fonts: NativeListFonts) :
24
+ NativeListRendererRowView(context, fonts) {
25
25
  private val title = NativeListTextView(context)
26
26
  private val message = NativeListTextView(context)
27
27
  private val action = NativeListTextView(context)
@@ -129,7 +129,7 @@ internal class NativeListSystemRowView(context: ThemedReactContext) :
129
129
  }
130
130
  var resolved =
131
131
  NativeListResolvedText.resolve(
132
- context,
132
+ context, fonts,
133
133
  value,
134
134
  merged,
135
135
  size,