@onekeyfe/react-native-native-list 6.7.0-5 → 6.7.0-51
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 +312 -375
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1978 -136
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
- package/docs/ROW_TEMPLATES.md +74 -13
- package/docs/SPEC.md +1232 -16
- package/docs/STYLE_SPEC.md +14 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +237 -51
- package/ios/NativeListActivityDetailsView.swift +30 -11
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +167 -30
- package/ios/NativeListDesignAssets.swift +13 -75
- package/ios/NativeListGeneratedIcons.swift +55 -0
- package/ios/NativeListIconBinding.swift +171 -0
- package/ios/NativeListIdentityRenderer.swift +256 -39
- package/ios/NativeListLeadingVisual.swift +127 -28
- package/ios/NativeListMarketRenderer.swift +120 -31
- package/ios/NativeListMediaPlaceholderView.swift +189 -0
- package/ios/NativeListMediaPreviewSlot.swift +122 -61
- package/ios/NativeListMediaTileRenderer.swift +15 -11
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListMetricCardRenderer.swift +4 -2
- package/ios/NativeListModels.swift +42 -2
- package/ios/NativeListRendererRegistry.swift +1 -0
- package/ios/NativeListResolvedText.swift +2 -1
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +100 -4
- package/ios/RNCNativeListView.swift +1093 -59
- package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
- package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2915 -4
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
- package/ios/tests/NativeListSharedIconTests.swift +236 -0
- package/lib/module/NativeList.js +236 -38
- package/lib/module/NativeList.web.js +167 -46
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +3 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +1246 -48
- package/lib/module/web/NativeListGeneratedIcons.js +31 -0
- package/lib/module/web/NativeListWebEngine.js +513 -275
- package/lib/module/web/templates/ActivityRowRenderer.js +12 -31
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +40 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +158 -6
- package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
- package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
- package/lib/module/web/templates/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +3 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/lib/typescript/src/NativeList.d.ts +3 -3
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +20 -2
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +126 -17
- package/lib/typescript/src/validation.d.ts +20 -0
- package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/package.json +16 -10
- package/react-native-native-list.podspec +2 -6
- package/scripts/generate-icons.mjs +150 -0
- package/scripts/generate-icons.test.mjs +288 -0
- package/scripts/native-list-icons.json +260 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +439 -91
- package/src/NativeList.types.ts +24 -2
- package/src/NativeList.web.tsx +295 -89
- package/src/index.ts +2 -0
- package/src/models.ts +263 -144
- package/src/selection.ts +1 -0
- package/src/validation.ts +3013 -152
- package/src/web/NativeListGeneratedIcons.ts +28 -0
- package/src/web/NativeListWebEngine.ts +818 -343
- package/src/web/templates/ActivityRowRenderer.ts +29 -59
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +231 -6
- package/src/web/templates/MarketTableRowRenderer.ts +53 -33
- package/src/web/templates/MediaTileRowRenderer.ts +90 -28
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +11 -1
- package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
- 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
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
package com.margelo.nitro.nativelist
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.assertEquals
|
|
4
|
+
import org.junit.Test
|
|
5
|
+
|
|
6
|
+
class NativeListActivityHostClipPolicyTest {
|
|
7
|
+
// One Activity row view serves legacy and rich rows and is reused across
|
|
8
|
+
// binds. A row with an overhanging network badge switches the host's
|
|
9
|
+
// clipping off, whether the badge sits on the host's visual (legacy row,
|
|
10
|
+
// OK-66071) or on the details view's visual (rich row, OK-66275); the next
|
|
11
|
+
// bind must derive clipping afresh, so a row without a badge reusing that
|
|
12
|
+
// view clips again instead of drawing over a neighbouring row (PR #185
|
|
13
|
+
// review).
|
|
14
|
+
@Test
|
|
15
|
+
fun rebindSequenceDerivesClippingFromEachBoundItem() {
|
|
16
|
+
data class Bind(val name: String, val rich: Boolean, val leadingOverhangs: Boolean, val clips: Boolean)
|
|
17
|
+
|
|
18
|
+
val binds = listOf(
|
|
19
|
+
Bind("legacy row, plain token", rich = false, leadingOverhangs = false, clips = true),
|
|
20
|
+
Bind("legacy row, network badge", rich = false, leadingOverhangs = true, clips = false),
|
|
21
|
+
Bind("rich row reusing the badge row's view", rich = true, leadingOverhangs = false, clips = true),
|
|
22
|
+
// The app's history rows carry `amounts`, so their badge lives on the
|
|
23
|
+
// details view's leading visual: a rich row with such a badge must stop
|
|
24
|
+
// clipping too (OK-66275).
|
|
25
|
+
Bind("rich row, network badge in details", rich = true, leadingOverhangs = true, clips = false),
|
|
26
|
+
Bind("legacy row, badge again", rich = false, leadingOverhangs = true, clips = false),
|
|
27
|
+
Bind("legacy row, hidden leading", rich = false, leadingOverhangs = false, clips = true),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
assertEquals(
|
|
31
|
+
binds.map(Bind::clips),
|
|
32
|
+
binds.map { nativeListActivityHostClips(leadingOverhangs = it.leadingOverhangs) },
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|
package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
package com.margelo.nitro.nativelist
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.assertEquals
|
|
4
|
+
import org.junit.Test
|
|
5
|
+
|
|
6
|
+
class NativeListIdentityTrailingAxisTest {
|
|
7
|
+
// Identity trailing accessories stack vertically except for the pairs iOS
|
|
8
|
+
// lays out side by side. The Swap token selector's `valuePair` + DotVerSolid
|
|
9
|
+
// menu icon was missing from the Android list, so the balance was pushed
|
|
10
|
+
// above the menu and clipped inside the 60dp row.
|
|
11
|
+
@Test
|
|
12
|
+
fun matchesTheSideBySidePairsOfIos() {
|
|
13
|
+
fun d(kind: String, name: String = "", actionKey: String = "") =
|
|
14
|
+
NativeListTrailingDescriptor(kind, name, actionKey)
|
|
15
|
+
|
|
16
|
+
val cases: List<Pair<List<NativeListTrailingDescriptor>, Boolean>> = listOf(
|
|
17
|
+
listOf(d("valuePair")) to false,
|
|
18
|
+
listOf(d("valuePair"), d("menu", actionKey = "menu")) to true,
|
|
19
|
+
listOf(d("valuePair"), d("icon", "DotVerSolid", "menu")) to true,
|
|
20
|
+
listOf(d("valuePair"), d("icon", "DotVerSolid")) to false,
|
|
21
|
+
listOf(d("valuePair"), d("icon", "InfoCircleOutline", "menu")) to false,
|
|
22
|
+
listOf(d("icon", "DotVerSolid", "menu"), d("valuePair")) to false,
|
|
23
|
+
listOf(d("valuePair"), d("chevron")) to true,
|
|
24
|
+
listOf(d("icon", "RefreshCcwOutline"), d("chevron")) to true,
|
|
25
|
+
listOf(d("icon", "RefreshCcwOutline", "refresh"), d("chevron")) to false,
|
|
26
|
+
listOf(d("icon", "PencilOutline", "edit"), d("icon", "DragOutline")) to true,
|
|
27
|
+
listOf(d("value"), d("checkbox")) to true,
|
|
28
|
+
listOf(d("valuePair"), d("icon", "DotVerSolid", "menu"), d("chevron")) to false,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
assertEquals(
|
|
32
|
+
cases.map { it.second },
|
|
33
|
+
cases.map { nativeListIdentityTrailingIsHorizontal(it.first) },
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package com.margelo.nitro.nativelist
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.assertEquals
|
|
4
|
+
import org.junit.Test
|
|
5
|
+
|
|
6
|
+
class NativeListLeadingSlotFrameTest {
|
|
7
|
+
// 40dp box, 16dp badge hanging 2dp past the frame, 2dp pair ring.
|
|
8
|
+
private fun frame(index: Int, count: Int, network: Int? = null, pair: Int? = null) =
|
|
9
|
+
nativeListLeadingSlotFrame(
|
|
10
|
+
index = index,
|
|
11
|
+
sourceCount = count,
|
|
12
|
+
networkIndex = network,
|
|
13
|
+
pairIndex = pair,
|
|
14
|
+
width = 40,
|
|
15
|
+
height = 40,
|
|
16
|
+
badgeSize = 16,
|
|
17
|
+
badgeOverhang = 2,
|
|
18
|
+
pairRing = 2,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
private val full = NativeListSlotFrame(0, 0, 40, 40)
|
|
22
|
+
private val badge = NativeListSlotFrame(26, 26, 16, 16)
|
|
23
|
+
private val primary = NativeListSlotFrame(0, 0, 24, 24)
|
|
24
|
+
private val secondary = NativeListSlotFrame(14, 14, 24, 24)
|
|
25
|
+
|
|
26
|
+
@Test
|
|
27
|
+
fun loneTokenFillsTheBox() {
|
|
28
|
+
assertEquals(full, frame(0, 1))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Test
|
|
32
|
+
fun tokenWithNetworkBadgeKeepsTheCornerBadge() {
|
|
33
|
+
assertEquals(listOf(full, badge), listOf(frame(0, 2, network = 1), frame(1, 2, network = 1)))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// OK-66071: the history swap rows bind [send, network, receive]. Android laid
|
|
37
|
+
// the receive token over the whole box, hiding the send token and the network
|
|
38
|
+
// badge; iOS drew it in the badge's corner slot over the badge.
|
|
39
|
+
@Test
|
|
40
|
+
fun activityPairStepsTheSecondaryToTheBottomRightUnderTheBadge() {
|
|
41
|
+
assertEquals(
|
|
42
|
+
listOf(primary, badge, secondary),
|
|
43
|
+
(0 until 3).map { frame(it, 3, network = 1, pair = 2) },
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@Test
|
|
48
|
+
fun activityPairWithoutNetworkBadge() {
|
|
49
|
+
assertEquals(listOf(primary, secondary), listOf(frame(0, 2, pair = 1), frame(1, 2, pair = 1)))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Test
|
|
53
|
+
fun pairMemberIsSixTenthsOfTheBox() {
|
|
54
|
+
assertEquals(listOf(24, 19, 29), listOf(40, 32, 48).map(::nativeListLeadingPairMemberSize))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Test
|
|
58
|
+
fun stackedImagesStepDiagonally() {
|
|
59
|
+
assertEquals(
|
|
60
|
+
listOf(
|
|
61
|
+
NativeListSlotFrame(0, 5, 29, 29),
|
|
62
|
+
NativeListSlotFrame(6, 5, 29, 29),
|
|
63
|
+
NativeListSlotFrame(11, 5, 29, 29),
|
|
64
|
+
),
|
|
65
|
+
(0 until 3).map { frame(it, 3) },
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
}
|
package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.margelo.nitro.nativelist
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.assertEquals
|
|
4
|
+
import org.junit.Test
|
|
5
|
+
|
|
6
|
+
class NativeListLeadingVisualClipPolicyTest {
|
|
7
|
+
// OK-65694: the account selector's network badge is laid out past the leading
|
|
8
|
+
// frame. Android clips a child to its own bounds while its parent clips
|
|
9
|
+
// children, so a host row must stop clipping exactly when a bound badge
|
|
10
|
+
// overhangs; a plain image keeps the default clipping.
|
|
11
|
+
@Test
|
|
12
|
+
fun hostStopsClippingOnlyForBadgesLaidOutPastTheFrame() {
|
|
13
|
+
data class Case(
|
|
14
|
+
val kind: String,
|
|
15
|
+
val sourceCount: Int = 1,
|
|
16
|
+
val hasCornerIcon: Boolean = false,
|
|
17
|
+
val overlayCount: Int = 0,
|
|
18
|
+
val expected: Boolean,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
val cases = listOf(
|
|
22
|
+
Case(kind = "account", expected = false),
|
|
23
|
+
Case(kind = "account", overlayCount = 1, expected = true),
|
|
24
|
+
Case(kind = "wallet", overlayCount = 2, expected = true),
|
|
25
|
+
Case(kind = "token", sourceCount = 1, expected = false),
|
|
26
|
+
Case(kind = "token", sourceCount = 2, expected = true),
|
|
27
|
+
Case(kind = "stackedImages", sourceCount = 3, expected = false),
|
|
28
|
+
Case(kind = "network", hasCornerIcon = true, expected = true),
|
|
29
|
+
Case(kind = "icon", sourceCount = 0, expected = false),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
assertEquals(
|
|
33
|
+
cases.map(Case::expected),
|
|
34
|
+
cases.map { case ->
|
|
35
|
+
nativeListLeadingVisualOverhangsFrame(
|
|
36
|
+
kind = case.kind,
|
|
37
|
+
sourceCount = case.sourceCount,
|
|
38
|
+
hasCornerIcon = case.hasCornerIcon,
|
|
39
|
+
overlayCount = case.overlayCount,
|
|
40
|
+
)
|
|
41
|
+
},
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -26,6 +26,7 @@ class NativeListPressPolicyTest {
|
|
|
26
26
|
Case(type = "system", variant = "end", expected = false),
|
|
27
27
|
Case(type = "system", variant = "spacer", expected = false),
|
|
28
28
|
Case(type = "walletGroup", expected = false),
|
|
29
|
+
Case(type = "buttonGroup", expected = false),
|
|
29
30
|
)
|
|
30
31
|
|
|
31
32
|
assertEquals(
|
|
@@ -40,4 +41,13 @@ class NativeListPressPolicyTest {
|
|
|
40
41
|
},
|
|
41
42
|
)
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
// OK-65494: a row value such as a network balance is part of the row's hit
|
|
46
|
+
// area; only a text accessory with an action key handles its own tap.
|
|
47
|
+
@Test
|
|
48
|
+
fun trailingTextOwnsItsTapOnlyWithAnAction() {
|
|
49
|
+
assertEquals(false, isNativeListTrailingTextClickable(null))
|
|
50
|
+
assertEquals(false, isNativeListTrailingTextClickable(""))
|
|
51
|
+
assertEquals(true, isNativeListTrailingTextClickable("network.edit"))
|
|
52
|
+
}
|
|
43
53
|
}
|
package/docs/ROW_TEMPLATES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NativeList row template catalog
|
|
2
2
|
|
|
3
|
-
This catalog defines the **
|
|
3
|
+
This catalog defines the **13 types in `RowModel`** on the consolidated spec
|
|
4
4
|
branch. Each template owns a fixed internal structure. Its `style` customizes
|
|
5
5
|
named fields inside that structure; it does not define a new layout or enable a
|
|
6
6
|
list feature. See [STYLE_SPEC.md](STYLE_SPEC.md) for tokens, numeric bounds,
|
|
@@ -34,6 +34,7 @@ template the owner of sections or the indexed bar.
|
|
|
34
34
|
| [metricCard](#metriccard) | KPI or portfolio summary | Label/value card or named composite metrics arrangement |
|
|
35
35
|
| [sectionHeader](#sectionheader) | Structural section heading | Header text + optional summary value/controls |
|
|
36
36
|
| [action](#action) | A row-level command | Label + optional icon/value/controls |
|
|
37
|
+
| [buttonGroup](#buttongroup) | DeFi position actions | One or more equal-width info-outline buttons |
|
|
37
38
|
| [system](#system) | Loading, retry, warning, empty/end or spacer | Variant-specific bounded status content |
|
|
38
39
|
|
|
39
40
|
The style roles below form the shared configurable contract on Web, iOS and
|
|
@@ -53,7 +54,23 @@ separately from source implementation in STYLE_SPEC §9.
|
|
|
53
54
|
|
|
54
55
|
- **Use:** an identifiable asset, account, wallet, network or setting.
|
|
55
56
|
- **Required data:** `leading`, `title`; optional `subtitle`, `tertiary`, `badges`,
|
|
56
|
-
`trailing`, `leadingAction`, match ranges and structured subtitle segments.
|
|
57
|
+
`trailing`, `leadingAction`, `titleIcon`, Web-only `secondaryTitleIcon`, match ranges and structured subtitle segments.
|
|
58
|
+
- **Static title icon:** optional 20-point icon immediately after the title with
|
|
59
|
+
a 4-point gap. It has no click action; an optional Web `hoverActionKey`
|
|
60
|
+
emits an icon-anchored tooltip request on hover or touch. A trailing `button` is the fixed small
|
|
61
|
+
secondary text action and uses the normal accessory event slot.
|
|
62
|
+
- **Title image:** optional `titleImage` renders a circular image after the title
|
|
63
|
+
icons and before suffixes/badges. Its `ImageSource` dimensions must be square,
|
|
64
|
+
1...40 logical units. Optional Web `hoverActionKey` uses the existing anchored
|
|
65
|
+
help event; native keeps the image decorative for touch. See SPEC.md.
|
|
66
|
+
- **Second Web help icon:** `secondaryTitleIcon` uses the same descriptor after
|
|
67
|
+
`titleIcon`; each glyph has its own hover/touch anchor. Native ignores it.
|
|
68
|
+
- **Decorative refresh:** a trailing `RefreshCcwOutline` without `actionKey`
|
|
69
|
+
occupies a 16-point frame and leaves row press with the row.
|
|
70
|
+
- **Web neutral badge:** generic Identity rows with an explicit `tone: 'neutral'`
|
|
71
|
+
use a 20-pixel pill with 12/16 medium text, 8-pixel horizontal and 2-pixel
|
|
72
|
+
vertical padding, and the strong/subdued theme colors. Omitted tone and
|
|
73
|
+
selector presentations keep their existing badge defaults.
|
|
57
74
|
- **Variants:** default horizontal row; `accountSelector` and `networkSelector`
|
|
58
75
|
preserve selector control geometry; `walletSidebar` uses a compact, centered
|
|
59
76
|
wallet presentation. A variant is explicit model data, never inferred from font size.
|
|
@@ -63,11 +80,25 @@ separately from source implementation in STYLE_SPEC §9.
|
|
|
63
80
|
and 12 for other templates (Web 0).
|
|
64
81
|
- **Platform default:** without `subtitleLines` or `style.subtitle.lines`, the
|
|
65
82
|
subtitle shows one line on iOS and Web but two on Android (STYLE_SPEC §6.2).
|
|
83
|
+
- **Recipient opt-in:** `subtitleLines: 0` allows the whole subtitle to wrap;
|
|
84
|
+
`contentHeight: 'auto'` sizes the identity row to that content. Both are
|
|
85
|
+
explicit so existing selector rows retain their geometry. Optional
|
|
86
|
+
`longPressActionKey` emits a row action and suppresses the tap for that gesture.
|
|
66
87
|
- **Text style roles:** `title`, `subtitle`, `tertiary`, `badge`, `value`,
|
|
67
88
|
`valueSecondary`. The last two refer to value accessories in `trailing`; `badge`
|
|
68
89
|
refers to badge text. `value`/`valueSecondary` select the first/second value
|
|
69
90
|
accessory, ignoring intervening controls. A `valuePair` is one accessory, so
|
|
70
|
-
its style applies to both text runs.
|
|
91
|
+
its style applies to both text runs. Optional `primaryTextSegments` and
|
|
92
|
+
`secondaryTextSegments` use the existing subscript run shape per line; missing
|
|
93
|
+
or empty arrays retain the required fallback string. They are semantic roles,
|
|
94
|
+
not extra top-level data fields.
|
|
95
|
+
- **Primary value weight:** optional `valuePair.primaryFontWeight: 'medium'`
|
|
96
|
+
styles only the first line. The second line remains regular; omission keeps
|
|
97
|
+
each platform's existing value-pair typography.
|
|
98
|
+
- **Primary value help:** optional `primaryHelp` on a `valuePair` targets only
|
|
99
|
+
its first line. `presentation` explicitly selects Web Tooltip or cross-platform
|
|
100
|
+
Popover behavior; native Tooltip has no press target. Optional dashed underline
|
|
101
|
+
is visual only. Missing help retains the original passive value pair.
|
|
71
102
|
- **Layout boundary:** reserve visual and accessory slots; text compresses within
|
|
72
103
|
its own column. Styling cannot move a checkbox/menu into the title column,
|
|
73
104
|
reorder accessories or convert a horizontal row into the sidebar presentation.
|
|
@@ -132,7 +163,7 @@ separately from source implementation in STYLE_SPEC §9.
|
|
|
132
163
|

|
|
133
164
|
|
|
134
165
|
- **Use:** a transaction/activity record with amounts and optional commands.
|
|
135
|
-
- **Required data:** `leading`, `title`; optional `secondaryLeading`,
|
|
166
|
+
- **Required data:** `leading`, `title`; optional `hideLeading`, `secondaryLeading`,
|
|
136
167
|
`description`, `status`, `primaryAmount`, `secondaryAmount`, `footerActions`.
|
|
137
168
|
At most three footer actions are accepted, each with a unique key.
|
|
138
169
|
- **Text style roles:** `title`, `description`, `status`, `primaryAmount`,
|
|
@@ -140,6 +171,10 @@ separately from source implementation in STYLE_SPEC §9.
|
|
|
140
171
|
- **Layout boundary:** amounts remain in the amount column, description stays
|
|
141
172
|
in its text region, actions stay in the row's action area. Adding actions is a
|
|
142
173
|
model/height choice, not a typography trick.
|
|
174
|
+
- **Leading visibility:** `hideLeading: true` removes the main visual, its
|
|
175
|
+
accessibility content and its width plus gap. The title and footer actions
|
|
176
|
+
start at the row content inset. The required `leading` model remains valid;
|
|
177
|
+
omitted or `false` retains the existing visual and spacing.
|
|
143
178
|
- **Common-capability boundary:** `footerActions` are inside this activity row.
|
|
144
179
|
The list footer is independently configured through the container.
|
|
145
180
|
|
|
@@ -147,10 +182,14 @@ separately from source implementation in STYLE_SPEC §9.
|
|
|
147
182
|
with at most 32 unique keyed entries. Each entry supports a leading visual,
|
|
148
183
|
tone, primary/secondary text and subscript segments. The title supports at
|
|
149
184
|
most four keyed badges. `descriptionActionKey` emits a description action.
|
|
150
|
-
`presentation: 'table'` allocates
|
|
151
|
-
optional fee
|
|
152
|
-
|
|
153
|
-
|
|
185
|
+
`presentation: 'table'` allocates identity (including the leading visual and
|
|
186
|
+
its gap), amounts and optional fee in a stable `1:1:0.6` ratio after column
|
|
187
|
+
gaps. Without fee, identity and amounts have equal widths. Amount content
|
|
188
|
+
stays start-aligned; native fee content stays end-aligned, while Web retains its
|
|
189
|
+
existing start alignment. Fee text length and leading visibility do not move
|
|
190
|
+
the amount column. `stacked` keeps right-aligned amounts beside identity.
|
|
191
|
+
`fee.hidden` reserves its column while hiding its content. The Web rich
|
|
192
|
+
Activity renderer uses these fields and the same `hideLeading` visibility.
|
|
154
193
|
|
|
155
194
|
```text
|
|
156
195
|
stacked (phone) table (wide)
|
|
@@ -169,11 +208,14 @@ stacked (phone) table (wide)
|
|
|
169
208
|
|
|
170
209
|
- **Use:** a notification or message preview.
|
|
171
210
|
- **Required data:** `title`, `body`, `time`; optional `leading`, `thumbnail`,
|
|
172
|
-
`unread`. `bodyLines` is the legacy fallback for one, two or three body lines
|
|
211
|
+
`unread`. `bodyLines` is the legacy fallback for one, two or three body lines;
|
|
212
|
+
zero opts into unlimited body wrapping and natural height.
|
|
173
213
|
- **Text style roles:** `title`, `body`, `time`. `style.body.lines` accepts one, two or three and takes precedence over `bodyLines`.
|
|
174
214
|
- **Layout boundary:** time and thumbnail keep their allocated regions; body
|
|
175
|
-
text wraps/truncates within the message area.
|
|
176
|
-
|
|
215
|
+
text wraps/truncates within the message area. Unlimited wrapping is explicit
|
|
216
|
+
and remains bounded by the row's 4096-character text limit. The optional
|
|
217
|
+
`inlineWarning` presentation draws requested top/bottom container borders
|
|
218
|
+
across the row width without side borders or rounded corners.
|
|
177
219
|
- **Current divergence:** leading-image size and body typography differ across
|
|
178
220
|
platforms. Larger line boxes need explicit height and visual verification.
|
|
179
221
|
|
|
@@ -249,8 +291,10 @@ stacked (phone) table (wide)
|
|
|
249
291
|
supplies one or two distinct `image`/`video` candidates. It takes precedence
|
|
250
292
|
over `image`; explicit `imageState: empty | error` still suppresses loading.
|
|
251
293
|
A video candidate uses a muted paused native player, with no playback/controls or
|
|
252
|
-
touch target. Detail playback remains caller-owned.
|
|
253
|
-
|
|
294
|
+
touch target. Detail playback remains caller-owned. While loading the slot
|
|
295
|
+
shows a synchronized sheen placeholder; failure advances once to the next
|
|
296
|
+
candidate, then shows the hatched failed placeholder (SPEC: Media loading
|
|
297
|
+
and failure placeholders). The same
|
|
254
298
|
media box and caption diagram apply; this adds no new layout region.
|
|
255
299
|
Web keeps the existing `image` field and does not execute media probing.
|
|
256
300
|
- **Native lifetime:** request identity includes row key, full source, fit,
|
|
@@ -309,6 +353,11 @@ chrome and emits no row action. Omission preserves existing rendering.
|
|
|
309
353
|
icons/actions, checkbox, `sticky`, `indexTitle`. Variants: default, `summary`,
|
|
310
354
|
`gallery`, `history`; `presentation: 'networkSelector'` is also available.
|
|
311
355
|
- **Text style roles:** `title`, `subtitle`, `value`.
|
|
356
|
+
- **DeFi position fields:** optional `leadingBadge` precedes the title.
|
|
357
|
+
`style.valuePlacement: 'afterTitle'` keeps a short value beside the title;
|
|
358
|
+
`style.titleDecoration` explicitly selects plain or dashed title text.
|
|
359
|
+
`valueHelp` uses the same explicit presentation and underline contract as
|
|
360
|
+
`valuePair.primaryHelp`. Omission keeps the original heading behavior.
|
|
312
361
|
- **Layout boundary:** preserve heading/value/control regions. `summary` does
|
|
313
362
|
not accept a checkbox and is not sticky. Pinning and index-entry generation are
|
|
314
363
|
container behavior, not a text-style property.
|
|
@@ -333,6 +382,18 @@ chrome and emits no row action. Omission preserves existing rendering.
|
|
|
333
382
|
`rows`, `fixedFooter` or `emptyState`. The container decides placement and
|
|
334
383
|
visibility; the action template only renders its content.
|
|
335
384
|
|
|
385
|
+
## buttonGroup
|
|
386
|
+
|
|
387
|
+
- **Use:** the full-width DeFi position actions within the list's data stream.
|
|
388
|
+
- **Required data:** a nonempty `buttons` array. Every entry has a unique
|
|
389
|
+
`key`, `label` and `actionKey`; optional `disabled`, `loading`, `testID` and
|
|
390
|
+
`accessibilityLabel` retain one control per entry.
|
|
391
|
+
- **Fixed structure:** equal-width medium info-outline buttons with 10-point
|
|
392
|
+
gaps, 12-point vertical button padding and 12-point radius. Loading retains
|
|
393
|
+
width and disables only its button. Row disable blocks all actions.
|
|
394
|
+
- **Action boundary:** each button emits its own action and anchor slot; the row
|
|
395
|
+
has no independent press action. The SDK never resolves DeFi permissions.
|
|
396
|
+
|
|
336
397
|
## system
|
|
337
398
|
|
|
338
399
|

|