@onekeyfe/react-native-native-list 6.7.0-16 → 6.7.0-17

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 (115) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +240 -11
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -3
  5. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  6. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  7. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +87 -7
  8. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +177 -1
  9. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +43 -14
  10. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +33 -2
  12. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +22 -0
  13. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  14. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
  16. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  17. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  18. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1877 -41
  19. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +1 -0
  20. package/docs/ROW_TEMPLATES.md +60 -9
  21. package/docs/SPEC.md +401 -5
  22. package/docs/STYLE_SPEC.md +6 -0
  23. package/ios/HybridNativeList.swift +17 -2
  24. package/ios/NativeListAccessoryStack.swift +227 -39
  25. package/ios/NativeListActivityDetailsView.swift +18 -8
  26. package/ios/NativeListActivityRenderer.swift +8 -2
  27. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  28. package/ios/NativeListDataRowRenderer.swift +155 -27
  29. package/ios/NativeListDesignAssets.swift +3 -0
  30. package/ios/NativeListIdentityRenderer.swift +166 -30
  31. package/ios/NativeListLeadingVisual.swift +49 -14
  32. package/ios/NativeListMessageRenderer.swift +34 -1
  33. package/ios/NativeListModels.swift +42 -2
  34. package/ios/NativeListRendererRegistry.swift +1 -0
  35. package/ios/NativeListResolvedText.swift +2 -1
  36. package/ios/NativeListRowHost.swift +14 -0
  37. package/ios/NativeListSectionHeaderRenderer.swift +88 -0
  38. package/ios/RNCNativeListView.swift +984 -53
  39. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
  40. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
  41. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
  42. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
  43. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
  44. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
  45. package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
  46. package/ios/tests/NativeListLifecycleTests.swift +2494 -3
  47. package/lib/module/NativeList.js +171 -28
  48. package/lib/module/NativeList.web.js +54 -4
  49. package/lib/module/models.js +1 -0
  50. package/lib/module/selection.js +1 -1
  51. package/lib/module/validation.js +331 -8
  52. package/lib/module/web/NativeListWebEngine.js +503 -18
  53. package/lib/module/web/templates/ActivityRowRenderer.js +8 -7
  54. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  55. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  56. package/lib/module/web/templates/IdentityRowRenderer.js +90 -4
  57. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  58. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  59. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  60. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  61. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  62. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  63. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  64. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  65. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  66. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  67. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  68. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  69. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  70. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  71. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  72. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  73. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  74. package/lib/typescript/src/NativeList.d.ts +1 -1
  75. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  76. package/lib/typescript/src/NativeList.types.d.ts +18 -0
  77. package/lib/typescript/src/index.d.ts +1 -1
  78. package/lib/typescript/src/models.d.ts +105 -9
  79. package/lib/typescript/src/validation.d.ts +10 -0
  80. package/lib/typescript/src/web/NativeListWebEngine.d.ts +31 -0
  81. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  82. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  83. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  84. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  85. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  86. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  88. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  89. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  90. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  91. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  92. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  93. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  94. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  95. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  96. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  97. package/package.json +3 -3
  98. package/react-native-native-list.podspec +1 -0
  99. package/src/NativeList.nitro.ts +2 -0
  100. package/src/NativeList.tsx +307 -44
  101. package/src/NativeList.types.ts +22 -0
  102. package/src/NativeList.web.tsx +75 -8
  103. package/src/index.ts +1 -0
  104. package/src/models.ts +117 -3
  105. package/src/selection.ts +1 -0
  106. package/src/validation.ts +742 -6
  107. package/src/web/NativeListWebEngine.ts +798 -19
  108. package/src/web/templates/ActivityRowRenderer.ts +14 -6
  109. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  110. package/src/web/templates/DataRowRenderer.ts +93 -20
  111. package/src/web/templates/IdentityRowRenderer.ts +150 -5
  112. package/src/web/templates/MessageRowRenderer.ts +23 -7
  113. package/src/web/templates/RowContainerStyle.ts +2 -0
  114. package/src/web/templates/RowRendererRegistry.ts +11 -1
  115. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
