@onekeyfe/react-native-native-list 6.7.0-alpha.359 → 6.7.0-alpha.362

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 (112) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +0 -7
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +7 -240
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -7
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +3 -6
  5. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +0 -12
  6. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +7 -87
  7. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +1 -135
  8. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +14 -43
  9. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +0 -25
  10. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +2 -17
  11. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +0 -22
  12. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +0 -2
  13. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +0 -2
  14. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +2 -3
  15. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +0 -69
  16. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +1 -55
  17. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +21 -585
  18. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +0 -1
  19. package/docs/ROW_TEMPLATES.md +9 -60
  20. package/docs/SPEC.md +5 -317
  21. package/docs/STYLE_SPEC.md +0 -6
  22. package/ios/HybridNativeList.swift +0 -10
  23. package/ios/NativeListAccessoryStack.swift +37 -220
  24. package/ios/NativeListActivityDetailsView.swift +8 -18
  25. package/ios/NativeListActivityRenderer.swift +2 -8
  26. package/ios/NativeListDataRowRenderer.swift +16 -128
  27. package/ios/NativeListDesignAssets.swift +0 -3
  28. package/ios/NativeListIdentityRenderer.swift +5 -123
  29. package/ios/NativeListLeadingVisual.swift +14 -49
  30. package/ios/NativeListMessageRenderer.swift +1 -34
  31. package/ios/NativeListModels.swift +2 -16
  32. package/ios/NativeListRendererRegistry.swift +0 -1
  33. package/ios/NativeListResolvedText.swift +1 -2
  34. package/ios/NativeListRowHost.swift +0 -14
  35. package/ios/NativeListSectionHeaderRenderer.swift +0 -88
  36. package/ios/RNCNativeListView.swift +29 -335
  37. package/ios/tests/NativeListActivityPresentationTests.swift +0 -56
  38. package/ios/tests/NativeListLifecycleTests.swift +3 -1283
  39. package/lib/module/NativeList.js +21 -39
  40. package/lib/module/NativeList.web.js +4 -51
  41. package/lib/module/models.js +0 -1
  42. package/lib/module/selection.js +1 -1
  43. package/lib/module/validation.js +8 -320
  44. package/lib/module/web/NativeListWebEngine.js +18 -373
  45. package/lib/module/web/templates/ActivityRowRenderer.js +7 -8
  46. package/lib/module/web/templates/DataRowRenderer.js +5 -40
  47. package/lib/module/web/templates/IdentityRowRenderer.js +4 -90
  48. package/lib/module/web/templates/MessageRowRenderer.js +2 -18
  49. package/lib/module/web/templates/RowContainerStyle.js +0 -1
  50. package/lib/module/web/templates/RowRendererRegistry.js +0 -3
  51. package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -36
  52. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  53. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  54. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  55. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  56. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  57. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  58. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  59. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  60. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  61. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  62. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  63. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  64. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  65. package/lib/typescript/src/NativeList.nitro.d.ts +0 -1
  66. package/lib/typescript/src/NativeList.types.d.ts +0 -8
  67. package/lib/typescript/src/models.d.ts +9 -101
  68. package/lib/typescript/src/validation.d.ts +0 -10
  69. package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -26
  70. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  71. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +3 -9
  72. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  73. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  74. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  76. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  77. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  78. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  79. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  80. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  81. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  82. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  83. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  84. package/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  85. package/package.json +3 -3
  86. package/react-native-native-list.podspec +0 -1
  87. package/src/NativeList.nitro.ts +0 -1
  88. package/src/NativeList.tsx +24 -72
  89. package/src/NativeList.types.ts +0 -9
  90. package/src/NativeList.web.tsx +8 -72
  91. package/src/models.ts +3 -113
  92. package/src/selection.ts +0 -1
  93. package/src/validation.ts +6 -721
  94. package/src/web/NativeListWebEngine.ts +19 -568
  95. package/src/web/templates/ActivityRowRenderer.ts +6 -14
  96. package/src/web/templates/DataRowRenderer.ts +20 -93
  97. package/src/web/templates/IdentityRowRenderer.ts +5 -150
  98. package/src/web/templates/MessageRowRenderer.ts +7 -23
  99. package/src/web/templates/RowContainerStyle.ts +0 -2
  100. package/src/web/templates/RowRendererRegistry.ts +1 -11
  101. package/src/web/templates/SectionHeaderRowRenderer.ts +4 -47
  102. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +0 -102
  103. package/ios/NativeListButtonGroupRenderer.swift +0 -89
  104. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
  105. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
  106. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
  107. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
  108. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
  109. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
  110. package/lib/module/web/templates/ButtonGroupRowRenderer.js +0 -47
  111. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +0 -14
  112. package/src/web/templates/ButtonGroupRowRenderer.ts +0 -58
