@onekeyfe/react-native-native-list 6.7.0-3 → 6.7.0-30

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 (212) hide show
  1. package/README.md +4 -0
  2. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  3. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
  5. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
  6. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  7. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  8. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
  10. package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
  12. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +1 -1
  16. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  17. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
  18. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
  19. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  20. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
  21. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
  22. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  23. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  24. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1953 -117
  25. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
  26. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  27. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  28. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  29. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  30. package/docs/ROW_TEMPLATES.md +70 -11
  31. package/docs/SPEC.md +1170 -13
  32. package/docs/STYLE_SPEC.md +11 -0
  33. package/ios/HybridNativeList.swift +21 -2
  34. package/ios/NativeListAccessoryStack.swift +237 -51
  35. package/ios/NativeListActivityDetailsView.swift +30 -11
  36. package/ios/NativeListActivityRenderer.swift +8 -2
  37. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  38. package/ios/NativeListDataRowRenderer.swift +167 -30
  39. package/ios/NativeListDesignAssets.swift +13 -75
  40. package/ios/NativeListGeneratedIcons.swift +55 -0
  41. package/ios/NativeListIconBinding.swift +171 -0
  42. package/ios/NativeListIdentityRenderer.swift +256 -39
  43. package/ios/NativeListLeadingVisual.swift +127 -28
  44. package/ios/NativeListMarketRenderer.swift +120 -31
  45. package/ios/NativeListMediaPreviewSlot.swift +122 -61
  46. package/ios/NativeListMediaTileRenderer.swift +7 -3
  47. package/ios/NativeListMessageRenderer.swift +34 -1
  48. package/ios/NativeListMetricCardRenderer.swift +4 -2
  49. package/ios/NativeListModels.swift +42 -2
  50. package/ios/NativeListRendererRegistry.swift +1 -0
  51. package/ios/NativeListResolvedText.swift +2 -1
  52. package/ios/NativeListRowHost.swift +14 -0
  53. package/ios/NativeListSectionHeaderRenderer.swift +100 -4
  54. package/ios/RNCNativeListView.swift +1052 -58
  55. package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
  56. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  57. package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
  58. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  59. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  60. package/ios/tests/NativeListLifecycleTests.swift +2798 -3
  61. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  62. package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
  63. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  64. package/lib/module/NativeList.js +221 -36
  65. package/lib/module/NativeList.web.js +167 -46
  66. package/lib/module/index.js +1 -1
  67. package/lib/module/models.js +3 -0
  68. package/lib/module/selection.js +1 -1
  69. package/lib/module/validation.js +1246 -48
  70. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  71. package/lib/module/web/NativeListWebEngine.js +513 -274
  72. package/lib/module/web/templates/ActivityRowRenderer.js +120 -87
  73. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  74. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  75. package/lib/module/web/templates/IdentityRowRenderer.js +158 -6
  76. package/lib/module/web/templates/MarketTableRowRenderer.js +37 -19
  77. package/lib/module/web/templates/MediaTileRowRenderer.js +4 -14
  78. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  79. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  80. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  81. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  82. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  83. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  84. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  85. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  86. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  87. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  88. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  89. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  90. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  91. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  92. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  93. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  94. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  95. package/lib/typescript/src/NativeList.d.ts +3 -3
  96. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  97. package/lib/typescript/src/NativeList.types.d.ts +20 -2
  98. package/lib/typescript/src/index.d.ts +2 -2
  99. package/lib/typescript/src/models.d.ts +126 -17
  100. package/lib/typescript/src/validation.d.ts +20 -0
  101. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  102. package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
  103. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  104. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  105. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  106. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  107. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  108. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  109. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  110. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  111. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  112. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  113. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  114. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  115. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  116. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  117. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  118. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  119. package/package.json +16 -10
  120. package/react-native-native-list.podspec +2 -6
  121. package/scripts/generate-icons.mjs +150 -0
  122. package/scripts/generate-icons.test.mjs +288 -0
  123. package/scripts/native-list-icons.json +260 -0
  124. package/src/NativeList.nitro.ts +2 -0
  125. package/src/NativeList.tsx +416 -89
  126. package/src/NativeList.types.ts +24 -2
  127. package/src/NativeList.web.tsx +295 -89
  128. package/src/index.ts +2 -0
  129. package/src/models.ts +263 -144
  130. package/src/selection.ts +1 -0
  131. package/src/validation.ts +3013 -152
  132. package/src/web/NativeListGeneratedIcons.ts +28 -0
  133. package/src/web/NativeListWebEngine.ts +816 -343
  134. package/src/web/templates/ActivityRowRenderer.ts +178 -141
  135. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  136. package/src/web/templates/DataRowRenderer.ts +93 -20
  137. package/src/web/templates/IdentityRowRenderer.ts +231 -6
  138. package/src/web/templates/MarketTableRowRenderer.ts +56 -33
  139. package/src/web/templates/MediaTileRowRenderer.ts +4 -17
  140. package/src/web/templates/MessageRowRenderer.ts +23 -7
  141. package/src/web/templates/RowContainerStyle.ts +2 -0
  142. package/src/web/templates/RowRendererRegistry.ts +11 -1
  143. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
  144. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  145. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  146. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  147. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  148. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  152. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  153. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  154. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  155. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  156. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  157. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  158. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  159. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  160. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  161. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  162. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  163. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  164. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  165. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  166. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  167. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  168. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  169. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  170. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  171. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  172. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  173. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  174. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  175. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  176. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  177. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  178. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  179. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  180. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  181. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  182. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  183. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  184. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  185. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  186. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  187. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  188. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  189. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  190. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  191. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  192. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  193. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  194. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  195. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  196. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  197. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  198. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  199. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  200. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  201. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  202. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  203. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  204. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  205. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  206. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  207. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  208. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  209. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  210. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  211. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  212. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