@@ -8,10 +8,13 @@ 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, containNativeListInput, emptyNativeListSnapshot, serializePatches, validatePatches, validateSnapshot } 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 disclosureSlotMeasurementStyle = {
16
+ alignSelf: 'stretch'
17
+ };
15
18
  export function preloadNativeListAvatarImages(sources) {
16
19
  return OneKeyImageCache.preload(sources.map(source => ({
17
20
  uri: source.uri,
@@ -31,6 +34,10 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
31
34
  listHeader,
32
35
  listFooter,
33
36
  listEmpty,
37
+ listSidecar,
38
+ listExpandedContent,
39
+ listStructureToggle,
40
+ sidecarLayout,
34
41
  topOverlay,
35
42
  topScrollEdgeEffect,
36
43
  scrollPositionThresholds,
@@ -46,6 +53,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
46
53
  onReorder,
47
54
  onEndReached,
48
55
  onVisibleRangeChanged,
56
+ onStructuralTransitionSettled,
49
57
  onScrollPositionThresholdChange,
50
58
  onRefresh,
51
59
  onScrollToIndexFailed,
@@ -56,21 +64,118 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
56
64
  ...viewProps
57
65
  }, forwardedRef) {
58
66
  const snapshotRef = useRef(emptyNativeListSnapshot());
67
+ const renderedSnapshotRef = useRef(undefined);
59
68
  const initializedSnapshot = useRef(false);
60
- const hasContainerSlots = Boolean(listHeader || listEmpty || listFooter);
61
- const prepareSnapshot = useCallback(next => {
62
- const accepted = validateSnapshot(next);
69
+ const pendingDisclosureSnapshotRef = useRef(undefined);
70
+ const previousPropInputRef = useRef(inputSnapshot);
71
+ const [pendingDisclosureRevision, setPendingDisclosureRevision] = useState(0);
72
+ const disclosureSlotMounts = useRef({
73
+ expandedPresent: false,
74
+ togglePresent: false,
75
+ expandedEpoch: 0,
76
+ toggleEpoch: 0
77
+ });
78
+ const expandedPresent = listExpandedContent != null;
79
+ const togglePresent = listStructureToggle != null;
80
+ if (disclosureSlotMounts.current.expandedPresent !== expandedPresent) {
81
+ disclosureSlotMounts.current.expandedPresent = expandedPresent;
82
+ disclosureSlotMounts.current.expandedEpoch += 1;
83
+ }
84
+ if (disclosureSlotMounts.current.togglePresent !== togglePresent) {
85
+ disclosureSlotMounts.current.togglePresent = togglePresent;
86
+ disclosureSlotMounts.current.toggleEpoch += 1;
87
+ }
88
+ const expandedEpoch = disclosureSlotMounts.current.expandedEpoch;
89
+ const toggleEpoch = disclosureSlotMounts.current.toggleEpoch;
90
+ const [slotMeasurements, setSlotMeasurements] = useState({
91
+ heights: [0, 0, 0, 0, 0, 0],
92
+ readyEpochs: [-1, -1, -1, -1, -1, -1]
93
+ });
94
+ const hasSidecar = listSidecar !== undefined;
95
+ const sidecarWidth = sidecarLayout?.width;
96
+ const sidecarGap = sidecarLayout?.gap;
97
+ const sidecarMaxContentWidth = sidecarLayout?.maxContentWidth;
98
+ const hasContainerSlots = Boolean(listHeader || listEmpty || listFooter || listSidecar || listExpandedContent || listStructureToggle);
99
+ const validateContainerConfiguration = useCallback(accepted => {
63
100
  if (hasContainerSlots && accepted.layout.orientation === 'horizontal') throw new Error('NativeList container slots require vertical orientation');
64
- return accepted;
65
- }, [hasContainerSlots]);
66
- const snapshot = useMemo(() => containNativeListInput(() => prepareSnapshot(inputSnapshot)) ?? snapshotRef.current, [inputSnapshot, prepareSnapshot]);
101
+ if (hasSidecar !== (sidecarWidth !== undefined)) throw new Error('listSidecar and sidecarLayout must be supplied together');
102
+ if (sidecarWidth !== undefined) {
103
+ const width = sidecarWidth;
104
+ const gap = sidecarGap ?? NaN;
105
+ const maxContentWidth = sidecarMaxContentWidth ?? NaN;
106
+ 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');
107
+ }
108
+ }, [hasContainerSlots, hasSidecar, sidecarWidth, sidecarGap, sidecarMaxContentWidth]);
109
+ const prepareSnapshot = useCallback(next => {
110
+ const accepted = validateSnapshot(captureNativeListInput(next));
111
+ validateContainerConfiguration(accepted);
112
+ return ownValidatedNativeSnapshot(accepted);
113
+ }, [validateContainerConfiguration]);
114
+ const expandedReadyEpoch = slotMeasurements.readyEpochs[4];
115
+ const toggleReadyEpoch = slotMeasurements.readyEpochs[5];
116
+ const snapshot = useMemo(() => {
117
+ // Imperative pending snapshots use this revision to retry the readiness gate.
118
+ // eslint-disable-next-line no-void -- Reading this revision invalidates the readiness memo.
119
+ void pendingDisclosureRevision;
120
+ const propReplaced = previousPropInputRef.current !== inputSnapshot;
121
+ previousPropInputRef.current = inputSnapshot;
122
+ const pending = pendingDisclosureSnapshotRef.current;
123
+ const retained = pending && !propReplaced && (pending.source === 'imperative' || pending.input === inputSnapshot) && pending.expandedEpoch === expandedEpoch && pending.toggleEpoch === toggleEpoch ? pending : undefined;
124
+ const candidate = retained?.owned ?? (!propReplaced && initializedSnapshot.current ? renderedSnapshotRef.current ?? snapshotRef.current : containNativeListInput(() => prepareSnapshot(inputSnapshot)) ?? snapshotRef.current);
125
+ const acceptedCandidate = !propReplaced && initializedSnapshot.current ? containNativeListInput(() => {
126
+ validateContainerConfiguration(candidate);
127
+ return candidate;
128
+ }) : candidate;
129
+ if (!acceptedCandidate) {
130
+ pendingDisclosureSnapshotRef.current = undefined;
131
+ return renderedSnapshotRef.current ?? snapshotRef.current;
132
+ }
133
+ const transitionId = acceptedCandidate.structuralTransition?.id;
134
+ const newDisclosureCommand = initializedSnapshot.current && acceptedCandidate.disclosure !== undefined && transitionId !== undefined && transitionId !== snapshotRef.current.structuralTransition?.id;
135
+ if (newDisclosureCommand && (expandedPresent && expandedReadyEpoch !== expandedEpoch || togglePresent && toggleReadyEpoch !== toggleEpoch)) {
136
+ pendingDisclosureSnapshotRef.current = retained ?? {
137
+ source: 'prop',
138
+ input: inputSnapshot,
139
+ owned: acceptedCandidate,
140
+ expandedEpoch,
141
+ toggleEpoch
142
+ };
143
+ return snapshotRef.current;
144
+ }
145
+ pendingDisclosureSnapshotRef.current = undefined;
146
+ return acceptedCandidate;
147
+ }, [inputSnapshot, prepareSnapshot, validateContainerConfiguration, expandedPresent, togglePresent, expandedEpoch, toggleEpoch, expandedReadyEpoch, toggleReadyEpoch, pendingDisclosureRevision]);
148
+ renderedSnapshotRef.current = snapshot;
67
149
  const fontFamiliesJson = useNativeListFontFamiliesJson();
68
- const [slotHeights, setSlotHeights] = useState([0, 0, 0]);
150
+ const slotHeights = slotMeasurements.heights;
151
+ const [viewportWidth, setViewportWidth] = useState(0);
69
152
  const [topOverlayHeight, setTopOverlayHeight] = useState(0);
70
153
  const hasTopOverlay = Platform?.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 26 && (topScrollEdgeEffect === 'hard' || topScrollEdgeEffect === 'soft') && topOverlay != null;
71
154
  const containerSlotHeightsJson = JSON.stringify(slotHeights);
72
- const slotInset = snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0;
73
- const slotContents = [listHeader, listEmpty, listFooter];
155
+ const defaultSlotInset = snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0;
156
+ const bandWidth = sidecarLayout ? Math.min(viewportWidth, sidecarLayout.maxContentWidth) : 0;
157
+ const slotInset = sidecarLayout ? Math.max(0, (viewportWidth - bandWidth) / 2) : defaultSlotInset;
158
+ const sidecarSpace = sidecarLayout ? sidecarLayout.width + sidecarLayout.gap : 0;
159
+ const slotContents = [listHeader, listEmpty, listFooter, listSidecar, listExpandedContent, listStructureToggle];
160
+ const recordSlotLayout = (index, height, epoch) => {
161
+ if (index === 4 && epoch !== disclosureSlotMounts.current.expandedEpoch || index === 5 && epoch !== disclosureSlotMounts.current.toggleEpoch) {
162
+ return;
163
+ }
164
+ setSlotMeasurements(previous => {
165
+ if (previous.heights[index] === height && previous.readyEpochs[index] === epoch) {
166
+ return previous;
167
+ }
168
+ const heights = [...previous.heights];
169
+ const readyEpochs = [...previous.readyEpochs];
170
+ heights[index] = height;
171
+ readyEpochs[index] = epoch;
172
+ return {
173
+ heights,
174
+ readyEpochs
175
+ };
176
+ });
177
+ };
178
+ const sidecarLayoutJson = sidecarLayout ? JSON.stringify(sidecarLayout) : '';
74
179
  const normalizedKeyboardShouldPersistTaps = keyboardShouldPersistTaps === true ? 'always' : keyboardShouldPersistTaps === false ? 'never' : keyboardShouldPersistTaps;
75
180
  const nativeRef = useRef(null);
76
181
  const callbacksRef = useRef({
@@ -80,6 +185,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
80
185
  onReorder,
81
186
  onEndReached,
82
187
  onVisibleRangeChanged,
188
+ onStructuralTransitionSettled,
83
189
  onScrollPositionThresholdChange,
84
190
  onRefresh,
85
191
  onScrollToIndexFailed
@@ -91,6 +197,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
91
197
  onReorder,
92
198
  onEndReached,
93
199
  onVisibleRangeChanged,
200
+ onStructuralTransitionSettled,
94
201
  onScrollPositionThresholdChange,
95
202
  onRefresh,
96
203
  onScrollToIndexFailed
@@ -191,6 +298,20 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
191
298
  applySnapshot(nextSnapshot) {
192
299
  const accepted = containNativeListInput(() => prepareSnapshot(nextSnapshot));
193
300
  if (!accepted) return;
301
+ const transitionId = accepted.structuralTransition?.id;
302
+ const waitsForSlots = accepted.disclosure !== undefined && transitionId !== undefined && transitionId !== snapshotRef.current.structuralTransition?.id && (expandedPresent && slotMeasurements.readyEpochs[4] !== expandedEpoch || togglePresent && slotMeasurements.readyEpochs[5] !== toggleEpoch);
303
+ if (waitsForSlots) {
304
+ pendingDisclosureSnapshotRef.current = {
305
+ source: 'imperative',
306
+ input: nextSnapshot,
307
+ owned: accepted,
308
+ expandedEpoch,
309
+ toggleEpoch
310
+ };
311
+ setPendingDisclosureRevision(value => value + 1);
312
+ return;
313
+ }
314
+ pendingDisclosureSnapshotRef.current = undefined;
194
315
  const nextSnapshotJson = JSON.stringify(accepted);
195
316
  nativeRef.current?.applySnapshot(nextSnapshotJson);
196
317
  snapshotRef.current = accepted;
@@ -200,16 +321,17 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
200
321
  }
201
322
  },
202
323
  applyPatches(patches) {
203
- const accepted = containNativeListInput(() => {
204
- const normalized = validatePatches(patches);
205
- return {
206
- patches: normalized,
207
- snapshot: applyRowPatches(snapshotRef.current, normalized),
208
- json: serializePatches(normalized)
209
- };
210
- });
324
+ const pending = pendingDisclosureSnapshotRef.current;
325
+ const accepted = containNativeListInput(() => applyOwnedNativePatches(pending?.owned ?? snapshotRef.current, patches));
211
326
  if (!accepted || accepted.patches.length === 0) return;
212
327
  const nextSnapshot = accepted.snapshot;
328
+ if (pending) {
329
+ pendingDisclosureSnapshotRef.current = {
330
+ ...pending,
331
+ owned: nextSnapshot
332
+ };
333
+ return;
334
+ }
213
335
  const native = nativeRef.current;
214
336
  const dispatch = native ? () => {
215
337
  native.applyPatches(accepted.json);
@@ -222,16 +344,22 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
222
344
  if (avatarModelRef.current?.applyPatches(accepted.patches, dispatch)) updateAvatarPrefetchRef.current();
223
345
  },
224
346
  reconcileSelection(selectedKeys) {
225
- nativeRef.current?.reconcileSelection(JSON.stringify(selectedKeys));
226
- const current = snapshotRef.current;
227
- if (current.selection && (current.selection.mode !== 'single' || selectedKeys.length <= 1) && selectedKeys.every(key => current.rows.some(row => row.key === key && isSelectableRow(row)))) {
228
- snapshotRef.current = {
347
+ const capturedKeys = captureNativeListInput(selectedKeys);
348
+ const pending = pendingDisclosureSnapshotRef.current;
349
+ if (!pending) nativeRef.current?.reconcileSelection(JSON.stringify(capturedKeys));
350
+ const current = pending?.owned ?? snapshotRef.current;
351
+ if (current.selection && (current.selection.mode !== 'single' || capturedKeys.length <= 1) && capturedKeys.every(key => current.rows.some(row => row.key === key && isSelectableRow(row)))) {
352
+ const next = {
229
353
  ...current,
230
354
  selection: {
231
355
  ...current.selection,
232
- selectedKeys
356
+ selectedKeys: capturedKeys
233
357
  }
234
358
  };
359
+ if (pending) pendingDisclosureSnapshotRef.current = {
360
+ ...pending,
361
+ owned: next
362
+ };else snapshotRef.current = next;
235
363
  }
236
364
  },
237
365
  scrollToKey(paramsOrKey, animated, alignment) {
@@ -338,14 +466,22 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
338
466
  };
339
467
  updateAvatarPrefetchRef.current();
340
468
  callbacksRef.current.onVisibleRangeChanged?.(payload);
469
+ }),
470
+ onStructuralTransitionSettled: callback(payloadJson => {
471
+ callbacksRef.current.onStructuralTransitionSettled?.(parsePayload(payloadJson));
341
472
  })
342
473
  }), []);
343
474
  return /*#__PURE__*/_jsxs(NativeListHost, {
344
475
  ...viewProps,
476
+ onLayout: event => {
477
+ setViewportWidth(event.nativeEvent.layout.width);
478
+ viewProps.onLayout?.(event);
479
+ },
345
480
  ...nativeCallbacks,
346
481
  fontFamiliesJson: fontFamiliesJson,
347
482
  snapshotJson: snapshotJson,
348
483
  containerSlotHeightsJson: containerSlotHeightsJson,
484
+ sidecarLayoutJson: sidecarLayoutJson,
349
485
  topScrollEdgeEffect: hasTopOverlay ? topScrollEdgeEffect ?? 'none' : 'none',
350
486
  topOverlayHeight: hasTopOverlay ? topOverlayHeight : 0,
351
487
  scrollPositionThresholdsJson: scrollPositionThresholdsJson,
@@ -355,15 +491,22 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
355
491
  collapsable: false,
356
492
  style: {
357
493
  position: 'absolute',
358
- left: slotInset,
359
- right: slotInset,
494
+ start: index === 3 ? 0 : slotInset,
495
+ end: index === 3 ? undefined : slotInset + sidecarSpace,
496
+ width: index === 3 ? sidecarLayout?.width : undefined,
360
497
  top: 0
361
498
  },
362
499
  onLayout: event => {
363
- const height = Math.ceil(event.nativeEvent.layout.height);
364
- setSlotHeights(previous => previous[index] === height ? previous : previous.map((value, slot) => slot === index ? height : value));
500
+ if (index < 4) {
501
+ recordSlotLayout(index, Math.ceil(event.nativeEvent.layout.height), 0);
502
+ }
365
503
  },
366
- children: content
504
+ children: index >= 4 ? /*#__PURE__*/_jsx(View, {
505
+ collapsable: false,
506
+ style: disclosureSlotMeasurementStyle,
507
+ onLayout: event => recordSlotLayout(index, Math.ceil(event.nativeEvent.layout.height), index === 4 ? expandedEpoch : toggleEpoch),
508
+ children: content
509
+ }, index === 4 ? `expanded-${expandedEpoch}` : `toggle-${toggleEpoch}`) : content
367
510
  }, index)), hasTopOverlay ? /*#__PURE__*/_jsx(View, {
368
511
  collapsable: false,
369
512
  style: {
@@ -26,6 +26,10 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
26
26
  listHeader,
27
27
  listEmpty,
28
28
  listFooter,
29
+ listExpandedContent: _listExpandedContent,
30
+ listStructureToggle: _listStructureToggle,
31
+ listSidecar,
32
+ sidecarLayout,
29
33
  topOverlay: _topOverlay,
30
34
  topScrollEdgeEffect: _topScrollEdgeEffect,
31
35
  webScrollHost,
@@ -42,6 +46,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
42
46
  onReorder,
43
47
  onEndReached,
44
48
  onVisibleRangeChanged,
49
+ onStructuralTransitionSettled: _onStructuralTransitionSettled,
45
50
  onRefresh,
46
51
  onScrollToIndexFailed,
47
52
  initialScrollIndex,
@@ -69,6 +74,8 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
69
74
  emptyBottomPadding: !snapshot.rows.length && hasEmptySlot ? snapshot.layout.contentPaddingBottom ?? snapshot.layout.contentPadding ?? 0 : 0,
70
75
  padding: snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0
71
76
  }));
77
+ const [viewportWidth, setViewportWidth] = useState(0);
78
+ const [sidecarHeight, setSidecarHeight] = useState(0);
72
79
  const synchronizeSlots = next => {
73
80
  const hasRows = next.rows.length > 0;
74
81
  const padding = next.layout.contentPaddingHorizontal ?? next.layout.contentPadding ?? 0;
@@ -99,12 +106,24 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
99
106
  const [ownedScrollHost, setOwnedScrollHost] = useState(null);
100
107
  const useSlotLayoutRef = useRef(false);
101
108
  useSlotLayoutRef.current ||= webScrollHost !== undefined || listHeader !== undefined || listEmpty !== undefined || listFooter !== undefined;
109
+ useSlotLayoutRef.current ||= listSidecar !== undefined;
102
110
  const useSlotLayout = useSlotLayoutRef.current;
103
111
  const resolvedScrollHost = webScrollHost === undefined ? useSlotLayout ? ownedScrollHost : undefined : webScrollHost;
104
112
  const engineRef = useRef(undefined);
105
113
  const webVirtualizationEnabledRef = useRef(webVirtualizationEnabled);
106
114
  webVirtualizationEnabledRef.current = webVirtualizationEnabled;
107
- const validatedSnapshot = useMemo(() => containNativeListInput(() => normalizeWebSnapshot(snapshot, hasEmptySlot, useSlotLayout)) ?? acceptedSnapshotRef.current, [snapshot, hasEmptySlot, useSlotLayout]);
115
+ const validatedSnapshot = useMemo(() => containNativeListInput(() => {
116
+ if (listSidecar !== undefined !== (sidecarLayout !== undefined)) throw new Error('listSidecar and sidecarLayout must be supplied together');
117
+ if (sidecarLayout) {
118
+ const {
119
+ width,
120
+ gap,
121
+ maxContentWidth
122
+ } = sidecarLayout;
123
+ if (snapshot.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');
124
+ }
125
+ return normalizeWebSnapshot(snapshot, hasEmptySlot, useSlotLayout);
126
+ }) ?? acceptedSnapshotRef.current, [snapshot, hasEmptySlot, useSlotLayout, listSidecar, sidecarLayout]);
108
127
  const snapshotRef = useRef(validatedSnapshot);
109
128
  const snapshotPropRef = useRef(validatedSnapshot);
110
129
  // An imperative snapshot survives host mounting until the snapshot prop changes.
@@ -297,7 +316,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
297
316
  });
298
317
  const padding = slotState.padding;
299
318
  const content = /*#__PURE__*/_jsxs(View, {
300
- ref: setBoundsRef,
319
+ ref: sidecarLayout ? undefined : setBoundsRef,
301
320
  style: {
302
321
  position: 'relative',
303
322
  flexShrink: 0,
@@ -321,14 +340,45 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
321
340
  },
322
341
  children: listEmpty
323
342
  }) : null, listFooter !== undefined ? /*#__PURE__*/_jsx(View, {
343
+ testID: "native-list-footer-slot",
324
344
  style: {
325
345
  paddingHorizontal: padding
326
346
  },
327
347
  children: listFooter
328
348
  }) : null]
329
349
  });