@@ -31,13 +31,6 @@ class HybridNativeList(context: ThemedReactContext) : HybridNativeListSpec() {
31
31
  dispatchToUi { hostView.setContainerSlotHeightsJson(value) }
32
32
  }
33
33
 
34
- override var sidecarLayoutJson: String = ""
35
- set(value) {
36
- if (field == value) return
37
- field = value
38
- dispatchToUi { hostView.setSidecarLayoutJson(value) }
39
- }
40
-
41
34
  private var fontsChanged = false
42
35
  private var snapshotChanged = false
43
36
 
@@ -8,14 +8,11 @@ import android.graphics.drawable.StateListDrawable
8
8
  import android.text.Spannable
9
9
  import android.text.SpannableStringBuilder
10
10
  import android.text.TextUtils
11
- import android.text.TextPaint
12
11
  import android.text.style.AbsoluteSizeSpan
13
12
  import android.text.style.ForegroundColorSpan
14
- import android.text.style.MetricAffectingSpan
15
13
  import android.util.TypedValue
16
14
  import android.view.Gravity
17
15
  import android.view.View
18
- import android.view.MotionEvent
19
16
  import android.widget.LinearLayout
20
17
  import android.widget.ProgressBar
21
18
  import android.widget.TextView
@@ -32,14 +29,11 @@ import org.json.JSONObject
32
29
  // Bounded controls only. Event ownership and epochs stay with the row host.
33
30
  internal class NativeListAccessoryStack(context: android.content.Context, val fonts: NativeListFonts) : LinearLayout(context) {
34
31
  private val trailingViews = List(2) { NativeListTextView(context) }
35
- private val buttonDownEpochs = IntArray(2) { -1 }
36
- private var bindingEpoch = 0
37
32
  private val trailingIcons = List(2) { OneKeyIconView(context) }
38
33
  private val checkbox = OneKeyCheckboxView(context)
39
34
  private val spinner = ProgressBar(context)
40
35
  private var boundCheckboxData: JSONObject? = null
41
36
  private val semanticValueViews = mutableListOf<TextView>()
42
- private val segmentedValuePairs = mutableMapOf<TextView, JSONObject>()
43
37
  private var selectorUsesSourceScale = false
44
38
  private var checkboxUsesSelectorStyle = false
45
39
  private var checkboxCheckedColor = Color.BLACK
@@ -72,19 +66,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
72
66
  info.viewIdResourceName = host.getTag(com.facebook.react.R.id.react_test_id) as? String
73
67
  }
74
68
  }
75
- private val buttonAccessibilityDelegate =
76
- object : View.AccessibilityDelegate() {
77
- override fun onInitializeAccessibilityNodeInfo(
78
- host: View,
79
- info: android.view.accessibility.AccessibilityNodeInfo,
80
- ) {
81
- super.onInitializeAccessibilityNodeInfo(host, info)
82
- info.className = android.widget.Button::class.java.name
83
- info.isEnabled = host.isEnabled
84
- info.isClickable = host.isEnabled && host.isClickable
85
- info.viewIdResourceName = host.getTag(com.facebook.react.R.id.react_test_id) as? String
86
- }
87
- }
88
69
 
89
70
  private val trailingPaintFlags = trailingViews.map { it.paintFlags }
90
71
 
@@ -149,12 +130,7 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
149
130
  (checkbox.layoutParams as LayoutParams).marginStart = dp(12)
150
131
  for ((index, key) in listOf("value", "valueSecondary").withIndex()) {
151
132
  style.optJSONObject(key)?.let { value ->
152
- semanticValueViews.getOrNull(index)?.let { view ->
153
- applyStyledText(view, value)
154
- if (value.has("fontSize")) segmentedValuePairs[view]?.let { accessory ->
155
- restorePairSubscriptSizes(view, accessory, value.optDouble("fontSize").toFloat())
156
- }
157
- }
133
+ semanticValueViews.getOrNull(index)?.let { applyStyledText(it, value) }
158
134
  }
159
135
  }
