@onekeyfe/react-native-native-list 3.0.113 → 3.0.114
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 -57
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +1 -17
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +34 -545
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +2 -26
- package/ios/NativeListCell.swift +20 -504
- package/ios/NativeListDesignAssets.swift +0 -8
- package/ios/RNCNativeListView.swift +7 -85
- package/lib/module/validation.js +1 -129
- package/lib/module/web/NativeListWebEngine.js +5 -357
- package/lib/typescript/src/models.d.ts +2 -82
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +1 -26
- package/package.json +2 -2
- package/src/models.ts +3 -121
- package/src/validation.ts +0 -206
- package/src/web/NativeListWebEngine.ts +4 -578
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
|
@@ -87,8 +87,6 @@ class NativeListView(
|
|
|
87
87
|
var onVisibleRangeChanged: ((String) -> Unit)? = null
|
|
88
88
|
private val density = resources.displayMetrics.density
|
|
89
89
|
private val recyclerView = RecyclerView(context)
|
|
90
|
-
private var configuredTopPaddingPx = 0
|
|
91
|
-
private var configuredBottomPaddingPx = 0
|
|
92
90
|
private val refreshLayout = SwipeRefreshLayout(context)
|
|
93
91
|
private val contentContainer = FrameLayout(context)
|
|
94
92
|
private val adapter = NativeListAdapter(reactContext)
|
|
@@ -320,18 +318,6 @@ class NativeListView(
|
|
|
320
318
|
}
|
|
321
319
|
return
|
|
322
320
|
}
|
|
323
|
-
// Keep the first Market row at its current pixel offset when it is
|
|
324
|
-
// reordered. RecyclerView otherwise follows the previous first key.
|
|
325
|
-
val marketStartOffset = if (
|
|
326
|
-
previous?.items?.firstOrNull()?.type == "market" &&
|
|
327
|
-
next.items.firstOrNull()?.type == "market" &&
|
|
328
|
-
previous.items.firstOrNull()?.key != next.items.firstOrNull()?.key &&
|
|
329
|
-
layoutManager.findFirstVisibleItemPosition() == 0
|
|
330
|
-
) {
|
|
331
|
-
layoutManager.findViewByPosition(0)?.let {
|
|
332
|
-
layoutManager.getDecoratedTop(it) - recyclerView.paddingTop
|
|
333
|
-
}
|
|
334
|
-
} else null
|
|
335
321
|
config = next
|
|
336
322
|
usesSelectorSourceScale = next.items.any { it.usesSelectorSourceScale }
|
|
337
323
|
adapter.usesSelectorSourceScale = usesSelectorSourceScale
|
|
@@ -344,9 +330,6 @@ class NativeListView(
|
|
|
344
330
|
configureSectionIndex(next)
|
|
345
331
|
updateLayout(next)
|
|
346
332
|
adapter.submitList(next.items) {
|
|
347
|
-
if (marketStartOffset != null) {
|
|
348
|
-
layoutManager.scrollToPositionWithOffset(0, marketStartOffset)
|
|
349
|
-
}
|
|
350
333
|
relayoutContents()
|
|
351
334
|
performPendingScrollIfNeeded()
|
|
352
335
|
syncSectionIndexToVisibleRows()
|
|
@@ -889,17 +872,11 @@ class NativeListView(
|
|
|
889
872
|
val bottomPadding = next.contentPaddingBottom ?: defaultPadding
|
|
890
873
|
// OneKey patch: the section index overlays rows and keeps only an accessory-safe inset.
|
|
891
874
|
val indexGutter = if (sectionIndexEntries.isEmpty()) 0 else SECTION_INDEX_CONTENT_INSET_DP
|
|
892
|
-
// A native scroll coordinator may add header insets to this RecyclerView.
|
|
893
|
-
// Content/theme snapshots must replace only the padding owned by NativeList.
|
|
894
|
-
val coordinatorTopPadding = (recyclerView.paddingTop - configuredTopPaddingPx).coerceAtLeast(0)
|
|
895
|
-
val coordinatorBottomPadding = (recyclerView.paddingBottom - configuredBottomPaddingPx).coerceAtLeast(0)
|
|
896
|
-
configuredTopPaddingPx = dp(topPadding)
|
|
897
|
-
configuredBottomPaddingPx = dp(bottomPadding)
|
|
898
875
|
recyclerView.setPaddingRelative(
|
|
899
876
|
dp(horizontalPadding),
|
|
900
|
-
|
|
877
|
+
dp(topPadding),
|
|
901
878
|
dp(horizontalPadding + indexGutter),
|
|
902
|
-
|
|
879
|
+
dp(bottomPadding),
|
|
903
880
|
)
|
|
904
881
|
recyclerView.clipToPadding = false
|
|
905
882
|
recyclerView.isVerticalScrollBarEnabled = sectionIndexEntries.isEmpty()
|
|
@@ -1027,7 +1004,6 @@ class NativeListView(
|
|
|
1027
1004
|
updateSelection(NativeSelectionTarget("row", item.key), item.key)
|
|
1028
1005
|
} else {
|
|
1029
1006
|
val actionKey = when {
|
|
1030
|
-
item.type == "market" && item.json.optString("pressActionKey").isNotEmpty() -> item.json.optString("pressActionKey")
|
|
1031
1007
|
item.type == "action" -> item.json.optString("actionKey")
|
|
1032
1008
|
item.type == "system" && item.json.optString("variant") == "retry" -> item.json.optString("actionKey")
|
|
1033
1009
|
else -> "press"
|