350
+ const bandWidth = sidecarLayout ? Math.min(viewportWidth, sidecarLayout.maxContentWidth) : 0;
351
+ const sidecarMargin = Math.max(0, (viewportWidth - bandWidth) / 2);
352
+ const leftWidth = Math.max(0, bandWidth - (sidecarLayout?.width ?? 0) - (sidecarLayout?.gap ?? 0));
353
+ const scrollContent = sidecarLayout ? /*#__PURE__*/_jsxs(View, {
354
+ ref: setBoundsRef,
355
+ style: {
356
+ position: 'relative',
357
+ minHeight: sidecarHeight
358
+ },
359
+ children: [/*#__PURE__*/_jsx(View, {
360
+ style: {
361
+ marginStart: sidecarMargin,
362
+ width: leftWidth
363
+ },
364
+ children: content
365
+ }), /*#__PURE__*/_jsx(View, {
366
+ style: {
367
+ position: 'absolute',
368
+ end: sidecarMargin,
369
+ top: 0,
370
+ width: sidecarLayout.width
371
+ },
372
+ onLayout: event => setSidecarHeight(event.nativeEvent.layout.height),
373
+ children: listSidecar
374
+ })]
375
+ }) : content;
330
376
  return /*#__PURE__*/_jsx(View, {
331
377
  ...viewProps,
378
+ onLayout: event => {
379
+ setViewportWidth(event.nativeEvent.layout.width);
380
+ viewProps.onLayout?.(event);
381
+ },
332
382
  style: [viewProps.style, {
333
383
  position: 'relative',
334
384
  minHeight: 0
@@ -340,8 +390,8 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
340
390
  inset: 0,
341
391
  overflow: 'scroll'
342
392
  },
343
- children: content
344
- }) : content
393
+ children: scrollContent
394
+ }) : scrollContent
345
395
  });
