@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.
- package/README.md +3 -32
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +3 -22
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +1 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +4 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +7 -8
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +15 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +4 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +18 -104
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +5 -6
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
- package/docs/SPEC.md +19 -69
- package/docs/STYLE_SPEC.md +2 -12
- package/ios/HybridNativeList.swift +21 -15
- package/ios/NativeListAccessoryStack.swift +10 -14
- package/ios/NativeListActionRenderer.swift +4 -7
- package/ios/NativeListActivityDetailsView.swift +24 -63
- package/ios/NativeListActivityRenderer.swift +10 -19
- package/ios/NativeListDataRowRenderer.swift +19 -23
- package/ios/NativeListDesignAssets.swift +34 -43
- package/ios/NativeListIdentityRenderer.swift +19 -23
- package/ios/NativeListLeadingVisual.swift +4 -9
- package/ios/NativeListMarketRenderer.swift +11 -19
- package/ios/NativeListMediaTileRenderer.swift +7 -11
- package/ios/NativeListMessageRenderer.swift +10 -20
- package/ios/NativeListMetricCardRenderer.swift +12 -16
- package/ios/NativeListRailRenderer.swift +7 -9
- package/ios/NativeListRendererCell.swift +4 -6
- package/ios/NativeListRendererRegistry.swift +3 -8
- package/ios/NativeListResolvedText.swift +3 -3
- package/ios/NativeListRowHost.swift +2 -7
- package/ios/NativeListSectionHeaderRenderer.swift +19 -22
- package/ios/NativeListSystemRenderer.swift +16 -18
- package/ios/NativeListTextStyles.swift +12 -18
- package/ios/NativeListWalletGroupRenderer.swift +4 -6
- package/ios/RNCNativeListView.swift +92 -38
- package/ios/tests/NativeListActivityPresentationTests.swift +3 -5
- package/ios/tests/NativeListLifecycleTests.swift +2 -77
- package/lib/module/NativeList.js +24 -8
- package/lib/module/NativeList.web.js +3 -8
- package/lib/module/index.js +0 -1
- package/lib/module/web/NativeListWebEngine.js +24 -48
- package/lib/module/web/templates/ActionRowRenderer.js +1 -2
- package/lib/module/web/templates/IdentityRowRenderer.js +3 -4
- package/lib/module/web/templates/MarketRowRenderer.js +1 -2
- package/lib/module/web/templates/RowText.js +3 -13
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -3
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +18 -9
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -2
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -5
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +8 -2
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +12 -7
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -6
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -1
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +17 -6
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -2
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -3
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -1
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -1
- package/lib/typescript/src/NativeList.types.d.ts +4 -0
- package/lib/typescript/src/index.d.ts +0 -2
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +1 -4
- package/lib/typescript/src/web/templates/RowText.d.ts +0 -1
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +18 -9
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -2
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -5
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +8 -2
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +12 -7
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -6
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +17 -6
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -2
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -3
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -1
- package/package.json +5 -4
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +2 -1
- package/src/NativeList.tsx +25 -4
- package/src/NativeList.types.ts +4 -0
- package/src/NativeList.web.tsx +3 -10
- package/src/index.ts +0 -3
- package/src/web/NativeListWebEngine.ts +24 -53
- package/src/web/templates/ActionRowRenderer.ts +1 -2
- package/src/web/templates/IdentityRowRenderer.ts +3 -4
- package/src/web/templates/MarketRowRenderer.ts +2 -4
- package/src/web/templates/RowText.ts +3 -15
- package/src/web/templates/SectionHeaderRowRenderer.ts +3 -6
- package/LICENSE +0 -36
- package/lib/module/fonts.js +0 -44
- package/lib/typescript/src/fonts.d.ts +0 -10
- package/src/fonts.ts +0 -64
|
@@ -101,25 +101,6 @@ private class NativeListGridLayoutManager(
|
|
|
101
101
|
class NativeListView(
|
|
102
102
|
private val reactContext: ThemedReactContext,
|
|
103
103
|
) : LinearLayout(reactContext) {
|
|
104
|
-
private val fonts = NativeListFonts()
|
|
105
|
-
|
|
106
|
-
fun setFontFamiliesJson(json: String) {
|
|
107
|
-
if (!fonts.configure(json)) return
|
|
108
|
-
invalidateActionAnchor("layout")
|
|
109
|
-
measuredRowExtentsPx.clear()
|
|
110
|
-
measuredRowExtentSumPx = 0L
|
|
111
|
-
config?.let { updateReordering(it) }
|
|
112
|
-
adapter.rebindFonts()
|
|
113
|
-
config?.let { bindFooter(it) }
|
|
114
|
-
sectionIndexView.refreshFonts()
|
|
115
|
-
sectionIndexPreview.typeface = fonts.regular(context)
|
|
116
|
-
stickyHeaderSignature = null
|
|
117
|
-
stickyHeaderConfig = null
|
|
118
|
-
updateStickyHeader()
|
|
119
|
-
recyclerView.requestLayout()
|
|
120
|
-
requestLayout()
|
|
121
|
-
}
|
|
122
|
-
|
|
123
104
|
private data class VisibleMarketAnchor(
|
|
124
105
|
val key: String,
|
|
125
106
|
val offset: Int,
|
|
@@ -212,7 +193,7 @@ class NativeListView(
|
|
|
212
193
|
private val defaultRefreshTriggerDistancePx = (64 * resources.displayMetrics.density).roundToInt()
|
|
213
194
|
private var refreshIndicatorOffsetPx = 0
|
|
214
195
|
private val contentContainer = FrameLayout(context)
|
|
215
|
-
private val adapter = NativeListAdapter(reactContext
|
|
196
|
+
private val adapter = NativeListAdapter(reactContext)
|
|
216
197
|
private val containerSlots = mutableListOf<View>()
|
|
217
198
|
private val slotHeights = IntArray(3)
|
|
218
199
|
private var containerSlotRelayoutPending = false
|
|
@@ -470,13 +451,13 @@ class NativeListView(
|
|
|
470
451
|
mass = REORDER_SPRING_MASS,
|
|
471
452
|
durationSeconds = REORDER_SPRING_DURATION_MS / 1_000.0,
|
|
472
453
|
)
|
|
473
|
-
private var footerView: NativeListRowHost = NativeListRendererRegistry.create(reactContext, NativeListRendererKey.ACTION.ordinal
|
|
454
|
+
private var footerView: NativeListRowHost = NativeListRendererRegistry.create(reactContext, NativeListRendererKey.ACTION.ordinal)
|
|
474
455
|
private var footerRendererKey = NativeListRendererKey.ACTION
|
|
475
|
-
private val sectionIndexView = NativeListSectionIndexView(context
|
|
456
|
+
private val sectionIndexView = NativeListSectionIndexView(context)
|
|
476
457
|
private val sectionIndexPreview = TextView(context)
|
|
477
458
|
private var config: NativeListConfig? = null
|
|
478
459
|
private var usesSelectorSourceScale = false
|
|
479
|
-
private val stickyHeaderView = NativeListRendererRegistry.create(reactContext, NativeListRendererKey.SECTION_HEADER.ordinal
|
|
460
|
+
private val stickyHeaderView = NativeListRendererRegistry.create(reactContext, NativeListRendererKey.SECTION_HEADER.ordinal)
|
|
480
461
|
private var stickyHeaderSignature: String? = null
|
|
481
462
|
private var stickyHeaderConfig: NativeListConfig? = null
|
|
482
463
|
private val stickyHeaderHost = object : FrameLayout(reactContext) {
|
|
@@ -536,7 +517,6 @@ class NativeListView(
|
|
|
536
517
|
private var stickyObservedTree: ViewTreeObserver? = null
|
|
537
518
|
private var spacingDecoration: ItemSpacingDecoration? = null
|
|
538
519
|
private var itemTouchHelper: ItemTouchHelper? = null
|
|
539
|
-
private var activeReorderHolder: NativeListViewHolder? = null
|
|
540
520
|
private var reorderTouchListener: RecyclerView.OnItemTouchListener? = null
|
|
541
521
|
private var reorderTouchHandler: Handler? = null
|
|
542
522
|
private var endReachedGeneration: Int? = null
|
|
@@ -650,7 +630,7 @@ class NativeListView(
|
|
|
650
630
|
sectionIndexPreview.apply {
|
|
651
631
|
gravity = Gravity.CENTER
|
|
652
632
|
textSize = 30f
|
|
653
|
-
typeface =
|
|
633
|
+
typeface = NativeListFonts.regular(context)
|
|
654
634
|
setPadding(0, 0, sectionIndexDp(10), 0)
|
|
655
635
|
visibility = INVISIBLE
|
|
656
636
|
alpha = 0f
|
|
@@ -1683,19 +1663,8 @@ class NativeListView(
|
|
|
1683
1663
|
reorderTouchListener = null
|
|
1684
1664
|
recyclerView.removeOnItemTouchListener(keyboardTapTouchListener)
|
|
1685
1665
|
recyclerView.removeOnItemTouchListener(pagerGestureTouchListener)
|
|
1686
|
-
|
|
1666
|
+
itemTouchHelper?.attachToRecyclerView(null)
|
|
1687
1667
|
itemTouchHelper = null
|
|
1688
|
-
if (previousHelper != null && activeReorderHolder != null) {
|
|
1689
|
-
val now = SystemClock.uptimeMillis()
|
|
1690
|
-
val cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
|
|
1691
|
-
try {
|
|
1692
|
-
recyclerView.onInterceptTouchEvent(cancel)
|
|
1693
|
-
} finally {
|
|
1694
|
-
cancel.recycle()
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
previousHelper?.attachToRecyclerView(null)
|
|
1698
|
-
activeReorderHolder = null
|
|
1699
1668
|
footerView.recycle()
|
|
1700
1669
|
footerView.dispose()
|
|
1701
1670
|
stopStickyHeaderTracking()
|
|
@@ -2036,7 +2005,7 @@ class NativeListView(
|
|
|
2036
2005
|
val position = indexOfChild(previous)
|
|
2037
2006
|
previous.recycle()
|
|
2038
2007
|
previous.dispose()
|
|
2039
|
-
footerView = NativeListRendererRegistry.create(reactContext, footer.rendererKey.ordinal
|
|
2008
|
+
footerView = NativeListRendererRegistry.create(reactContext, footer.rendererKey.ordinal)
|
|
2040
2009
|
footerView.onRowPress = ::handleRowPress
|
|
2041
2010
|
footerView.onAction = ::handleAction
|
|
2042
2011
|
footerView.onBindingInvalidated = ::handleBindingInvalidated
|
|
@@ -2279,44 +2248,15 @@ class NativeListView(
|
|
|
2279
2248
|
}
|
|
2280
2249
|
|
|
2281
2250
|
private fun updateReordering(next: NativeListConfig) {
|
|
2282
|
-
dragFrom = RecyclerView.NO_POSITION
|
|
2283
|
-
dragTo = RecyclerView.NO_POSITION
|
|
2284
|
-
pendingReorder = null
|
|
2285
|
-
reorderPlaceholderDecoration.position = RecyclerView.NO_POSITION
|
|
2286
2251
|
stopReorderRelayoutLoop()
|
|
2287
2252
|
reorderTouchHandler?.removeCallbacksAndMessages(null)
|
|
2288
2253
|
reorderTouchHandler = null
|
|
2289
2254
|
reorderTouchListener?.let(recyclerView::removeOnItemTouchListener)
|
|
2290
2255
|
reorderTouchListener = null
|
|
2291
|
-
|
|
2256
|
+
itemTouchHelper?.attachToRecyclerView(null)
|
|
2292
2257
|
itemTouchHelper = null
|
|
2293
|
-
if (previousHelper != null && activeReorderHolder != null) {
|
|
2294
|
-
// Detach alone leaves ItemTouchHelper's selection/auto-scroll runnable alive.
|
|
2295
|
-
val now = SystemClock.uptimeMillis()
|
|
2296
|
-
val cancel = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0f, 0f, 0)
|
|
2297
|
-
try {
|
|
2298
|
-
recyclerView.onInterceptTouchEvent(cancel)
|
|
2299
|
-
} finally {
|
|
2300
|
-
cancel.recycle()
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
previousHelper?.attachToRecyclerView(null)
|
|
2304
|
-
val rows = mutableSetOf<NativeListViewHolder>()
|
|
2305
|
-
activeReorderHolder?.let(rows::add)
|
|
2306
|
-
activeReorderHolder = null
|
|
2307
|
-
for (index in 0 until recyclerView.childCount) {
|
|
2308
|
-
(recyclerView.getChildViewHolder(recyclerView.getChildAt(index)) as? NativeListViewHolder)
|
|
2309
|
-
?.let(rows::add)
|
|
2310
|
-
}
|
|
2311
|
-
rows.forEach { holder ->
|
|
2312
|
-
holder.itemView.animate().cancel()
|
|
2313
|
-
ItemTouchHelper.Callback.getDefaultUIUtil().clearView(holder.itemView)
|
|
2314
|
-
holder.rowView.setReorderActive(false)
|
|
2315
|
-
}
|
|
2316
|
-
recyclerView.invalidate()
|
|
2317
2258
|
adapter.cancelReorder()
|
|
2318
2259
|
if (!next.reorderable) return
|
|
2319
|
-
lateinit var helper: ItemTouchHelper
|
|
2320
2260
|
val callback = object : ItemTouchHelper.SimpleCallback(
|
|
2321
2261
|
ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT,
|
|
2322
2262
|
0,
|
|
@@ -2369,10 +2309,8 @@ class NativeListView(
|
|
|
2369
2309
|
override fun isLongPressDragEnabled(): Boolean = false
|
|
2370
2310
|
|
|
2371
2311
|
override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
|
|
2372
|
-
if (itemTouchHelper !== helper) return
|
|
2373
2312
|
super.onSelectedChanged(viewHolder, actionState)
|
|
2374
2313
|
if (actionState == ItemTouchHelper.ACTION_STATE_DRAG) {
|
|
2375
|
-
activeReorderHolder = viewHolder as? NativeListViewHolder
|
|
2376
2314
|
val position = viewHolder?.bindingAdapterPosition ?: RecyclerView.NO_POSITION
|
|
2377
2315
|
val item = adapter.itemAt(position)
|
|
2378
2316
|
reorderPlaceholderDecoration.position = position
|
|
@@ -2399,7 +2337,7 @@ class NativeListView(
|
|
|
2399
2337
|
(viewHolder as? NativeListViewHolder)?.rowView?.setReorderActive(true)
|
|
2400
2338
|
if (compactWalletGroupDrag && viewHolder != null) {
|
|
2401
2339
|
recyclerView.postOnAnimation {
|
|
2402
|
-
if (
|
|
2340
|
+
if (viewHolder.itemView.isAttachedToWindow) {
|
|
2403
2341
|
relayoutRecyclerViewImmediately()
|
|
2404
2342
|
}
|
|
2405
2343
|
}
|
|
@@ -2408,7 +2346,6 @@ class NativeListView(
|
|
|
2408
2346
|
}
|
|
2409
2347
|
|
|
2410
2348
|
override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
|
|
2411
|
-
if (itemTouchHelper !== helper) return makeMovementFlags(0, 0)
|
|
2412
2349
|
if (viewHolder !is NativeListViewHolder) return makeMovementFlags(0, 0)
|
|
2413
2350
|
val item = adapter.itemAt(viewHolder.bindingAdapterPosition)
|
|
2414
2351
|
if (item == null || !item.isReorderable) return makeMovementFlags(0, 0)
|
|
@@ -2421,7 +2358,6 @@ class NativeListView(
|
|
|
2421
2358
|
source: RecyclerView.ViewHolder,
|
|
2422
2359
|
target: RecyclerView.ViewHolder,
|
|
2423
2360
|
): Boolean {
|
|
2424
|
-
if (itemTouchHelper !== helper) return false
|
|
2425
2361
|
if (source !is NativeListViewHolder || target !is NativeListViewHolder) return false
|
|
2426
2362
|
val from = source.bindingAdapterPosition
|
|
2427
2363
|
val to = target.bindingAdapterPosition
|
|
@@ -2463,7 +2399,7 @@ class NativeListView(
|
|
|
2463
2399
|
)
|
|
2464
2400
|
}
|
|
2465
2401
|
val displacedView = target.itemView
|
|
2466
|
-
prepareDisplacedReorderAnimation(displacedView
|
|
2402
|
+
prepareDisplacedReorderAnimation(displacedView)
|
|
2467
2403
|
val reordered = adapter.moveReordered(from, to)
|
|
2468
2404
|
if (reordered == null) {
|
|
2469
2405
|
logMoveAttempt(
|
|
@@ -2497,7 +2433,6 @@ class NativeListView(
|
|
|
2497
2433
|
actionState: Int,
|
|
2498
2434
|
isCurrentlyActive: Boolean,
|
|
2499
2435
|
) {
|
|
2500
|
-
if (itemTouchHelper !== helper) return
|
|
2501
2436
|
if (actionState == ItemTouchHelper.ACTION_STATE_DRAG) {
|
|
2502
2437
|
latestDragDx = dX
|
|
2503
2438
|
latestDragDy = dY
|
|
@@ -2542,7 +2477,6 @@ class NativeListView(
|
|
|
2542
2477
|
totalSize: Int,
|
|
2543
2478
|
msSinceStartScroll: Long,
|
|
2544
2479
|
): Int {
|
|
2545
|
-
if (itemTouchHelper !== helper) return 0
|
|
2546
2480
|
val effectiveViewSize: Int
|
|
2547
2481
|
val effectiveOutOfBounds: Int
|
|
2548
2482
|
if (compactWalletGroupDrag) {
|
|
@@ -2596,9 +2530,6 @@ class NativeListView(
|
|
|
2596
2530
|
}
|
|
2597
2531
|
|
|
2598
2532
|
override fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder) {
|
|
2599
|
-
// Cancellation already restored rows before a replacement helper takes ownership.
|
|
2600
|
-
if (itemTouchHelper !== helper) return
|
|
2601
|
-
if (activeReorderHolder === viewHolder) activeReorderHolder = null
|
|
2602
2533
|
stopReorderRelayoutLoop()
|
|
2603
2534
|
val rowView = (viewHolder as? NativeListViewHolder)?.rowView
|
|
2604
2535
|
val draggedGroupKey = (rowView?.tag as? NativeListItem)?.key
|
|
@@ -2633,7 +2564,6 @@ class NativeListView(
|
|
|
2633
2564
|
val finishCompactWalletGroup = {
|
|
2634
2565
|
if (wasCompactWalletGroupDrag) {
|
|
2635
2566
|
recyclerView.postOnAnimation {
|
|
2636
|
-
if (itemTouchHelper !== helper) return@postOnAnimation
|
|
2637
2567
|
relayoutRecyclerViewImmediately()
|
|
2638
2568
|
val resolvedPosition = draggedGroupKey
|
|
2639
2569
|
?.let(adapter::positionOfKey)
|
|
@@ -2650,9 +2580,7 @@ class NativeListView(
|
|
|
2650
2580
|
REORDER_SPRING_DURATION_MS,
|
|
2651
2581
|
reorderSpringInterpolator,
|
|
2652
2582
|
) {
|
|
2653
|
-
recyclerView.postOnAnimation
|
|
2654
|
-
if (itemTouchHelper === helper) relayoutRecyclerViewImmediately()
|
|
2655
|
-
}
|
|
2583
|
+
recyclerView.postOnAnimation(::relayoutRecyclerViewImmediately)
|
|
2656
2584
|
}
|
|
2657
2585
|
}
|
|
2658
2586
|
}
|
|
@@ -2669,12 +2597,9 @@ class NativeListView(
|
|
|
2669
2597
|
reordered.getOrNull(to + 1)?.let { payload.put("afterKey", it.key) }
|
|
2670
2598
|
reorderPayload = payload
|
|
2671
2599
|
adapter.commitReordered(reordered) {
|
|
2672
|
-
if (itemTouchHelper !== helper) return@commitReordered
|
|
2673
2600
|
finishCompactWalletGroup()
|
|
2674
2601
|
if (!wasCompactWalletGroupDrag) {
|
|
2675
|
-
recyclerView.postOnAnimation
|
|
2676
|
-
if (itemTouchHelper === helper) relayoutRecyclerViewImmediately()
|
|
2677
|
-
}
|
|
2602
|
+
recyclerView.postOnAnimation(::relayoutRecyclerViewImmediately)
|
|
2678
2603
|
}
|
|
2679
2604
|
}
|
|
2680
2605
|
}
|
|
@@ -2690,9 +2615,7 @@ class NativeListView(
|
|
|
2690
2615
|
reorderPayload?.let { emit(REORDER, it) }
|
|
2691
2616
|
}
|
|
2692
2617
|
}
|
|
2693
|
-
|
|
2694
|
-
itemTouchHelper = helper
|
|
2695
|
-
helper.attachToRecyclerView(recyclerView)
|
|
2618
|
+
itemTouchHelper = ItemTouchHelper(callback).also { it.attachToRecyclerView(recyclerView) }
|
|
2696
2619
|
val handler = Handler(Looper.getMainLooper())
|
|
2697
2620
|
reorderTouchHandler = handler
|
|
2698
2621
|
val movementLimit = dp(REORDER_ALLOWABLE_MOVEMENT_DP).toFloat()
|
|
@@ -2714,8 +2637,8 @@ class NativeListView(
|
|
|
2714
2637
|
}
|
|
2715
2638
|
|
|
2716
2639
|
private fun beginDrag(holder: RecyclerView.ViewHolder) {
|
|
2717
|
-
if (
|
|
2718
|
-
|
|
2640
|
+
if (candidate !== holder || !holder.itemView.isAttachedToWindow) return
|
|
2641
|
+
itemTouchHelper?.startDrag(holder)
|
|
2719
2642
|
holder.itemView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
|
2720
2643
|
}
|
|
2721
2644
|
|
|
@@ -2725,7 +2648,6 @@ class NativeListView(
|
|
|
2725
2648
|
}
|
|
2726
2649
|
|
|
2727
2650
|
override fun onInterceptTouchEvent(recyclerView: RecyclerView, event: MotionEvent): Boolean {
|
|
2728
|
-
if (itemTouchHelper !== helper) return false
|
|
2729
2651
|
when (event.actionMasked) {
|
|
2730
2652
|
MotionEvent.ACTION_DOWN -> {
|
|
2731
2653
|
cancelPending()
|
|
@@ -2767,7 +2689,7 @@ class NativeListView(
|
|
|
2767
2689
|
}.also(recyclerView::addOnItemTouchListener)
|
|
2768
2690
|
}
|
|
2769
2691
|
|
|
2770
|
-
private fun prepareDisplacedReorderAnimation(view: View
|
|
2692
|
+
private fun prepareDisplacedReorderAnimation(view: View) {
|
|
2771
2693
|
val previousX = view.x
|
|
2772
2694
|
val previousY = view.y
|
|
2773
2695
|
view.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
|
|
@@ -2783,7 +2705,6 @@ class NativeListView(
|
|
|
2783
2705
|
oldBottom: Int,
|
|
2784
2706
|
) {
|
|
2785
2707
|
changedView.removeOnLayoutChangeListener(this)
|
|
2786
|
-
if (itemTouchHelper !== helper) return
|
|
2787
2708
|
val deltaX = previousX - changedView.x
|
|
2788
2709
|
val deltaY = previousY - changedView.y
|
|
2789
2710
|
if (deltaX == 0f && deltaY == 0f) return
|
|
@@ -3095,7 +3016,6 @@ private data class NativeListSectionIndexEntry(
|
|
|
3095
3016
|
|
|
3096
3017
|
private class NativeListSectionIndexView(
|
|
3097
3018
|
context: android.content.Context,
|
|
3098
|
-
private val fonts: NativeListFonts,
|
|
3099
3019
|
) : View(context) {
|
|
3100
3020
|
var onSelect: ((Int, Boolean) -> Unit)? = null
|
|
3101
3021
|
var onInteractionEnded: (() -> Unit)? = null
|
|
@@ -3106,20 +3026,14 @@ private class NativeListSectionIndexView(
|
|
|
3106
3026
|
private var activeColor = Color.BLACK
|
|
3107
3027
|
private var activeTextColor = Color.WHITE
|
|
3108
3028
|
private var lastTouchIndex: Int? = null
|
|
3109
|
-
fun refreshFonts() {
|
|
3110
|
-
normalPaint.typeface = fonts.regular(context)
|
|
3111
|
-
activePaint.typeface = fonts.medium(context)
|
|
3112
|
-
invalidate()
|
|
3113
|
-
}
|
|
3114
|
-
|
|
3115
3029
|
private val activeBackgroundPaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
|
3116
3030
|
private val normalPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
3117
3031
|
textAlign = Paint.Align.CENTER
|
|
3118
|
-
typeface =
|
|
3032
|
+
typeface = NativeListFonts.regular(context)
|
|
3119
3033
|
}
|
|
3120
3034
|
private val activePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
|
3121
3035
|
textAlign = Paint.Align.CENTER
|
|
3122
|
-
typeface =
|
|
3036
|
+
typeface = NativeListFonts.medium(context)
|
|
3123
3037
|
}
|
|
3124
3038
|
|
|
3125
3039
|
init {
|
|
@@ -14,8 +14,8 @@ import com.facebook.react.uimanager.ThemedReactContext
|
|
|
14
14
|
import org.json.JSONObject
|
|
15
15
|
|
|
16
16
|
/** Composite only; each keyed member owns an independent Identity binding. */
|
|
17
|
-
internal class NativeListWalletGroupRowView(context: ThemedReactContext
|
|
18
|
-
NativeListRendererRowView(context
|
|
17
|
+
internal class NativeListWalletGroupRowView(context: ThemedReactContext) :
|
|
18
|
+
NativeListRendererRowView(context) {
|
|
19
19
|
private val membersColumn = LinearLayout(context).apply { orientation = VERTICAL }
|
|
20
20
|
private val memberViews = linkedMapOf<String, NativeListIdentityRowView>()
|
|
21
21
|
private var members = emptyList<NativeListItem>()
|
|
@@ -74,7 +74,7 @@ internal class NativeListWalletGroupRowView(context: ThemedReactContext, fonts:
|
|
|
74
74
|
addView(membersColumn, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT))
|
|
75
75
|
addView(compactContainer, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT))
|
|
76
76
|
dragBadge.gravity = Gravity.CENTER
|
|
77
|
-
dragBadge.typeface =
|
|
77
|
+
dragBadge.typeface = NativeListFonts.semibold(context)
|
|
78
78
|
compactContainer.addView(dragBadge)
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -84,7 +84,6 @@ internal class NativeListWalletGroupRowView(context: ThemedReactContext, fonts:
|
|
|
84
84
|
layout: String,
|
|
85
85
|
checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String,
|
|
86
86
|
) {
|
|
87
|
-
dragBadge.typeface = fonts.semibold(context)
|
|
88
87
|
currentTheme = theme
|
|
89
88
|
currentLayout = layout
|
|
90
89
|
members = memberItems(item)
|
|
@@ -136,7 +135,7 @@ internal class NativeListWalletGroupRowView(context: ThemedReactContext, fonts:
|
|
|
136
135
|
members.forEachIndexed { index, member ->
|
|
137
136
|
val view =
|
|
138
137
|
memberViews.getOrPut(member.key) {
|
|
139
|
-
NativeListIdentityRowView(reactContext
|
|
138
|
+
NativeListIdentityRowView(reactContext).also { view ->
|
|
140
139
|
// Legacy: members own their disabled state; the group never gates them.
|
|
141
140
|
view.onRowPress = { source, origin -> onRowPress?.invoke(source, origin) }
|
|
142
141
|
view.onAction = { source, key, target, origin ->
|
|
@@ -169,7 +168,7 @@ internal class NativeListWalletGroupRowView(context: ThemedReactContext, fonts:
|
|
|
169
168
|
}
|
|
170
169
|
if (compactParent == null) {
|
|
171
170
|
compactParent =
|
|
172
|
-
NativeListIdentityRowView(reactContext
|
|
171
|
+
NativeListIdentityRowView(reactContext).also {
|
|
173
172
|
compactContainer.addView(
|
|
174
173
|
it,
|
|
175
174
|
0,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/SPEC.md
CHANGED
|
@@ -26,6 +26,25 @@ prevention; there is no automatic fitting or shrinking pass.
|
|
|
26
26
|
|
|
27
27
|
## Public API and defaults
|
|
28
28
|
|
|
29
|
+
### iOS 26 fixed top scroll-edge overlay
|
|
30
|
+
|
|
31
|
+
Standalone `NativeList` accepts optional `topScrollEdgeEffect="hard"` and
|
|
32
|
+
`topOverlay` React content. Both are disabled by default. On iOS 26 or newer,
|
|
33
|
+
the fixed overlay is a fourth native container slot, outside the row stream and
|
|
34
|
+
outside the existing scrolling `listHeader`/`listEmpty`/`listFooter` slots.
|
|
35
|
+
Fabric measures its height; the list owns an equal top inset on its collection
|
|
36
|
+
view and binds UIKit's `UIScrollEdgeElementContainerInteraction` to that view,
|
|
37
|
+
using the hard top edge style. The list restores its original inset and effect
|
|
38
|
+
on removal, disposal and reuse. The UI thread owns all view and UIKit state;
|
|
39
|
+
there is no persistence, background-runtime state or per-frame JS callback.
|
|
40
|
+
An invisible, noninteractive native label fills the overlay host so UIKit
|
|
41
|
+
recognizes React-drawn content as a scroll-edge element.
|
|
42
|
+
Inside a CollapsiblePagerView, the pager owns this effect and inset, and child
|
|
43
|
+
lists do not opt in separately. iOS before 26, Android and Web retain their
|
|
44
|
+
existing layout and scrolling. Missing overlay or style changes nothing.
|
|
45
|
+
Acceptance requires actual iOS 26 initial layout, long/short/empty scrolling,
|
|
46
|
+
refresh and overlay replacement/removal, including dark mode.
|
|
47
|
+
|
|
29
48
|
[README.md](../README.md) documents the snapshot, patch, selection, events and
|
|
30
49
|
imperative API; [STYLE_SPEC.md](STYLE_SPEC.md) defines normalization, omitted
|
|
31
50
|
style defaults and platform differences. Height precedence is
|
|
@@ -53,30 +72,6 @@ image that already loaded. Common container styling clears what it wrote on the
|
|
|
53
72
|
next bind, including properties it set on template children. UI mutation remains on the platform
|
|
54
73
|
UI thread; [DESIGN.md](DESIGN.md) describes update and event ownership.
|
|
55
74
|
|
|
56
|
-
### Android reorder cancellation
|
|
57
|
-
|
|
58
|
-
Status: implemented; three real Android View/callback regressions verified on
|
|
59
|
-
the task's API 34 emulator. Full MotionEvent long-press/edge-scroll gestures and
|
|
60
|
-
physical-device acceptance remain pending.
|
|
61
|
-
Replacing the reorder helper for a structural snapshot or changed font mapping
|
|
62
|
-
MUST invalidate pending drag indices and transaction state before detaching the old
|
|
63
|
-
helper, and restore the adapter's latest committed/submitted snapshot order
|
|
64
|
-
during cancellation. An active helper's selection and auto-scroll ownership must
|
|
65
|
-
end before detach, including disposal; ordinary non-reorder touch input is not
|
|
66
|
-
force-cancelled.
|
|
67
|
-
Cancellation emits no reorder event. It restores the active row's normal
|
|
68
|
-
appearance, including wallet-group expansion and its declared opacity, removes
|
|
69
|
-
the placeholder, and clears drag/displacement translation and temporary elevation.
|
|
70
|
-
Callbacks and deferred displacement/drop animations owned by the detached helper
|
|
71
|
-
MUST NOT change rows or commit a later gesture. A subsequent unmoved gesture
|
|
72
|
-
emits no reorder event; a subsequent valid move retains the normal single commit
|
|
73
|
-
with its own source/destination indices. This does not change the font API or
|
|
74
|
-
ordinary successful-drop animation contract.
|
|
75
|
-
In a repository source checkout, the opt-in platform-runner test and exact
|
|
76
|
-
build/run commands are in `native-tests/android/README.md`; these tests
|
|
77
|
-
drive the shipping NativeListView and ItemTouchHelper callbacks, not a copy of
|
|
78
|
-
the cancellation implementation.
|
|
79
|
-
|
|
80
75
|
### Native section title loading indicator
|
|
81
76
|
|
|
82
77
|
Status: implemented source; simulator rendering acceptance pending.
|
|
@@ -157,51 +152,6 @@ Existing geometry/typography differences are recorded in
|
|
|
157
152
|
them. iOS uses UICollectionView, Android RecyclerView, and Web a windowed DOM
|
|
158
153
|
engine. See [DESIGN.md](DESIGN.md) for their current ownership boundaries.
|
|
159
154
|
|
|
160
|
-
### Font resource ownership and runtime configuration
|
|
161
|
-
|
|
162
|
-
Status: implemented; JavaScript regression tests, Android compilation/JVM tests
|
|
163
|
-
and iOS test-target compilation verified. Device rendering acceptance pending.
|
|
164
|
-
NativeList distributes no font files and registers no fonts. Hosts own font
|
|
165
|
-
licensing, provisioning and registration. `configureNativeListFonts(families)`
|
|
166
|
-
sets four optional face names (`regular`, `medium`, `semibold`, `bold`) for the
|
|
167
|
-
current JavaScript runtime. The initial mapping is empty; `{}` resets every face
|
|
168
|
-
to system fallback. Each call replaces the entire mapping. Names are trimmed,
|
|
169
|
-
nonempty strings of at most 128 UTF-16 code units without control characters; unknown
|
|
170
|
-
keys or invalid values throw before changing any state. Omitted/undefined faces
|
|
171
|
-
use system fallback. Identical normalized mappings are idempotent.
|
|
172
|
-
|
|
173
|
-
Hosts configure once during UI-runtime startup, after provisioning fonts and
|
|
174
|
-
before rendering lists. Independent UI/background JavaScript runtimes have
|
|
175
|
-
independent stores; configuring one MUST NOT change another. There is no public
|
|
176
|
-
instance override and no mutable native-global font mapping. An internal Nitro
|
|
177
|
-
`fontFamiliesJson` prop delivers each list's current mapping to its own resolver.
|
|
178
|
-
Mounted lists subscribe to their runtime store. A changed mapping rebinds text,
|
|
179
|
-
invalidates measured geometry and requests layout without replacing row keys,
|
|
180
|
-
selection or snapshots. An active reorder is cancelled through the existing
|
|
181
|
-
structural-update cleanup before changed font geometry is applied. The same mapping MUST NOT invalidate layout. Changing
|
|
182
|
-
which font bytes an already configured name resolves to is outside this API;
|
|
183
|
-
hosts load/register fonts before configuration, and no late-font-loading event or
|
|
184
|
-
automatic font-file registration is added.
|
|
185
|
-
|
|
186
|
-
iOS resolves each configured PostScript face with `UIFont(name:size:)`, then
|
|
187
|
-
falls back to the requested system weight. Tabular-number features remain enabled
|
|
188
|
-
where requested. Android delegates configured family names to ReactFontManager
|
|
189
|
-
with `Typeface.NORMAL` and host assets, including Expo's `setTypeface` path;
|
|
190
|
-
missing configured families use React Native's system fallback, whose weight
|
|
191
|
-
need not match the requested semantic weight. An omitted face
|
|
192
|
-
uses the requested system weight on Android API 28+, with the nearest
|
|
193
|
-
regular/medium/bold system face on API 24–27. Web treats each configured name as a literal
|
|
194
|
-
CSS font-family name with the existing semantic weight and platform font stack;
|
|
195
|
-
the same resolver covers row text, sticky headers, fixed footers, section indexes
|
|
196
|
-
and reorder previews. Native measurement and binding MUST use the same instance
|
|
197
|
-
mapping. `fontFamily` remains absent from the public row-style surface.
|
|
198
|
-
|
|
199
|
-
System/custom fallback changes text metrics. Consumers must check fixed-height
|
|
200
|
-
rows, truncation and numeric alignment on each platform; source/unit checks do
|
|
201
|
-
not establish visual acceptance. Acceptance includes two independent runtimes,
|
|
202
|
-
two list instances, changed/reset mappings, invalid configuration without partial
|
|
203
|
-
state, all templates and container text, and retained selection/scroll behavior.
|
|
204
|
-
|
|
205
155
|
## Failures, fallback and limits
|
|
206
156
|
|
|
207
157
|
Snapshot validation rejects malformed/duplicate-key input without partial
|
package/docs/STYLE_SPEC.md
CHANGED
|
@@ -180,18 +180,8 @@ slots already sit on that step; slots that do not are listed in §4.
|
|
|
180
180
|
| `$bodySm` | 12 / 16 | regular | `rail.title`, `market.subtitle`, `identity.badge` |
|
|
181
181
|
| `$bodyXs` | 11 / 16 | regular | `metricCard` labels, `market` badges |
|
|
182
182
|
|
|
183
|
-
Weight names
|
|
184
|
-
|
|
185
|
-
per JavaScript runtime; omitted faces and `{}` use system fonts. iOS names are
|
|
186
|
-
host-registered PostScript names; Android names are host React Native family keys
|
|
187
|
-
or matching asset names. Web names are literal host-defined CSS font families,
|
|
188
|
-
with the existing semantic weight. Every list owns the native resolver delivered
|
|
189
|
-
from its runtime store; there is no mutable native-global font mapping or public
|
|
190
|
-
row/instance override. Configuration changes rebind text and invalidate measured
|
|
191
|
-
layout; identical normalized mappings do not. Hosts provision fonts before this
|
|
192
|
-
configuration and remain responsible for licensing. `fontFamily` is not part of
|
|
193
|
-
the style surface. See SPEC.md for validation, lifecycle and fallback boundaries.
|
|
194
|
-
Rendering acceptance remains required when font metrics change.
|
|
183
|
+
Weight names map to the bundled Roobert faces: `regular`, `medium`, `semibold`,
|
|
184
|
+
`bold`. No other family is available; `fontFamily` is not part of the style surface.
|
|
195
185
|
|
|
196
186
|
### 3.3 Spacing, radius, bounds
|
|
197
187
|
|
|
@@ -36,25 +36,31 @@ final class HybridNativeList: HybridNativeListSpec {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
var topScrollEdgeHard = false {
|
|
40
|
+
didSet {
|
|
41
|
+
runOnMain { [weak self] in
|
|
42
|
+
self?.hostView?.setTopScrollEdge(hard: self?.topScrollEdgeHard ?? false,
|
|
43
|
+
overlayHeight: CGFloat(self?.topOverlayHeight ?? 0))
|
|
44
|
+
}
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
var
|
|
47
|
-
didSet {
|
|
48
|
+
var topOverlayHeight: Double = 0 {
|
|
49
|
+
didSet {
|
|
50
|
+
runOnMain { [weak self] in
|
|
51
|
+
self?.hostView?.setTopScrollEdge(hard: self?.topScrollEdgeHard ?? false,
|
|
52
|
+
overlayHeight: CGFloat(self?.topOverlayHeight ?? 0))
|
|
53
|
+
}
|
|
54
|
+
}
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if let snapshot { self?.hostView?.applySnapshotJson(snapshot) }
|
|
57
|
+
var snapshotJson: String = "" {
|
|
58
|
+
didSet {
|
|
59
|
+
guard snapshotJson != oldValue else { return }
|
|
60
|
+
runOnMain { [weak self] in
|
|
61
|
+
guard let self else { return }
|
|
62
|
+
self.hostView?.applySnapshotJson(self.snapshotJson)
|
|
63
|
+
}
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -118,7 +118,6 @@ final class NativeListAccessoryButton: UIButton {
|
|
|
118
118
|
// Bounded trailing controls shared by migrated templates. The owning host supplies
|
|
119
119
|
// action epochs; selection-only updates touch only the existing checkbox.
|
|
120
120
|
final class NativeListAccessoryStack: UIStackView {
|
|
121
|
-
var fonts = NativeListFontFamilies()
|
|
122
121
|
private let accessoryButtons = (0..<2).map { _ in NativeListAccessoryButton(type: .system) }
|
|
123
122
|
private let checkboxButton = UIButton(type: .system)
|
|
124
123
|
private let spinner = UIActivityIndicatorView(style: .medium)
|
|
@@ -168,10 +167,8 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
168
167
|
func bind(
|
|
169
168
|
_ item: NativeListItem, descriptors: [[String: Any]], theme: [String: Any]?,
|
|
170
169
|
style: [String: Any], defaultSpacing: CGFloat = 2,
|
|
171
|
-
checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
|
|
172
|
-
fonts: NativeListFontFamilies
|
|
170
|
+
checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
|
|
173
171
|
) {
|
|
174
|
-
self.fonts = fonts
|
|
175
172
|
reset()
|
|
176
173
|
currentItem = item
|
|
177
174
|
currentTheme = theme
|
|
@@ -230,7 +227,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
230
227
|
button.setImage(nil, for: .normal)
|
|
231
228
|
button.setImage(nil, for: .disabled)
|
|
232
229
|
button.titleLabel?.font = nativeListFont(
|
|
233
|
-
ofSize: index == 0 ? 16 : 14, weight: index == 0 ? .medium : .regular
|
|
230
|
+
ofSize: index == 0 ? 16 : 14, weight: index == 0 ? .medium : .regular)
|
|
234
231
|
button.titleLabel?.numberOfLines = 1
|
|
235
232
|
button.titleLabel?.lineBreakMode = .byTruncatingTail
|
|
236
233
|
button.contentHorizontalAlignment = .center
|
|
@@ -418,7 +415,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
418
415
|
NSAttributedString(
|
|
419
416
|
string: primary,
|
|
420
417
|
attributes: [
|
|
421
|
-
.font: nativeListFont(ofSize: 16, weight: .medium
|
|
418
|
+
.font: nativeListFont(ofSize: 16, weight: .medium),
|
|
422
419
|
.foregroundColor: accessoryTextColor(
|
|
423
420
|
accessory.string("primaryTone"),
|
|
424
421
|
defaultTone: "primary",
|
|
@@ -436,7 +433,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
436
433
|
NSAttributedString(
|
|
437
434
|
string: secondary,
|
|
438
435
|
attributes: [
|
|
439
|
-
.font: nativeListFont(ofSize: 14
|
|
436
|
+
.font: nativeListFont(ofSize: 14),
|
|
440
437
|
.foregroundColor: accessoryTextColor(
|
|
441
438
|
accessory.string("secondaryTone"),
|
|
442
439
|
defaultTone: "secondary",
|
|
@@ -462,7 +459,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
462
459
|
showAccessory(index, "⋮", action: action)
|
|
463
460
|
guard accessoryButtons.indices.contains(index) else { return }
|
|
464
461
|
let button = accessoryButtons[index]
|
|
465
|
-
button.titleLabel?.font = nativeListFont(ofSize: 20, weight: .medium
|
|
462
|
+
button.titleLabel?.font = nativeListFont(ofSize: 20, weight: .medium)
|
|
466
463
|
accessorySizeConstraints.append(contentsOf: [
|
|
467
464
|
button.widthAnchor.constraint(equalToConstant: 24),
|
|
468
465
|
button.heightAnchor.constraint(equalToConstant: 24),
|
|
@@ -567,7 +564,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
567
564
|
}
|
|
568
565
|
for segment in segments {
|
|
569
566
|
attributes[.font] = nativeListTabularFont(
|
|
570
|
-
ofSize: segment.string("style") == "subscript" ? 10 : 16, weight: .medium
|
|
567
|
+
ofSize: segment.string("style") == "subscript" ? 10 : 16, weight: .medium)
|
|
571
568
|
value.append(NSAttributedString(string: segment.string("text"), attributes: attributes))
|
|
572
569
|
}
|
|
573
570
|
button.setAttributedTitle(value, for: .normal)
|
|
@@ -583,14 +580,14 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
583
580
|
let accessory = button as? NativeListAccessoryButton
|
|
584
581
|
let baseFont =
|
|
585
582
|
(originalText?.attribute(.font, at: 0, effectiveRange: nil) as? UIFont) ?? button.titleLabel?
|
|
586
|
-
.font ?? nativeListFont(ofSize: 14
|
|
583
|
+
.font ?? nativeListFont(ofSize: 14)
|
|
587
584
|
let size = CGFloat(style.double("fontSize", default: Double(baseFont.pointSize)))
|
|
588
585
|
let font: UIFont
|
|
589
586
|
if let weightName = style["fontWeight"] as? String {
|
|
590
587
|
font = nativeListFont(
|
|
591
588
|
ofSize: size,
|
|
592
|
-
weight: marketFontWeight(weightName, fallback: .regular)
|
|
593
|
-
|
|
589
|
+
weight: marketFontWeight(weightName, fallback: .regular)
|
|
590
|
+
)
|
|
594
591
|
} else {
|
|
595
592
|
font = baseFont.withSize(size)
|
|
596
593
|
}
|
|
@@ -662,8 +659,7 @@ final class NativeListAccessoryStack: UIStackView {
|
|
|
662
659
|
style["fontWeight"] == nil
|
|
663
660
|
? original.withSize(size)
|
|
664
661
|
: nativeListFont(
|
|
665
|
-
ofSize: size, weight: marketFontWeight(style.string("fontWeight"), fallback: .regular)
|
|
666
|
-
fonts: fonts)
|
|
662
|
+
ofSize: size, weight: marketFontWeight(style.string("fontWeight"), fallback: .regular))
|
|
667
663
|
text.addAttribute(.font, value: font, range: range)
|
|
668
664
|
}
|
|
669
665
|
}
|