160
136
  if (style.has("trailingGap")) {
@@ -170,13 +146,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
170
146
  }
171
147
  }
172
148
  }
173
- val pairedChevron = horizontal && (kinds == listOf("valuePair", "chevron") ||
174
- (kinds == listOf("icon", "chevron") &&
175
- descriptors.getJSONObject(0).optString("name") == "RefreshCcwOutline" &&
176
- descriptors.getJSONObject(0).optString("actionKey").isEmpty()))
177
- if (pairedChevron) {
178
- (trailingIcons[1].layoutParams as LayoutParams).marginEnd = 0
179
- }
180
149
  visibility =
181
150
  if ((0 until childCount).any { getChildAt(it).visibility != GONE }) VISIBLE else GONE
182
151
  }
@@ -198,52 +167,32 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
198
167
 
199
168
  fun anchorInset(view: View): Int =
200
169
  if (
201
- view in trailingIcons &&
202
- (view.layoutParams as MarginLayoutParams).marginStart < 0 &&
203
- ((tag as? NativeListItem)?.json?.optString("presentation") == "accountSelector" ||
204
- (tag as? NativeListItem)?.json?.optJSONArray("trailing")?.let { trailing ->
205
- (0 until trailing.length()).any { index ->
206
- trailing.optJSONObject(index)?.optString("buttonStyle") == "tertiary"
207
- }
208
- } == true)
170
+ (tag as? NativeListItem)?.json?.optString("presentation") == "accountSelector" &&
171
+ view in trailingIcons &&
172
+ (view.layoutParams as MarginLayoutParams).marginStart < 0
209
173
  )
210
174
  dp(7)
211
175
  else 0
212
176
 