346
396
  });
347
397
  //# sourceMappingURL=NativeList.web.js.map
@@ -24,6 +24,7 @@ export const ROW_BOX_STYLE_KEYS_BY_TYPE = {
24
24
  metricCard: ['horizontalPadding', 'verticalPadding', 'leadingGap', 'lineGap', 'image'],
25
25
  sectionHeader: ['horizontalPadding', 'verticalPadding', 'lineGap', 'trailingGap'],
26
26
  action: ['horizontalPadding', 'verticalPadding', 'leadingGap', 'trailingGap', 'image'],
27
+ buttonGroup: [],
27
28
  system: ['horizontalPadding', 'verticalPadding', 'lineGap']
28
29
  };
29
30
 
@@ -4,7 +4,7 @@ export function isSelectableRow(row) {
4
4
  return !row.disabled && (row.type === 'identity' || row.type === 'rail' || row.type === 'activity' || row.type === 'message' || row.type === 'dataRow' || row.type === 'mediaTile' || row.type === 'metricCard');
5
5
  }
6
6
  export function isRowPressEnabled(row) {
7
- return !row.disabled && !row.pressDisabled && (row.type !== 'system' || row.variant === 'retry');
7
+ return !row.disabled && !row.pressDisabled && row.type !== 'buttonGroup' && (row.type !== 'system' || row.variant === 'retry');
8
8
  }
9
9
  function deltaBetween(before, after, source, sourceKey) {
10
10
  return {