@@ -1,5 +1,5 @@
1
1
  import type { ScrollEdgeEffect } from './ScrollEdgeEffect';
2
- import type { ReactNode, RefObject } from 'react';
2
+ import type { ElementRef, ReactNode, RefObject } from 'react';
3
3
  import type { View, ViewProps } from 'react-native';
4
4
  import type {
5
5
  ActionAnchorInvalidatedEvent,
@@ -78,6 +78,18 @@ export type NativeListWebScrollHost = Readonly<{
78
78
  scrollTop: number;
79
79
  }>;
80
80
 
81
+ export type NativeListSidecarLayout = Readonly<{
82
+ width: number;
83
+ gap: number;
84
+ maxContentWidth: number;
85
+ }>;
86
+
87
+ export type StructuralTransitionSettledEvent = Readonly<{
88
+ transitionId: string;
89
+ status: 'completed' | 'interrupted';
90
+ settledExpanded: boolean;
91
+ }>;
92
+
81
93
  type InitialScrollProps =
82
94
  | Readonly<{
83
95
  initialScrollIndex?: never;
@@ -131,6 +143,13 @@ export type NativeListProps = Omit<ViewProps, 'children'> &
131
143
  listHeader?: ReactNode;
132
144
  listFooter?: ReactNode;
133
145
  listEmpty?: ReactNode;
146
+ /** Native disclosure content, retained until its transition settles. */
147
+ listExpandedContent?: ReactNode;
148
+ /** Stable native disclosure toggle after expanded content. */
149
+ listStructureToggle?: ReactNode;
150
+ /** Scrolling right column for a vertical linear list. Requires sidecarLayout. */
151
+ listSidecar?: ReactNode;
152
+ sidecarLayout?: NativeListSidecarLayout;
134
153
  /** Fixed overlay above scrolling rows on iOS 26 and newer. */
135
154
  topOverlay?: ReactNode;
136
155
  /** Selects UIKit's top scroll-edge effect on iOS 26 and newer. */
@@ -142,7 +161,7 @@ export type NativeListProps = Omit<ViewProps, 'children'> &
142
161
  /** Web only: visible sticky chrome above the parent's list viewport. */
143
162
  webStickyInset?: number;
144
163
  /** Web only. Hosts the section index inside this container. */
145
- webSectionIndexContainerRef?: RefObject<View | null>;
164
+ webSectionIndexContainerRef?: RefObject<ElementRef<typeof View> | null>;
146
165
  /** Defaults to `none`. `interactive` behaves as `none` on Android. */
147
166
  keyboardDismissMode?: NativeListKeyboardDismissMode;
148
167
  /**
@@ -156,6 +175,9 @@ export type NativeListProps = Omit<ViewProps, 'children'> &
156
175
  onReorder?: (event: ReorderEvent) => void;
157
176
  onEndReached?: (event: EndReachedEvent) => void;
158
177
  onVisibleRangeChanged?: (event: VisibleRangeChangedEvent) => void;
178
+ onStructuralTransitionSettled?: (
179
+ event: StructuralTransitionSettledEvent
180
+ ) => void;
159
181
  /** Native only. Emits initial state and hysteresis transitions, not scroll frames. */
160
182
  scrollPositionThresholds?: Readonly<{
161
183
  start: number;
@@ -21,7 +21,12 @@ import {
21
21
  validateOffset,
22
22
  type NormalizedPositionScroll,
23
23
  } from './scrolling';
24
- import { applyRowPatches, validateSnapshot } from './validation';
24
+ import {
25
+ applyRowPatches,
26
+ containNativeListInput,
27
+ emptyNativeListSnapshot,
28
+ validateSnapshot,
29
+ } from './validation';
25
30
  import {
26
31
  NativeListWebEngine,
27
32
  type NativeListWebCallbacks,
@@ -31,6 +36,8 @@ import {
31
36
  canonicalNativeListAvatarUri,
32
37
  } from './web/NativeListWebAvatarCache';
33
38
 
39
+ const collapsedExpandedContentStyle = { display: 'none' } as const;
40
+
34
41
  export type { NativeListProps, NativeListRef } from './NativeList.types';
35
42
  export type {
36
43
  ActionAnchorState,
@@ -83,14 +90,18 @@ export function preloadNativeListAvatarImages(
83
90
  export const NativeList = forwardRef<NativeListRef, NativeListProps>(
84
91
  function NativeList(
85
92
  {
86
- snapshot,
93
+ snapshot: inputSnapshot,
87
94
  listHeader,
88
95
  listEmpty,
89
96
  listFooter,
97
+ listExpandedContent,
98
+ listStructureToggle,
99
+ listSidecar,
100
+ sidecarLayout,
90
101
  topOverlay: _topOverlay,
91
102
  topScrollEdgeEffect: _topScrollEdgeEffect,
92
103
  webScrollHost,
93
- webStickyInset = 0,
104
+ webStickyInset: inputStickyInset = 0,
94
105
  scrollPositionThresholds: _scrollPositionThresholds,
95
106
  onScrollPositionThresholdChange: _onScrollPositionThresholdChange,
96
107
  webVirtualizationEnabled = true,
@@ -103,6 +114,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
103
114
  onReorder,
104
115
  onEndReached,
105
116
  onVisibleRangeChanged,
117
+ onStructuralTransitionSettled: _onStructuralTransitionSettled,
106
118
  onRefresh,
107
119
  onScrollToIndexFailed,
108
120
  initialScrollIndex,
@@ -113,55 +125,58 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
113
125
  },
114
126
  forwardedRef
115
127
  ) {
128
+ const acceptedSnapshotRef = useRef<NativeListSnapshot>(
129
+ emptyNativeListSnapshot()
130
+ );
131
+ const initializedSnapshot = useRef(false);
132
+ const webStickyInset = useMemo(
133
+ () =>
134
+ containNativeListInput(() => {
135
+ if (!Number.isFinite(inputStickyInset) || inputStickyInset < 0)
136
+ throw new Error('webStickyInset must be finite and non-negative');
137
+ return inputStickyInset;
138
+ }) ?? 0,
139
+ [inputStickyInset]
140
+ );
141
+ // Freshness is limited to this component invocation; later renders revalidate.
142
+ let freshlyValidatedSnapshot: NativeListSnapshot | undefined;
143
+ const preparedSnapshot = useMemo(() => {
144
+ const prepared = containNativeListInput(() =>
145
+ validateSnapshot(inputSnapshot)
146
+ );
147
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- The value is intentionally render-local.
148
+ freshlyValidatedSnapshot = prepared;
149
+ return prepared;
150
+ }, [inputSnapshot]);
151
+ const snapshot = preparedSnapshot ?? acceptedSnapshotRef.current;
116
152
  const fontFamiliesJson = useNativeListFontFamiliesJson();
117
153
  const fontFamiliesJsonRef = useRef(fontFamiliesJson);
118
154
  fontFamiliesJsonRef.current = fontFamiliesJson;
119
155
  const hasEmptySlot = listEmpty !== undefined;
120
156
  const hasEmptySlotRef = useRef(hasEmptySlot);
121
157
  hasEmptySlotRef.current = hasEmptySlot;
122
- const [slotState, setSlotState] = useState(() => ({
123
- hasRows: snapshot.rows.length > 0,
124
- emptyBottomPadding:
125
- !snapshot.rows.length && hasEmptySlot
126
- ? snapshot.layout.contentPaddingBottom ??
127
- snapshot.layout.contentPadding ??
128
- 0
129
- : 0,
130
- padding:
131
- snapshot.layout.contentPaddingHorizontal ??
132
- snapshot.layout.contentPadding ??
133
- 0,
134
- }));
135
- const synchronizeSlots = (next: NativeListSnapshot) => {
136
- const hasRows = next.rows.length > 0;
137
- const padding =
138
- next.layout.contentPaddingHorizontal ?? next.layout.contentPadding ?? 0;
139
- const emptyBottomPadding =
140
- !hasRows && hasEmptySlotRef.current
141
- ? next.layout.contentPaddingBottom ?? next.layout.contentPadding ?? 0
142
- : 0;
143
- setSlotState((previous) =>
144
- previous.hasRows === hasRows &&
145
- previous.padding === padding &&
146
- previous.emptyBottomPadding === emptyBottomPadding
147
- ? previous
148
- : { hasRows, padding, emptyBottomPadding }
149
- );
150
- };
158
+ const [viewportWidth, setViewportWidth] = useState(0);
159
+ const [sidecarHeight, setSidecarHeight] = useState(0);
151
160
  const normalizeWebSnapshot = (
152
161
  next: NativeListSnapshot,
153
162
  hasReactEmpty = hasEmptySlotRef.current,
154
- hasSlotLayout = useSlotLayoutRef.current
163
+ hasSlotLayout = useSlotLayoutRef.current,
164
+ validatedInThisRender = false
155
165
  ) => {
156
166
  if (hasSlotLayout && next.layout.orientation === 'horizontal')
157
167
  throw new Error(
158
168
  'Web parent scrolling and container slots support vertical lists only'
159
169
  );
160
170
  const emptySlot = hasReactEmpty && next.rows.length === 0;
161
- const validated = validateSnapshot(
162
- emptySlot ? { ...next, emptyState: undefined } : next
163
- );
164
- return emptySlot
171
+ const normalized =
172
+ emptySlot && next.emptyState !== undefined
173
+ ? { ...next, emptyState: undefined }
174
+ : next;
175
+ const validated = validatedInThisRender
176
+ ? normalized
177
+ : validateSnapshot(normalized);
178
+ // Preserve an already normalized fallback's identity across rerenders.
179
+ return emptySlot && validated.layout.contentPaddingBottom !== 0
165
180
  ? {
166
181
  ...validated,
167
182
  layout: { ...validated.layout, contentPaddingBottom: 0 },
@@ -181,6 +196,9 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
181
196
  listHeader !== undefined ||
182
197
  listEmpty !== undefined ||
183
198
  listFooter !== undefined;
199
+ useSlotLayoutRef.current ||= listSidecar !== undefined;
200
+ useSlotLayoutRef.current ||=
201
+ listExpandedContent !== undefined || listStructureToggle !== undefined;
184
202
  const useSlotLayout = useSlotLayoutRef.current;
185
203
  const resolvedScrollHost =
186
204
  webScrollHost === undefined
@@ -188,22 +206,103 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
188
206
  ? ownedScrollHost
189
207
  : undefined
190
208
  : webScrollHost;
191
- if (!Number.isFinite(webStickyInset) || webStickyInset < 0)
192
- throw new Error('webStickyInset must be finite and non-negative');
193
209
  const engineRef = useRef<NativeListWebEngine | undefined>(undefined);
194
210
  const webVirtualizationEnabledRef = useRef(webVirtualizationEnabled);
195
211
  webVirtualizationEnabledRef.current = webVirtualizationEnabled;
196
212
  const validatedSnapshot = useMemo(
197
- () => normalizeWebSnapshot(snapshot, hasEmptySlot, useSlotLayout),
198
- [snapshot, hasEmptySlot, useSlotLayout]
213
+ () =>
214
+ containNativeListInput(() => {
215
+ if ((listSidecar !== undefined) !== (sidecarLayout !== undefined))
216
+ throw new Error(
217
+ 'listSidecar and sidecarLayout must be supplied together'
218
+ );
219
+ if (sidecarLayout) {
220
+ const { width, gap, maxContentWidth } = sidecarLayout;
221
+ if (
222
+ snapshot.layout.kind !== 'linear' ||
223
+ !Number.isFinite(width) ||
224
+ width <= 0 ||
225
+ !Number.isFinite(gap) ||
226
+ gap < 0 ||
227
+ !Number.isFinite(maxContentWidth) ||
228
+ maxContentWidth <= width + gap
229
+ )
230
+ throw new Error('Invalid NativeList sidecar layout');
231
+ }
232
+ return normalizeWebSnapshot(
233
+ snapshot,
234
+ hasEmptySlot,
235
+ useSlotLayout,
236
+ preparedSnapshot !== undefined &&
237
+ preparedSnapshot === freshlyValidatedSnapshot
238
+ );
239
+ }) ?? acceptedSnapshotRef.current,
240
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- Preserve the existing memo dependencies; freshness is render-local.
241
+ [snapshot, hasEmptySlot, useSlotLayout, listSidecar, sidecarLayout]
199
242
  );
243
+ const [slotState, setSlotState] = useState(() => ({
244
+ hasRows: validatedSnapshot.rows.length > 0,
245
+ emptyBottomPadding:
246
+ !validatedSnapshot.rows.length && hasEmptySlot
247
+ ? validatedSnapshot.layout.contentPaddingBottom ??
248
+ validatedSnapshot.layout.contentPadding ??
249
+ 0
250
+ : 0,
251
+ padding:
252
+ validatedSnapshot.layout.contentPaddingHorizontal ??
253
+ validatedSnapshot.layout.contentPadding ??
254
+ 0,
255
+ disclosurePresent: validatedSnapshot.disclosure !== undefined,
256
+ disclosureExpanded: validatedSnapshot.disclosure?.expanded === true,
257
+ hasExpandedContent: validatedSnapshot.disclosure?.expanded === true,
258
+ expandedTrailingInset:
259
+ validatedSnapshot.disclosure?.expandedTrailingInset ?? 0,
260
+ }));
261
+ const synchronizeSlots = (next: NativeListSnapshot) => {
262
+ const hasRows = next.rows.length > 0;
263
+ const padding =
264
+ next.layout.contentPaddingHorizontal ?? next.layout.contentPadding ?? 0;
265
+ const emptyBottomPadding =
266
+ !hasRows && hasEmptySlotRef.current
267
+ ? next.layout.contentPaddingBottom ?? next.layout.contentPadding ?? 0
268
+ : 0;
269
+ const disclosurePresent = next.disclosure !== undefined;
270
+ const disclosureExpanded = next.disclosure?.expanded === true;
271
+ const expandedTrailingInset = next.disclosure?.expandedTrailingInset ?? 0;
272
+ setSlotState((previous) => {
273
+ const hasExpandedContent =
274
+ previous.hasExpandedContent || disclosureExpanded;
275
+ return previous.hasRows === hasRows &&
276
+ previous.padding === padding &&
277
+ previous.emptyBottomPadding === emptyBottomPadding &&
278
+ previous.disclosurePresent === disclosurePresent &&
279
+ previous.disclosureExpanded === disclosureExpanded &&
280
+ previous.hasExpandedContent === hasExpandedContent &&
281
+ previous.expandedTrailingInset === expandedTrailingInset
282
+ ? previous
283
+ : {
284
+ hasRows,
285
+ padding,
286
+ emptyBottomPadding,
287
+ disclosurePresent,
288
+ disclosureExpanded,
289
+ hasExpandedContent,
290
+ expandedTrailingInset,
291
+ };
292
+ });
293
+ };
200
294
  const snapshotRef = useRef(validatedSnapshot);
201
295
  const snapshotPropRef = useRef(validatedSnapshot);
202
296
  // An imperative snapshot survives host mounting until the snapshot prop changes.
203
297
  if (snapshotPropRef.current !== validatedSnapshot) {
204
298
  snapshotPropRef.current = validatedSnapshot;
205
299
  snapshotRef.current = validatedSnapshot;
206
- synchronizeSlots(snapshot);
300
+ acceptedSnapshotRef.current = validatedSnapshot;
301
+ synchronizeSlots(validatedSnapshot);
302
+ }
303
+ if (!initializedSnapshot.current) {
304
+ acceptedSnapshotRef.current = validatedSnapshot;
305
+ initializedSnapshot.current = true;
207
306
  }
208
307
  const appliedSnapshotRef = useRef<NativeListSnapshot | undefined>(
209
308
  undefined
@@ -227,26 +326,28 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
227
326
  }>
228
327
  | undefined
229
328
  >(
230
- initialScrollIndex === undefined && initialScrollKey === undefined
231
- ? undefined
232
- : initialScrollIndex !== undefined
233
- ? normalizeIndexScroll({
234
- index: initialScrollIndex,
235
- animated: false,
236
- viewPosition: initialScrollViewPosition,
237
- viewOffset: initialScrollViewOffset,
238
- })
239
- : {
240
- key: initialScrollKey,
241
- scroll: normalizePositionScroll(
242
- {
243
- animated: false,
244
- viewPosition: initialScrollViewPosition,
245
- viewOffset: initialScrollViewOffset,
246
- },
247
- 'start'
248
- ),
249
- }
329
+ containNativeListInput(() =>
330
+ initialScrollIndex === undefined && initialScrollKey === undefined
331
+ ? undefined
332
+ : initialScrollIndex !== undefined
333
+ ? normalizeIndexScroll({
334
+ index: initialScrollIndex,
335
+ animated: false,
336
+ viewPosition: initialScrollViewPosition,
337
+ viewOffset: initialScrollViewOffset,
338
+ })
339
+ : {
340
+ key: initialScrollKey,
341
+ scroll: normalizePositionScroll(
342
+ {
343
+ animated: false,
344
+ viewPosition: initialScrollViewPosition,
345
+ viewOffset: initialScrollViewOffset,
346
+ },
347
+ 'start'
348
+ ),
349
+ }
350
+ )
250
351
  );
251
352
  const didApplyInitialScroll = useRef(false);
252
353
  const scrollOptionsRef = useRef({
@@ -265,19 +366,23 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
265
366
  (useSlotLayout && !contentBounds)
266
367
  )
267
368
  return;
268
- const engine = new NativeListWebEngine(
269
- host,
270
- snapshotRef.current,
271
- callbacksRef.current,
272
- webVirtualizationEnabledRef.current,
273
- webSectionIndexContainerRef?.current as unknown as HTMLElement | null,
274
- fontFamiliesJsonRef.current,
275
- {
276
- scrollHost: resolvedScrollHost as HTMLElement | undefined,
277
- contentBounds: contentBounds ?? undefined,
278
- ...scrollOptionsRef.current,
279
- }
369
+ const engine = containNativeListInput(
370
+ () =>
371
+ new NativeListWebEngine(
372
+ host,
373
+ snapshotRef.current,
374
+ callbacksRef.current,
375
+ webVirtualizationEnabledRef.current,
376
+ webSectionIndexContainerRef?.current as unknown as HTMLElement | null,
377
+ fontFamiliesJsonRef.current,
378
+ {
379
+ scrollHost: resolvedScrollHost as HTMLElement | undefined,
380
+ contentBounds: contentBounds ?? undefined,
381
+ ...scrollOptionsRef.current,
382
+ }
383
+ )
280
384
  );
385
+ if (!engine) return;
281
386
  host.style.height = '';
282
387
  engineRef.current = engine;
283
388
  appliedSnapshotRef.current = snapshotRef.current;
@@ -337,21 +442,28 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
337
442
 
338
443
  useImperativeHandle(forwardedRef, () => ({
339
444
  applySnapshot(nextSnapshot) {
340
- const next = normalizeWebSnapshot(nextSnapshot);
445
+ const next = containNativeListInput(() =>
446
+ normalizeWebSnapshot(nextSnapshot)
447
+ );
448
+ if (!next) return;
341
449
  engineRef.current?.applySnapshot(next);
342
450
  snapshotRef.current = next;
451
+ acceptedSnapshotRef.current = next;
343
452
  appliedSnapshotRef.current = next;
344
- synchronizeSlots(nextSnapshot);
453
+ synchronizeSlots(next);
345
454
  },
346
455
  applyPatches(patches) {
347
- if (patches.length > 0) {
348
- const engine = engineRef.current;
349
- if (engine) {
350
- engine.applyPatches(patches);
351
- snapshotRef.current = engine.currentSnapshot();
352
- } else
353
- snapshotRef.current = applyRowPatches(snapshotRef.current, patches);
456
+ const engine = engineRef.current;
457
+ if (engine) {
458
+ engine.applyPatches(patches);
459
+ snapshotRef.current = engine.currentSnapshot();
460
+ } else {
461
+ const next = containNativeListInput(() =>
462
+ applyRowPatches(snapshotRef.current, patches)
463
+ );
464
+ if (next) snapshotRef.current = next;
354
465
  }
466
+ acceptedSnapshotRef.current = snapshotRef.current;
355
467
  },
356
468
  reconcileSelection(selectedKeys) {
357
469
  engineRef.current?.reconcileSelection(selectedKeys);
@@ -436,17 +548,35 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
436
548
  },
437
549
  []
438
550
  );
551
+ const ownedScrollElementRef = useRef<HTMLElement | null>(null);
439
552
  const setScrollHostRef = useCallback(
440
553
  (value: React.ComponentRef<typeof View> | null) => {
441
- setOwnedScrollHost(value as unknown as HTMLElement | null);
554
+ const element = value as unknown as HTMLElement | null;
555
+ if (ownedScrollElementRef.current !== element)
556
+ ownedScrollElementRef.current?.removeAttribute(
557
+ 'data-collapsible-pager-scroll'
558
+ );
559
+ element?.setAttribute('data-collapsible-pager-scroll', 'true');
560
+ ownedScrollElementRef.current = element;
561
+ setOwnedScrollHost(element);
442
562
  },
443
563
  []
444
564
  );
445
565
  if (!useSlotLayout) return <View {...viewProps} ref={setHostRef} />;
446
566
  const padding = slotState.padding;
567
+ const footerBandStyle = { paddingHorizontal: padding };
568
+ const trailingInsetStyle = {
569
+ height: slotState.disclosureExpanded
570
+ ? slotState.expandedTrailingInset
571
+ : 0,
572
+ };
573
+ const hasFooterBand =
574
+ listFooter !== undefined ||
575
+ listExpandedContent !== undefined ||
576
+ listStructureToggle !== undefined;
447
577
  const content = (
448
578
  <View
449
- ref={setBoundsRef}
579
+ ref={sidecarLayout ? undefined : setBoundsRef}
450
580
  style={{ position: 'relative', flexShrink: 0, minWidth: 0 }}
451
581
  >
452
582
  {listHeader !== undefined ? (
@@ -463,14 +593,90 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
463
593
  {listEmpty}
464
594
  </View>
465
595
  ) : null}
466
- {listFooter !== undefined ? (
467
- <View style={{ paddingHorizontal: padding }}>{listFooter}</View>
596
+ {hasFooterBand ? (
597
+ <View testID="native-list-footer-slot" style={footerBandStyle}>
598
+ {listExpandedContent !== undefined &&
599
+ slotState.hasExpandedContent ? (
600
+ <View
601
+ testID="native-list-expanded-content-slot"
602
+ aria-hidden={!slotState.disclosureExpanded}
603
+ pointerEvents={slotState.disclosureExpanded ? 'auto' : 'none'}
604
+ style={
605
+ slotState.disclosureExpanded
606
+ ? undefined
607
+ : collapsedExpandedContentStyle
608
+ }
609
+ >
610
+ {listExpandedContent}
611
+ </View>
612
+ ) : null}
613
+ {listStructureToggle !== undefined ? (
614
+ <View
615
+ testID="native-list-structure-toggle-slot"
616
+ aria-hidden={!slotState.disclosurePresent}
617
+ pointerEvents={slotState.disclosurePresent ? 'auto' : 'none'}
618
+ style={
619
+ slotState.disclosurePresent
620
+ ? undefined
621
+ : collapsedExpandedContentStyle
622
+ }
623
+ >
624
+ {listStructureToggle}
625
+ </View>
626
+ ) : null}
627
+ {slotState.expandedTrailingInset > 0 &&
628
+ (listExpandedContent !== undefined ||
629
+ listStructureToggle !== undefined) ? (
630
+ <View
631
+ testID="native-list-trailing-inset-slot"
632
+ style={trailingInsetStyle}
633
+ />
634
+ ) : null}
635
+ {listFooter}
636
+ </View>
468
637
  ) : null}
469
638
  </View>
470
639
  );
640
+ const bandWidth = sidecarLayout
641
+ ? Math.min(viewportWidth, sidecarLayout.maxContentWidth)
642
+ : 0;
643
+ const sidecarMargin = Math.max(0, (viewportWidth - bandWidth) / 2);
644
+ const leftWidth = Math.max(
645
+ 0,
646
+ bandWidth - (sidecarLayout?.width ?? 0) - (sidecarLayout?.gap ?? 0)
647
+ );
648
+ const scrollContent = sidecarLayout ? (
649
+ <View
650
+ ref={setBoundsRef}
651
+ style={{ position: 'relative', minHeight: sidecarHeight }}
652
+ >
653
+ <View style={{ marginStart: sidecarMargin, width: leftWidth }}>
654
+ {content}
655
+ </View>
656
+ <View
657
+ style={{
658
+ position: 'absolute',
659
+ end: sidecarMargin,
660
+ top: 0,
661
+ width: sidecarLayout.width,
662
+ }}
663
+ onLayout={(event) =>
664
+ setSidecarHeight(event.nativeEvent.layout.height)
665
+ }
666
+ >
667
+ {listSidecar}
668
+ </View>
669
+ </View>
670
+ ) : (
671
+ content
672
+ );
471
673
  return (
472
674
  <View
473
675
  {...viewProps}
676
+ onLayout={(event) => {
677
+ setViewportWidth(event.nativeEvent.layout.width);
678
+ viewProps.onLayout?.(event);
679
+ }}
474
680
  style={[viewProps.style, { position: 'relative', minHeight: 0 }]}
475
681
  >
476
682
  {webScrollHost === undefined ? (
@@ -478,10 +684,10 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
478
684
  ref={setScrollHostRef}
479
685
  style={{ position: 'absolute', inset: 0, overflow: 'scroll' }}
480
686
  >
481
- {content}
687
+ {scrollContent}
482
688
  </View>
483
689
  ) : (
484
- content
690
+ scrollContent
485
691
  )}
486
692
  </View>
487
693
  );
package/src/index.ts CHANGED
@@ -14,10 +14,12 @@ export type {
14
14
  ScrollToKeyParams,
15
15
  ScrollToLocationParams,
16
16
  ScrollToOffsetParams,
17
+ StructuralTransitionSettledEvent,
17
18
  } from './NativeList';
18
19
  export type * from './models';
19
20
  export {
20
21
  applyRowPatches,
22
+ planNativeListPatches,
21
23
  serializePatches,
22
24
  serializeSnapshot,
23
25
  validatePatches,