@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,17 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  import { useNativeListFontFamiliesJson } from "./fonts.js";
4
- import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
4
+ import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
5
5
  import { OneKeyImageCache, OneKeyImageCachePolicy } from '@onekeyfe/react-native-image';
6
6
  import { NativeAvatarPrefetchModel, NativeAvatarPrefetchQueue } from "./avatarPrefetch.js";
7
7
  import { Platform, View } from 'react-native';
8
8
  import { callback, getHostComponent } from 'react-native-nitro-modules';
9
9
  import { isSelectableRow } from "./selection.js";
10
10
  import { normalizeIndexScroll, normalizeKeyScroll, normalizePositionScroll, resolveLocationIndex, scrollFailure, validateOffset } from "./scrolling.js";
11
- import { applyRowPatches, serializePatches, serializeSnapshot } from "./validation.js";
11
+ import { applyOwnedNativePatches, captureNativeListInput, containNativeListInput, emptyNativeListSnapshot, ownValidatedNativeSnapshot, validateSnapshot } from "./validation.js";
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  const NativeListConfig = require('../nitrogen/generated/shared/json/NativeListConfig.json');
14
14
  const NativeListHost = getHostComponent('NativeList', () => NativeListConfig);
15
+ const clearedStructuralTransitionSettled = {
16
+ f: undefined
17
+ };
18
+ const disclosureSlotMeasurementStyle = {
19
+ alignSelf: 'stretch'
20
+ };
15
21
  export function preloadNativeListAvatarImages(sources) {
16
22
  return OneKeyImageCache.preload(sources.map(source => ({
17
23
  uri: source.uri,
@@ -27,10 +33,14 @@ function parsePayload(payloadJson) {
27
33
  return JSON.parse(payloadJson);
28
34
  }
29
35
  export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
30
- snapshot,
36
+ snapshot: inputSnapshot,
31
37
  listHeader,
32
38
  listFooter,
33
39
  listEmpty,
40
+ listSidecar,
41
+ listExpandedContent,
42
+ listStructureToggle,
43
+ sidecarLayout,
34
44
  topOverlay,
35
45
  topScrollEdgeEffect,
36
46
  scrollPositionThresholds,
@@ -46,6 +56,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
46
56
  onReorder,
47
57
  onEndReached,
48
58
  onVisibleRangeChanged,
59
+ onStructuralTransitionSettled,
49
60
  onScrollPositionThresholdChange,
50
61
  onRefresh,
51
62
  onScrollToIndexFailed,
@@ -55,16 +66,120 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
55
66
  initialScrollViewOffset,
56
67
  ...viewProps
57
68
  }, forwardedRef) {
69
+ const snapshotRef = useRef(emptyNativeListSnapshot());
70
+ const needsNativeSnapshotRef = useRef(false);
71
+ const renderedSnapshotRef = useRef(undefined);
72
+ const initializedSnapshot = useRef(false);
73
+ const pendingDisclosureSnapshotRef = useRef(undefined);
74
+ const previousPropInputRef = useRef(inputSnapshot);
75
+ const [pendingDisclosureRevision, setPendingDisclosureRevision] = useState(0);
76
+ const disclosureSlotMounts = useRef({
77
+ expandedPresent: false,
78
+ togglePresent: false,
79
+ expandedEpoch: 0,
80
+ toggleEpoch: 0
81
+ });
82
+ const expandedPresent = listExpandedContent != null;
83
+ const togglePresent = listStructureToggle != null;
84
+ if (disclosureSlotMounts.current.expandedPresent !== expandedPresent) {
85
+ disclosureSlotMounts.current.expandedPresent = expandedPresent;
86
+ disclosureSlotMounts.current.expandedEpoch += 1;
87
+ }
88
+ if (disclosureSlotMounts.current.togglePresent !== togglePresent) {
89
+ disclosureSlotMounts.current.togglePresent = togglePresent;
90
+ disclosureSlotMounts.current.toggleEpoch += 1;
91
+ }
92
+ const expandedEpoch = disclosureSlotMounts.current.expandedEpoch;
93
+ const toggleEpoch = disclosureSlotMounts.current.toggleEpoch;
94
+ const [slotMeasurements, setSlotMeasurements] = useState({
95
+ heights: [0, 0, 0, 0, 0, 0],
96
+ readyEpochs: [-1, -1, -1, -1, -1, -1]
97
+ });
98
+ const hasSidecar = listSidecar !== undefined;
99
+ const sidecarWidth = sidecarLayout?.width;
100
+ const sidecarGap = sidecarLayout?.gap;
101
+ const sidecarMaxContentWidth = sidecarLayout?.maxContentWidth;
102
+ const hasContainerSlots = Boolean(listHeader || listEmpty || listFooter || listSidecar || listExpandedContent || listStructureToggle);
103
+ const validateContainerConfiguration = useCallback(accepted => {
104
+ if (hasContainerSlots && accepted.layout.orientation === 'horizontal') throw new Error('NativeList container slots require vertical orientation');
105
+ if (hasSidecar !== (sidecarWidth !== undefined)) throw new Error('listSidecar and sidecarLayout must be supplied together');
106
+ if (sidecarWidth !== undefined) {
107
+ const width = sidecarWidth;
108
+ const gap = sidecarGap ?? NaN;
109
+ const maxContentWidth = sidecarMaxContentWidth ?? NaN;
110
+ if (accepted.layout.kind !== 'linear' || !Number.isFinite(width) || width <= 0 || !Number.isFinite(gap) || gap < 0 || !Number.isFinite(maxContentWidth) || maxContentWidth <= width + gap) throw new Error('Invalid NativeList sidecar layout');
111
+ }
112
+ }, [hasContainerSlots, hasSidecar, sidecarWidth, sidecarGap, sidecarMaxContentWidth]);
113
+ const prepareSnapshot = useCallback(next => {
114
+ const accepted = validateSnapshot(captureNativeListInput(next));
115
+ validateContainerConfiguration(accepted);
116
+ return ownValidatedNativeSnapshot(accepted);
117
+ }, [validateContainerConfiguration]);
118
+ const expandedReadyEpoch = slotMeasurements.readyEpochs[4];
119
+ const toggleReadyEpoch = slotMeasurements.readyEpochs[5];
120
+ const snapshot = useMemo(() => {
121
+ // Imperative pending snapshots use this revision to retry the readiness gate.
122
+ // eslint-disable-next-line no-void -- Reading this revision invalidates the readiness memo.
123
+ void pendingDisclosureRevision;
124
+ const propReplaced = previousPropInputRef.current !== inputSnapshot;
125
+ previousPropInputRef.current = inputSnapshot;
126
+ const pending = pendingDisclosureSnapshotRef.current;
127
+ const retained = pending && !propReplaced && (pending.source === 'imperative' || pending.input === inputSnapshot) && pending.expandedEpoch === expandedEpoch && pending.toggleEpoch === toggleEpoch ? pending : undefined;
128
+ const candidate = retained?.owned ?? (!propReplaced && initializedSnapshot.current ? renderedSnapshotRef.current ?? snapshotRef.current : containNativeListInput(() => prepareSnapshot(inputSnapshot)) ?? snapshotRef.current);
129
+ const acceptedCandidate = !propReplaced && initializedSnapshot.current ? containNativeListInput(() => {
130
+ validateContainerConfiguration(candidate);
131
+ return candidate;
132
+ }) : candidate;
133
+ if (!acceptedCandidate) {
134
+ pendingDisclosureSnapshotRef.current = undefined;
135
+ return renderedSnapshotRef.current ?? snapshotRef.current;
136
+ }
137
+ const transitionId = acceptedCandidate.structuralTransition?.id;
138
+ const newDisclosureCommand = initializedSnapshot.current && acceptedCandidate.disclosure !== undefined && transitionId !== undefined && transitionId !== snapshotRef.current.structuralTransition?.id;
139
+ if (newDisclosureCommand && (expandedPresent && expandedReadyEpoch !== expandedEpoch || togglePresent && toggleReadyEpoch !== toggleEpoch)) {
140
+ pendingDisclosureSnapshotRef.current = retained ?? {
141
+ source: 'prop',
142
+ input: inputSnapshot,
143
+ owned: acceptedCandidate,
144
+ expandedEpoch,
145
+ toggleEpoch
146
+ };
147
+ return snapshotRef.current;
148
+ }
149
+ pendingDisclosureSnapshotRef.current = undefined;
150
+ return acceptedCandidate;
151
+ }, [inputSnapshot, prepareSnapshot, validateContainerConfiguration, expandedPresent, togglePresent, expandedEpoch, toggleEpoch, expandedReadyEpoch, toggleReadyEpoch, pendingDisclosureRevision]);
152
+ renderedSnapshotRef.current = snapshot;
58
153
  const fontFamiliesJson = useNativeListFontFamiliesJson();
59
- const [slotHeights, setSlotHeights] = useState([0, 0, 0]);
154
+ const slotHeights = slotMeasurements.heights;
155
+ const [viewportWidth, setViewportWidth] = useState(0);
60
156
  const [topOverlayHeight, setTopOverlayHeight] = useState(0);
61
157
  const hasTopOverlay = Platform?.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 26 && (topScrollEdgeEffect === 'hard' || topScrollEdgeEffect === 'soft') && topOverlay != null;
62
158
  const containerSlotHeightsJson = JSON.stringify(slotHeights);
63
- const slotInset = snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0;
64
- if (snapshot.layout.orientation === 'horizontal' && (listHeader || listEmpty || listFooter)) {
65
- throw new Error('NativeList container slots require vertical orientation');
66
- }
67
- const slotContents = [listHeader, listEmpty, listFooter];
159
+ const defaultSlotInset = snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0;
160
+ const bandWidth = sidecarLayout ? Math.min(viewportWidth, sidecarLayout.maxContentWidth) : 0;
161
+ const slotInset = sidecarLayout ? Math.max(0, (viewportWidth - bandWidth) / 2) + defaultSlotInset : defaultSlotInset;
162
+ const sidecarSpace = sidecarLayout ? sidecarLayout.width + sidecarLayout.gap : 0;
163
+ const slotContents = [listHeader, listEmpty, listFooter, listSidecar, listExpandedContent, listStructureToggle];
164
+ const recordSlotLayout = (index, height, epoch) => {
165
+ if (index === 4 && epoch !== disclosureSlotMounts.current.expandedEpoch || index === 5 && epoch !== disclosureSlotMounts.current.toggleEpoch) {
166
+ return;
167
+ }
168
+ setSlotMeasurements(previous => {
169
+ if (previous.heights[index] === height && previous.readyEpochs[index] === epoch) {
170
+ return previous;
171
+ }
172
+ const heights = [...previous.heights];
173
+ const readyEpochs = [...previous.readyEpochs];
174
+ heights[index] = height;
175
+ readyEpochs[index] = epoch;
176
+ return {
177
+ heights,
178
+ readyEpochs
179
+ };
180
+ });
181
+ };
182
+ const sidecarLayoutJson = sidecarLayout ? JSON.stringify(sidecarLayout) : '';
68
183
  const normalizedKeyboardShouldPersistTaps = keyboardShouldPersistTaps === true ? 'always' : keyboardShouldPersistTaps === false ? 'never' : keyboardShouldPersistTaps;
69
184
  const nativeRef = useRef(null);
70
185
  const callbacksRef = useRef({
@@ -74,6 +189,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
74
189
  onReorder,
75
190
  onEndReached,
76
191
  onVisibleRangeChanged,
192
+ onStructuralTransitionSettled,
77
193
  onScrollPositionThresholdChange,
78
194
  onRefresh,
79
195
  onScrollToIndexFailed
@@ -85,11 +201,12 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
85
201
  onReorder,
86
202
  onEndReached,
87
203
  onVisibleRangeChanged,
204
+ onStructuralTransitionSettled,
88
205
  onScrollPositionThresholdChange,
89
206
  onRefresh,
90
207
  onScrollToIndexFailed
91
208
  };
92
- const scrollPositionThresholdsJson = useMemo(() => {
209
+ const scrollPositionThresholdsJson = useMemo(() => containNativeListInput(() => {
93
210
  if (!scrollPositionThresholds || scrollPositionThresholds.enabled === false) return '';
94
211
  const {
95
212
  start,
@@ -102,15 +219,18 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
102
219
  start,
103
220
  end
104
221
  });
105
- }, [scrollPositionThresholds]);
106
- const snapshotJson = useMemo(() => serializeSnapshot(snapshot), [snapshot]);
107
- const snapshotRef = useRef(snapshot);
222
+ }) ?? '', [scrollPositionThresholds]);
223
+ const snapshotJson = useMemo(() => JSON.stringify(snapshot), [snapshot]);
108
224
  const previousSnapshotJsonRef = useRef(snapshotJson);
109
225
  const snapshotChanged = previousSnapshotJsonRef.current !== snapshotJson;
110
226
  if (snapshotChanged) {
111
227
  snapshotRef.current = snapshot;
112
228
  previousSnapshotJsonRef.current = snapshotJson;
113
229
  }
230
+ if (!initializedSnapshot.current) {
231
+ snapshotRef.current = snapshot;
232
+ initializedSnapshot.current = true;
233
+ }
114
234
  // OneKey patch: range events already cross the bridge only when row indices
115
235
  // change. Prefetch is optional work; scrolling and visible loads stay native.
116
236
  const avatarQueueRef = useRef(null);
@@ -142,7 +262,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
142
262
  useEffect(() => {
143
263
  updateAvatarPrefetchRef.current();
144
264
  }, [snapshot]);
145
- const initialScrollRef = useRef(initialScrollIndex === undefined && initialScrollKey === undefined ? undefined : initialScrollIndex !== undefined ? normalizeIndexScroll({
265
+ const initialScrollRef = useRef(containNativeListInput(() => initialScrollIndex === undefined && initialScrollKey === undefined ? undefined : initialScrollIndex !== undefined ? normalizeIndexScroll({
146
266
  index: initialScrollIndex,
147
267
  animated: false,
148
268
  viewPosition: initialScrollViewPosition,
@@ -154,7 +274,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
154
274
  viewPosition: initialScrollViewPosition,
155
275
  viewOffset: initialScrollViewOffset
156
276
  }, 'start')
157
- });
277
+ }));
158
278
  const didApplyInitialScroll = useRef(false);
159
279
  const emitIndexFailure = (index, reason) => {
160
280
  callbacksRef.current.onScrollToIndexFailed?.(scrollFailure(snapshotRef.current.rows, index, reason));
@@ -180,39 +300,79 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
180
300
  applyInitialScrollCallbackRef.current = applyInitialScroll;
181
301
  useImperativeHandle(forwardedRef, () => ({
182
302
  applySnapshot(nextSnapshot) {
183
- const nextSnapshotJson = serializeSnapshot(nextSnapshot);
184
- nativeRef.current?.applySnapshot(nextSnapshotJson);
185
- snapshotRef.current = nextSnapshot;
186
- if (nativeRef.current && avatarLifecycle.current !== 'unmounted') {
187
- avatarModelRef.current?.replaceSnapshot(nextSnapshot.rows);
303
+ const accepted = containNativeListInput(() => prepareSnapshot(nextSnapshot));
304
+ if (!accepted) return;
305
+ const transitionId = accepted.structuralTransition?.id;
306
+ const waitsForSlots = accepted.disclosure !== undefined && transitionId !== undefined && transitionId !== snapshotRef.current.structuralTransition?.id && (expandedPresent && slotMeasurements.readyEpochs[4] !== expandedEpoch || togglePresent && slotMeasurements.readyEpochs[5] !== toggleEpoch);
307
+ if (waitsForSlots) {
308
+ pendingDisclosureSnapshotRef.current = {
309
+ source: 'imperative',
310
+ input: nextSnapshot,
311
+ owned: accepted,
312
+ expandedEpoch,
313
+ toggleEpoch
314
+ };
315
+ setPendingDisclosureRevision(value => value + 1);
316
+ return;
317
+ }
318
+ pendingDisclosureSnapshotRef.current = undefined;
319
+ const native = nativeRef.current;
320
+ if (native) native.applySnapshot(JSON.stringify(accepted));
321
+ snapshotRef.current = accepted;
322
+ needsNativeSnapshotRef.current = !native;
323
+ if (native && avatarLifecycle.current !== 'unmounted') {
324
+ avatarModelRef.current?.replaceSnapshot(accepted.rows);
188
325
  updateAvatarPrefetchRef.current();
189
326
  }
190
327
  },
191
328
  applyPatches(patches) {
192
- if (patches.length === 0) return;
193
- const nextSnapshot = applyRowPatches(snapshotRef.current, patches);
329
+ const pending = pendingDisclosureSnapshotRef.current;
330
+ const accepted = containNativeListInput(() => applyOwnedNativePatches(pending?.owned ?? snapshotRef.current, patches));
331
+ if (!accepted || accepted.patches.length === 0) return;
332
+ const nextSnapshot = accepted.snapshot;
333
+ if (pending) {
334
+ pendingDisclosureSnapshotRef.current = {
335
+ ...pending,
336
+ owned: nextSnapshot
337
+ };
338
+ return;
339
+ }
194
340
  const native = nativeRef.current;
195
- const dispatch = native ? () => {
196
- native.applyPatches(serializePatches(patches));
341
+ if (!native) {
342
+ snapshotRef.current = nextSnapshot;
343
+ needsNativeSnapshotRef.current = true;
344
+ return;
345
+ }
346
+ const dispatch = () => {
347
+ native.applyPatches(accepted.json);
197
348
  snapshotRef.current = nextSnapshot;
198
- } : undefined;
349
+ };
199
350
  if (avatarLifecycle.current === 'unmounted') {
200
351
  dispatch?.();
201
352
  return;
202
353
  }
203
- if (avatarModelRef.current?.applyPatches(patches, dispatch)) updateAvatarPrefetchRef.current();
354
+ if (avatarModelRef.current?.applyPatches(accepted.patches, dispatch)) updateAvatarPrefetchRef.current();
204
355
  },
205
356
  reconcileSelection(selectedKeys) {
206
- nativeRef.current?.reconcileSelection(JSON.stringify(selectedKeys));
207
- const current = snapshotRef.current;
208
- if (current.selection && (current.selection.mode !== 'single' || selectedKeys.length <= 1) && selectedKeys.every(key => current.rows.some(row => row.key === key && isSelectableRow(row)))) {
209
- snapshotRef.current = {
357
+ const capturedKeys = captureNativeListInput(selectedKeys);
358
+ const pending = pendingDisclosureSnapshotRef.current;
359
+ if (!pending) nativeRef.current?.reconcileSelection(JSON.stringify(capturedKeys));
360
+ const current = pending?.owned ?? snapshotRef.current;
361
+ if (current.selection && (current.selection.mode !== 'single' || capturedKeys.length <= 1) && capturedKeys.every(key => current.rows.some(row => row.key === key && isSelectableRow(row)))) {
362
+ const next = {
210
363
  ...current,
211
364
  selection: {
212
365
  ...current.selection,
213
- selectedKeys
366
+ selectedKeys: capturedKeys
214
367
  }
215
368
  };
369
+ if (pending) pendingDisclosureSnapshotRef.current = {
370
+ ...pending,
371
+ owned: next
372
+ };else {
373
+ snapshotRef.current = next;
374
+ if (!nativeRef.current) needsNativeSnapshotRef.current = true;
375
+ }
216
376
  }
217
377
  },
218
378
  scrollToKey(paramsOrKey, animated, alignment) {
@@ -267,7 +427,16 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
267
427
  }));
268
428
  const nativeCallbacks = useMemo(() => ({
269
429
  hybridRef: callback(ref => {
430
+ const previous = nativeRef.current;
270
431
  nativeRef.current = ref;
432
+ if (needsNativeSnapshotRef.current || previous && previous !== ref) {
433
+ // The parent can publish values before Fabric delivers the host.
434
+ const latest = snapshotRef.current;
435
+ ref.applySnapshot(JSON.stringify(latest));
436
+ needsNativeSnapshotRef.current = false;
437
+ avatarModelRef.current?.replaceSnapshot(latest.rows);
438
+ updateAvatarPrefetchRef.current();
439
+ }
271
440
  applyInitialScrollCallbackRef.current();
272
441
  }),
273
442
  onRowAction: callback(payloadJson => {
@@ -319,14 +488,23 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
319
488
  };
320
489
  updateAvatarPrefetchRef.current();
321
490
  callbacksRef.current.onVisibleRangeChanged?.(payload);
491
+ }),
492
+ onStructuralTransitionSettled: callback(payloadJson => {
493
+ callbacksRef.current.onStructuralTransitionSettled?.(parsePayload(payloadJson));
322
494
  })
323
495
  }), []);
324
496
  return /*#__PURE__*/_jsxs(NativeListHost, {
325
497
  ...viewProps,
498
+ onLayout: event => {
499
+ setViewportWidth(event.nativeEvent.layout.width);
500
+ viewProps.onLayout?.(event);
501
+ },
326
502
  ...nativeCallbacks,
503
+ onStructuralTransitionSettled: onStructuralTransitionSettled ? nativeCallbacks.onStructuralTransitionSettled : clearedStructuralTransitionSettled,
327
504
  fontFamiliesJson: fontFamiliesJson,
328
505
  snapshotJson: snapshotJson,
329
506
  containerSlotHeightsJson: containerSlotHeightsJson,
507
+ sidecarLayoutJson: sidecarLayoutJson,
330
508
  topScrollEdgeEffect: hasTopOverlay ? topScrollEdgeEffect ?? 'none' : 'none',
331
509
  topOverlayHeight: hasTopOverlay ? topOverlayHeight : 0,
332
510
  scrollPositionThresholdsJson: scrollPositionThresholdsJson,
@@ -336,15 +514,22 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
336
514
  collapsable: false,
337
515
  style: {
338
516
  position: 'absolute',
339
- left: slotInset,
340
- right: slotInset,
517
+ start: index === 3 ? 0 : slotInset,
518
+ end: index === 3 ? undefined : slotInset + sidecarSpace,
519
+ width: index === 3 ? sidecarLayout?.width : undefined,
341
520
  top: 0
342
521
  },
343
522
  onLayout: event => {
344
- const height = Math.ceil(event.nativeEvent.layout.height);
345
- setSlotHeights(previous => previous[index] === height ? previous : previous.map((value, slot) => slot === index ? height : value));
523
+ if (index < 4) {
524
+ recordSlotLayout(index, Math.ceil(event.nativeEvent.layout.height), 0);
525
+ }
346
526
  },
347
- children: content
527
+ children: index >= 4 ? /*#__PURE__*/_jsx(View, {
528
+ collapsable: false,
529
+ style: disclosureSlotMeasurementStyle,
530
+ onLayout: event => recordSlotLayout(index, Math.ceil(event.nativeEvent.layout.height), index === 4 ? expandedEpoch : toggleEpoch),
531
+ children: content
532
+ }, index === 4 ? `expanded-${expandedEpoch}` : `toggle-${toggleEpoch}`) : content
348
533
  }, index)), hasTopOverlay ? /*#__PURE__*/_jsx(View, {
349
534
  collapsable: false,
350
535
  style: {