213
177
  fun reset() {
214
- bindingEpoch += 1
215
178
  tag = null
216
179
  endInset = null
217
180
  requestsUnclippedHost = false
218
181
  clipChildren = true
219
182
  clipToPadding = true
220
183
  semanticValueViews.clear()
221
- segmentedValuePairs.clear()
222
184
  boundCheckboxData = null
223
185
  trailingViews.forEachIndexed { index, v ->
224
- buttonDownEpochs[index] = -1
225
186
  v.paintFlags = trailingPaintFlags[index]
226
187
  v.visibility = GONE
227
188
  v.text = ""
228
189
  v.layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
229
190
  v.setOnClickListener(null)
230
- v.setOnTouchListener(null)
231
- v.isPressed = false
232
- v.isClickable = false
233
- v.isEnabled = true
234
- v.alpha = 1f
235
- v.contentDescription = null
236
- v.setTag(com.facebook.react.R.id.react_test_id, null)
237
- v.accessibilityDelegate = null
238
191
  v.background = null
239
192
  v.setPadding(0, 0, 0, 0)
240
193
  // Legacy trailing text: END gravity, one line, no ellipsis.
241
194
  v.gravity = Gravity.END
242
195
  v.opticalOffsetY = 0f
243
- v.helpBindingGeneration += 1
244
- v.guardsHelpTouches = false
245
- v.primaryHelpOnly = false
246
- v.showsHelpUnderline = false
247
196
  v.maxLines = 1
248
197
  v.setHorizontallyScrolling(false)
249
198
  v.ellipsize = null
@@ -303,83 +252,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
303
252
  for (index in 0 until minOf(2, accessories.length())) {
304
253
  val accessory = accessories.getJSONObject(index)
305
254
  when (accessory.optString("kind")) {
306
- "button" -> {
307
- if (textIndex !in trailingViews.indices) continue
308
- val view = trailingViews[textIndex]
309
- val buttonIndex = textIndex
310
- val epoch = bindingEpoch
311
- val disabled =
312
- item.json.optBoolean("disabled", false) || accessory.optBoolean("disabled", false)
313
- showTrailing(textIndex, accessory.optString("label"), false)
314
- view.typeface = fonts.medium(context)
315
- view.gravity = Gravity.CENTER
316
- view.setTextColor(
317
- safeColor(
318
- accessory.optString("textColor").takeIf(String::isNotEmpty),
319
- color(theme, "primaryText", "#000000DF"),
320
- )
321
- )
322
- view.layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, dp(30))
323
- view.setPadding(dp(11), dp(4), dp(11), dp(4))
324
- view.background =
325
- StateListDrawable().apply {
326
- fun fill(value: Int) =
327
- GradientDrawable().apply {
328
- setColor(value)
329
- cornerRadius = dp(15).toFloat()
330
- setStroke(dp(1), Color.TRANSPARENT)
331
- }
332
- addState(
333
- intArrayOf(android.R.attr.state_pressed),
334
- fill(safeColor(accessory.optString("pressedBackgroundColor").takeIf(String::isNotEmpty),
335
- color(theme, "rowPressedBackground", "#00000017"))),
336
- )
337
- addState(
338
- intArrayOf(),
339
- fill(safeColor(accessory.optString("backgroundColor").takeIf(String::isNotEmpty),
340
- color(theme, "strongBackground", "#0000000F"))),
341
- )
342
- }
343
- view.setTag(
344
- com.facebook.react.R.id.react_test_id,
345
- accessory.optString("testID").takeIf(String::isNotEmpty),
346
- )
347
- view.accessibilityDelegate = buttonAccessibilityDelegate
348
- view.contentDescription =
349
- accessory.optString("accessibilityLabel").ifEmpty { accessory.optString("label") }
350
- view.isEnabled = !disabled
351
- view.alpha = if (disabled) 0.4f else 1f
352
- view.isClickable = true
353
- view.setOnTouchListener { _, event ->
354
- when (event.actionMasked) {
355
- MotionEvent.ACTION_DOWN -> {
356
- buttonDownEpochs[buttonIndex] = epoch
357
- false
358
- }
359
- MotionEvent.ACTION_UP -> {
360
- if (buttonDownEpochs[buttonIndex] != bindingEpoch) {
361
- view.isPressed = false
362
- true
363
- } else false
364
- }
365
- MotionEvent.ACTION_CANCEL -> {
366
- buttonDownEpochs[buttonIndex] = -1
367
- false
368
- }
369
- else -> false
370
- }
371
- }
372
- view.setOnClickListener {
373
- if (epoch != bindingEpoch) return@setOnClickListener
374
- (tag as? NativeListItem)?.takeUnless { it.json.optBoolean("disabled", false) }
375
- ?.takeUnless { accessory.optBoolean("disabled", false) }
376
- ?.let {
377
- emitAction(it, accessory.optString("actionKey"), null, view,
378
- "trailingAccessory", index)
379
- }
380
- }
381
- textIndex++
382
- }
383
255
  "value" -> {
384
256
  showTrailing(
385
257
  textIndex,
@@ -392,21 +264,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
392
264
  }
393
265
  "valuePair" -> {
394
266
  showTrailingValuePair(textIndex, accessory, theme)
395
- accessory.optJSONObject("primaryHelp")?.let { help ->
396
- val view = trailingViews[textIndex]
397
- val epoch = bindingEpoch
398
- view.primaryHelpOnly = true
399
- view.guardsHelpTouches = true
400
- view.showsHelpUnderline = help.optString("underline") == "dashed"
401
- if (help.optString("presentation") == "popover") {
402
- view.setOnClickListener {
403
- if (epoch == bindingEpoch && !item.json.optBoolean("disabled")) {
404
- emitAction(item, help.optString("actionKey"), null, view, "trailingAccessory", index)
405
- }
406
- }
407
- }
408
- }
409
- segmentedValuePairs[trailingViews[textIndex]] = accessory
410
267
  semanticValueViews.add(trailingViews[textIndex++])
411
268
  }
412
269
  "checkbox" -> bindCheckbox(item, accessory, checkboxState)
@@ -564,10 +421,8 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
564
421
 
565
422
  private fun showTrailingValuePair(index: Int, accessory: JSONObject, theme: JSONObject?) {
566
423
  if (index !in trailingViews.indices) return
567
- val primarySegments = accessory.optJSONArray("primaryTextSegments")
568
- val secondarySegments = accessory.optJSONArray("secondaryTextSegments")
569
- val primary = segmentTextOrFallback(primarySegments, accessory.optString("primary"))
570
- val secondary = segmentTextOrFallback(secondarySegments, accessory.optString("secondary"))
424
+ val primary = accessory.optString("primary")
425
+ val secondary = accessory.optString("secondary")
571
426
  if (primary.isEmpty() && secondary.isEmpty()) return
572
427
  val value = SpannableStringBuilder()
573
428
  val primaryStart = value.length
@@ -587,15 +442,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
587
442
  value.length,
588
443
  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
589
444
  )
590
- if (primary.isNotEmpty() && accessory.optString("primaryFontWeight") == "medium") {
591
- value.setSpan(
592
- ValuePairTypefaceSpan(fonts.medium(context)),
593
- primaryStart,
594
- value.length,
595
- Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
596
- )
597
- }
598
- applyPairSubscriptSizes(value, primarySegments, primaryStart, 16f)
599
445
  if (primary.isNotEmpty() && secondary.isNotEmpty()) value.append('\n')
600
446
  val secondaryStart = value.length
601
447
  value.append(secondary)
@@ -616,7 +462,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
616
462
  value.length,
617
463
  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
618
464
  )
619
- applyPairSubscriptSizes(value, secondarySegments, secondaryStart, 14f)
620
465
  val view = trailingViews[index]
621
466
  view.text = value
622
467
  view.maxLines = 2
@@ -628,48 +473,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
628
473
  view.visibility = VISIBLE
629
474
  }
630
475
 
631
- private fun segmentTextOrFallback(segments: JSONArray?, fallback: String): String {
632
- if (segments == null || segments.length() == 0) return fallback
633
- return buildString {
634
- for (index in 0 until segments.length()) append(segments.getJSONObject(index).optString("text"))
635
- }
636
- }
637
-
638
- private fun applyPairSubscriptSizes(
639
- value: SpannableStringBuilder,
640
- segments: JSONArray?,
641
- start: Int,
642
- baseSize: Float,
643
- ) {
644
- if (segments == null) return
645
- var offset = start
646
- for (index in 0 until segments.length()) {
647
- val segment = segments.getJSONObject(index)
648
- val end = offset + segment.optString("text").length
649
- if (end > offset && segment.optString("style") == "subscript")
650
- value.setSpan(
651
- AbsoluteSizeSpan(sp(kotlin.math.ceil(baseSize * 0.6).toFloat()).roundToInt(), true),
652
- offset,
653
- end,
654
- Spannable.SPAN_EXCLUSIVE_EXCLUSIVE,
655
- )
656
- offset = end
657
- }
658
- }
659
-
660
- private fun restorePairSubscriptSizes(view: TextView, accessory: JSONObject, baseSize: Float) {
661
- val primary = accessory.optJSONArray("primaryTextSegments")
662
- val secondary = accessory.optJSONArray("secondaryTextSegments")
663
- if ((primary?.length() ?: 0) == 0 && (secondary?.length() ?: 0) == 0) return
664
- val value = SpannableStringBuilder(view.text)
665
- applyPairSubscriptSizes(value, primary, 0, baseSize)
666
- val primaryText = segmentTextOrFallback(primary, accessory.optString("primary"))
667
- val secondaryStart = primaryText.length + if (primaryText.isNotEmpty() &&
668
- segmentTextOrFallback(secondary, accessory.optString("secondary")).isNotEmpty()) 1 else 0
669
- applyPairSubscriptSizes(value, secondary, secondaryStart, baseSize)
670
- view.text = value
671
- }
672
-
673
476
  private fun showTrailingMenu(index: Int, actionKey: String) {
674
477
  showTrailing(index, "⋮", true, actionKey)
675
478
  if (index !in trailingViews.indices) return
@@ -709,26 +512,7 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
709
512
  )
710
513
  icon.accessibilityDelegate = selectorAccessibilityDelegate
711
514
  icon.contentDescription = data.optString("accessibilityLabel").takeIf { it.isNotEmpty() }
712
- if (data.optString("buttonStyle") == "tertiary") {
713
- icon.glyphSizeDp = 24
714
- icon.layoutParams = LayoutParams(dp(38), dp(38)).apply {
715
- gravity = Gravity.CENTER_VERTICAL
716
- marginStart = -dp(7)
717
- marginEnd = -dp(7)
718
- }
719
- icon.background = StateListDrawable().apply {
720
- addState(intArrayOf(android.R.attr.state_pressed),
721
- roundedFill(color(theme, "rowPressedBackground", "#00000017"), 19f).apply {
722
- setStroke(dp(1), Color.TRANSPARENT)
723
- })
724
- addState(intArrayOf(), roundedFill(Color.TRANSPARENT, 19f).apply {
725
- setStroke(dp(1), Color.TRANSPARENT)
726
- })
727
- }
728
- clipChildren = false
729
- clipToPadding = false
730
- requestsUnclippedHost = true
731
- } else if (item.json.optString("presentation") == "accountSelector") {
515
+ if (item.json.optString("presentation") == "accountSelector") {
732
516
  icon.glyphSizeDp = 24
733
517
  val isSourceMenu = item.hasExplicitHeight && icon.iconName == "DotHorOutline"
734
518
  val size = if (item.hasExplicitHeight && icon.iconName == "PlusSmallOutline") 36 else 38
@@ -754,13 +538,6 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
754
538
  addState(intArrayOf(), roundedFill(Color.TRANSPARENT, 19f))
755
539
  }
756
540
  }
757
- } else if (icon.iconName == "RefreshCcwOutline" && data.optString("actionKey").isEmpty()) {
758
- icon.glyphSizeDp = 16
759
- icon.isClickable = false
760
- icon.isFocusable = false
761
- icon.layoutParams = LayoutParams(dp(16), dp(16)).apply {
762
- gravity = Gravity.CENTER_VERTICAL
763
- }
764
541
  } else if (icon.iconName == "ChevronRightSmallOutline") {
765
542
  icon.glyphSizeDp = null
766
543
  // ListItem.DrillIn is a 24dp icon with mx=-6, for a 12dp layout footprint.
@@ -932,13 +709,3 @@ internal class NativeListAccessoryStack(context: android.content.Context, val fo
932
709
  cornerRadius = scaledDp(radiusDp)
933
710
  }
934
711
  }
935
-
936
- private class ValuePairTypefaceSpan(private val face: Typeface) : MetricAffectingSpan() {
937
- override fun updateDrawState(paint: TextPaint) {
938
- paint.typeface = face
939
- }
940
-
941
- override fun updateMeasureState(paint: TextPaint) {
942
- paint.typeface = face
943
- }
944
- }
@@ -70,13 +70,10 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
70
70
  val style = data.optJSONObject("style") ?: JSONObject()
71
71
  val image = style.optJSONObject("image") ?: JSONObject()
72
72
  val table = data.optString("presentation") == "table"
73
- val hideLeading = data.optBoolean("hideLeading")
74
73
  val gap = if (style.has("leadingGap")) px(style.optDouble("leadingGap")) else dp(12)
75
74
  val iw = if (image.has("width")) px(image.optDouble("width")) else dp(40)
76
- visual.layoutParams = LayoutParams(iw, if (image.has("height")) px(image.optDouble("height")) else dp(40)).apply { marginEnd = if (hideLeading) 0 else gap }
77
- visual.visibility = if (hideLeading) GONE else VISIBLE
78
- if (hideLeading) visual.recycle()
79
- else visual.bind(data.optJSONObject("leading") ?: JSONObject(), image, item.key, theme, false, sourceScale, data.optJSONObject("secondaryLeading"))
75
+ visual.layoutParams = LayoutParams(iw, if (image.has("height")) px(image.optDouble("height")) else dp(40)).apply { marginEnd = gap }
76
+ visual.bind(data.optJSONObject("leading") ?: JSONObject(), image, item.key, theme, false, sourceScale, data.optJSONObject("secondaryLeading"))
80
77
  amounts.layoutParams = if (table) LayoutParams(0, -2, 1f).apply { marginStart = gap } else LayoutParams(-2, -2).apply { marginStart = gap }
81
78
  text(title, data.optString("title"), style.optJSONObject("title"), 16f, color("primary", theme), 24, "medium")
82
79
  text(description, data.optString("description"), style.optJSONObject("description"), 14f, color("secondary", theme), 20, lines = 2)
@@ -120,7 +117,7 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
120
117
  actions.removeAllViews()
121
118
  val actionData = data.optJSONArray("footerActions")
122
119
  actions.visibility = if ((actionData?.length() ?: 0) == 0) GONE else VISIBLE
123
- actions.layoutParams = LayoutParams(-1, -2).apply { marginStart = if (hideLeading) 0 else iw + gap; topMargin = dp(8) }
120
+ actions.layoutParams = LayoutParams(-1, -2).apply { marginStart = iw + gap; topMargin = dp(8) }
124
121
  for (index in 0 until (actionData?.length() ?: 0)) {
125
122
  val descriptor = actionData!!.getJSONObject(index)
126
123
  val button = NativeListTextView(context)
@@ -149,7 +146,7 @@ internal class NativeListActivityDetailsView(private val reactContext: ThemedRea
149
146
  }
150
147
  label.text = styled
151
148
  }
152
- fun recycle() { visual.recycle(); visual.visibility = VISIBLE; amountViews.forEach { it.recycle() }; description.setOnClickListener(null); actions.removeAllViews() }
149
+ fun recycle() { visual.recycle(); amountViews.forEach { it.recycle() }; description.setOnClickListener(null); actions.removeAllViews() }
153
150
  fun dispose() { recycle(); visual.dispose(); amountViews.forEach { it.dispose() } }
154
151
 
155
152
  private inner class AmountView : LinearLayout(context) {
@@ -81,7 +81,6 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
81
81
  details.recycle()
82
82
  val style = data.optJSONObject("style") ?: JSONObject()
83
83
  val image = style.optJSONObject("image") ?: JSONObject()
84
- val hideLeading = data.optBoolean("hideLeading")
85
84
  fun color(name: String, fallback: String) =
86
85
  parseNativeListColor(theme?.optString(name, fallback) ?: fallback)
87
86
  fun fill(value: Int, radius: Int) =
@@ -144,10 +143,8 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
144
143
  val iw = if (image.has("width")) stylePx(image.optDouble("width")) else dp(40)
145
144
  val ih = if (image.has("height")) stylePx(image.optDouble("height")) else dp(40)
146
145
  val gap = if (style.has("leadingGap")) stylePx(style.optDouble("leadingGap")) else dp(12)
147
- visual.layoutParams = LayoutParams(iw, ih).apply { marginEnd = if (hideLeading) 0 else gap }
148
- visual.visibility = if (hideLeading) GONE else VISIBLE
149
- if (hideLeading) visual.recycle()
150
- else visual.bind(
146
+ visual.layoutParams = LayoutParams(iw, ih).apply { marginEnd = gap }
147
+ visual.bind(
151
148
  // Legacy: a missing visual still reserves an empty, transparent slot.
152
149
  data.optJSONObject("leading") ?: JSONObject().put("backgroundColor", "#00000000"),
153
150
  image,
@@ -215,7 +212,7 @@ internal class NativeListActivityRowView(context: ThemedReactContext, fonts: Nat
215
212
  actions.visibility = if (count == 0) GONE else VISIBLE
216
213
  actions.layoutParams =
217
214
  LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT).apply {
218
- marginStart = if (hideLeading) 0 else if (style.has("leadingGap") || image.has("width")) iw + gap else dp(52)
215
+ marginStart = if (style.has("leadingGap") || image.has("width")) iw + gap else dp(52)
219
216
  topMargin = if (style.has("lineGap")) stylePx(style.optDouble("lineGap")) else dp(8)
220
217
  bottomMargin = dp(4)
221
218
  }
@@ -11,15 +11,6 @@ internal class NativeListContainerSlotAdapter : RecyclerView.Adapter<NativeListC
11
11
  private var content: View? = null
12
12
  private var height = 0
13
13
  private var enabled = true
14
- private var boundHolder: Holder? = null
15
- private var visualTranslationY = 0f
16
-
17
- fun contentView(): View? = content
18
-
19
- fun setVisualTranslationY(value: Float) {
20
- visualTranslationY = value
21
- boundHolder?.container?.translationY = value
22
- }
23
14
 
24
15
  fun update(view: View?, heightPx: Int, visible: Boolean) {
25
16
  val previousCount = itemCount
@@ -48,8 +39,6 @@ internal class NativeListContainerSlotAdapter : RecyclerView.Adapter<NativeListC
48
39
  }
49
40
 
50
41
  override fun onBindViewHolder(holder: Holder, position: Int) {
51
- boundHolder = holder
52
- holder.container.translationY = visualTranslationY
53
42
  holder.container.layoutParams = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height)
54
43
  holder.container.removeAllViews()
55
44
  content?.let { view ->
@@ -59,7 +48,6 @@ internal class NativeListContainerSlotAdapter : RecyclerView.Adapter<NativeListC
59
48
  }
60
49
 
61
50
  override fun onViewRecycled(holder: Holder) {
62
- if (boundHolder === holder) boundHolder = null
63
51
  holder.container.removeAllViews()
64
52
  }
65
53
  }