@legendapp/list 3.0.4 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/react.js CHANGED
@@ -153,6 +153,7 @@ function StateProvider({ children }) {
153
153
  const [value] = React3__namespace.useState(() => ({
154
154
  animatedScrollY: createAnimatedValue(0),
155
155
  columnWrapperStyle: void 0,
156
+ containerLayoutTriggers: /* @__PURE__ */ new Map(),
156
157
  contextNum: contextNum++,
157
158
  listeners: /* @__PURE__ */ new Map(),
158
159
  mapViewabilityAmountCallbacks: /* @__PURE__ */ new Map(),
@@ -163,6 +164,7 @@ function StateProvider({ children }) {
163
164
  positionListeners: /* @__PURE__ */ new Map(),
164
165
  state: void 0,
165
166
  values: /* @__PURE__ */ new Map([
167
+ ["alignItemsAtEndPadding", 0],
166
168
  ["stylePaddingTop", 0],
167
169
  ["headerSize", 0],
168
170
  ["numContainers", 0],
@@ -305,15 +307,16 @@ function getContentInsetEnd(ctx, contentInsetEndAdjustmentOverride) {
305
307
 
306
308
  // src/state/getContentSize.ts
307
309
  function getContentSize(ctx) {
308
- var _a3;
310
+ var _a3, _b;
309
311
  const { values, state } = ctx;
310
312
  const stylePaddingTop = values.get("stylePaddingTop") || 0;
311
313
  const stylePaddingBottom = state.props.stylePaddingBottom || 0;
314
+ const alignItemsAtEndPadding = values.get("alignItemsAtEndPadding") || 0;
312
315
  const headerSize = values.get("headerSize") || 0;
313
316
  const footerSize = values.get("footerSize") || 0;
314
317
  const contentInsetBottom = getContentInsetEnd(ctx);
315
- const totalSize = (_a3 = state.pendingTotalSize) != null ? _a3 : values.get("totalSize");
316
- return headerSize + footerSize + totalSize + stylePaddingTop + stylePaddingBottom + (contentInsetBottom || 0);
318
+ const totalSize = (_b = (_a3 = state.pendingTotalSize) != null ? _a3 : state.totalSize) != null ? _b : values.get("totalSize");
319
+ return headerSize + footerSize + totalSize + stylePaddingTop + alignItemsAtEndPadding + stylePaddingBottom + (contentInsetBottom || 0);
317
320
  }
318
321
 
319
322
  // src/components/DebugView.tsx
@@ -420,9 +423,6 @@ function roundSize(size) {
420
423
  function isNullOrUndefined(value) {
421
424
  return value === null || value === void 0;
422
425
  }
423
- function comparatorDefault(a, b) {
424
- return a - b;
425
- }
426
426
  function getPadding(s, type) {
427
427
  var _a3, _b, _c;
428
428
  const axisPadding = type === "Left" || type === "Right" ? s.paddingHorizontal : s.paddingVertical;
@@ -930,18 +930,6 @@ var Container = typedMemo(function Container2({
930
930
  [itemKey, data, extraData]
931
931
  );
932
932
  const { index, renderedItem } = renderedItemInfo || {};
933
- const contextValue = React3.useMemo(() => {
934
- ctx.viewRefs.set(id, ref);
935
- return {
936
- containerId: id,
937
- index,
938
- itemKey,
939
- triggerLayout: () => {
940
- forceLayoutRender((v) => v + 1);
941
- },
942
- value: data
943
- };
944
- }, [id, itemKey, index, data]);
945
933
  const onLayoutChange = React3.useCallback((rectangle) => {
946
934
  const {
947
935
  horizontal: currentHorizontal,
@@ -985,6 +973,27 @@ var Container = typedMemo(function Container2({
985
973
  doUpdate();
986
974
  }
987
975
  }, []);
976
+ const triggerLayout = React3.useCallback(() => {
977
+ forceLayoutRender((v) => v + 1);
978
+ }, []);
979
+ const contextValue = React3.useMemo(() => {
980
+ ctx.viewRefs.set(id, ref);
981
+ return {
982
+ containerId: id,
983
+ index,
984
+ itemKey,
985
+ triggerLayout,
986
+ value: data
987
+ };
988
+ }, [id, itemKey, index, data, triggerLayout]);
989
+ React3.useLayoutEffect(() => {
990
+ ctx.containerLayoutTriggers.set(id, triggerLayout);
991
+ return () => {
992
+ if (ctx.containerLayoutTriggers.get(id) === triggerLayout) {
993
+ ctx.containerLayoutTriggers.delete(id);
994
+ }
995
+ };
996
+ }, [ctx, id, triggerLayout]);
988
997
  const { onLayout } = useOnLayoutSync(
989
998
  {
990
999
  onLayoutChange,
@@ -1807,6 +1816,51 @@ function WebAnchoredEndSpace({ horizontal }) {
1807
1816
  const style = horizontal ? { height: "100%", width: anchoredEndSpaceSize || 0 } : { height: anchoredEndSpaceSize || 0 };
1808
1817
  return /* @__PURE__ */ React3__namespace.createElement("div", { style }, null);
1809
1818
  }
1819
+
1820
+ // src/core/updateContentMetrics.ts
1821
+ function getRawContentLength(ctx) {
1822
+ var _a3, _b, _c;
1823
+ const { state, values } = ctx;
1824
+ return (values.get("headerSize") || 0) + (values.get("footerSize") || 0) + ((_c = (_b = (_a3 = state.pendingTotalSize) != null ? _a3 : state.totalSize) != null ? _b : values.get("totalSize")) != null ? _c : 0) + (state.props.stylePaddingTop || 0) + (state.props.stylePaddingBottom || 0);
1825
+ }
1826
+ function getAlignItemsAtEndPadding(ctx) {
1827
+ const { state } = ctx;
1828
+ const shouldPad = !!state.props.alignItemsAtEndPaddingEnabled && !state.props.horizontal && state.props.data.length > 0 && state.scrollLength > 0;
1829
+ return shouldPad ? Math.max(0, state.scrollLength - getRawContentLength(ctx) - getContentInsetEnd(ctx)) : 0;
1830
+ }
1831
+ function updateContentMetrics(ctx) {
1832
+ const nextPadding = getAlignItemsAtEndPadding(ctx);
1833
+ if (peek$(ctx, "alignItemsAtEndPadding") !== nextPadding) {
1834
+ set$(ctx, "alignItemsAtEndPadding", nextPadding);
1835
+ }
1836
+ }
1837
+ function setContentLengthSignal(ctx, signalName, size) {
1838
+ if (peek$(ctx, signalName) !== size) {
1839
+ set$(ctx, signalName, size);
1840
+ updateContentMetrics(ctx);
1841
+ }
1842
+ }
1843
+ function setHeaderSize(ctx, size) {
1844
+ setContentLengthSignal(ctx, "headerSize", size);
1845
+ }
1846
+ function setFooterSize(ctx, size) {
1847
+ setContentLengthSignal(ctx, "footerSize", size);
1848
+ }
1849
+ function areInsetsEqual(left, right) {
1850
+ var _a3, _b, _c, _d, _e, _f, _g, _h;
1851
+ return ((_a3 = left == null ? void 0 : left.top) != null ? _a3 : 0) === ((_b = right == null ? void 0 : right.top) != null ? _b : 0) && ((_c = left == null ? void 0 : left.bottom) != null ? _c : 0) === ((_d = right == null ? void 0 : right.bottom) != null ? _d : 0) && ((_e = left == null ? void 0 : left.left) != null ? _e : 0) === ((_f = right == null ? void 0 : right.left) != null ? _f : 0) && ((_g = left == null ? void 0 : left.right) != null ? _g : 0) === ((_h = right == null ? void 0 : right.right) != null ? _h : 0);
1852
+ }
1853
+ function setContentInsetOverride(ctx, inset) {
1854
+ const { state } = ctx;
1855
+ const previousInset = state.contentInsetOverride;
1856
+ const nextInset = inset != null ? inset : void 0;
1857
+ const didChange = !areInsetsEqual(previousInset, nextInset);
1858
+ state.contentInsetOverride = nextInset;
1859
+ if (didChange) {
1860
+ updateContentMetrics(ctx);
1861
+ }
1862
+ return didChange;
1863
+ }
1810
1864
  function useStableRenderComponent(renderComponent, mapProps) {
1811
1865
  const renderComponentRef = useLatestRef(renderComponent);
1812
1866
  const mapPropsRef = useLatestRef(mapProps);
@@ -1858,7 +1912,7 @@ var ListComponent = typedMemo(function ListComponent2({
1858
1912
  }) {
1859
1913
  const ctx = useStateContext();
1860
1914
  const maintainVisibleContentPosition = ctx.state.props.maintainVisibleContentPosition;
1861
- const [otherAxisSize = 0] = useArr$(["otherAxisSize"]);
1915
+ const [alignItemsAtEndPadding = 0, otherAxisSize = 0] = useArr$(["alignItemsAtEndPadding", "otherAxisSize"]);
1862
1916
  const autoOtherAxisStyle = getAutoOtherAxisStyle({
1863
1917
  horizontal,
1864
1918
  needsOtherAxisSize: ctx.state.needsOtherAxisSize,
@@ -1872,23 +1926,23 @@ var ListComponent = typedMemo(function ListComponent2({
1872
1926
  const SnapOrScroll = snapToIndices ? SnapWrapper : ScrollComponent;
1873
1927
  React3.useLayoutEffect(() => {
1874
1928
  if (!ListHeaderComponent) {
1875
- set$(ctx, "headerSize", 0);
1929
+ setHeaderSize(ctx, 0);
1876
1930
  }
1877
1931
  if (!ListFooterComponent) {
1878
- set$(ctx, "footerSize", 0);
1932
+ setFooterSize(ctx, 0);
1879
1933
  }
1880
1934
  }, [ListHeaderComponent, ListFooterComponent, ctx]);
1881
1935
  const onLayoutHeader = React3.useCallback(
1882
1936
  (rect) => {
1883
1937
  const size = rect[horizontal ? "width" : "height"];
1884
- set$(ctx, "headerSize", size);
1938
+ setHeaderSize(ctx, size);
1885
1939
  },
1886
1940
  [ctx, horizontal]
1887
1941
  );
1888
1942
  const onLayoutFooterInternal = React3.useCallback(
1889
1943
  (rect, fromLayoutEffect) => {
1890
1944
  const size = rect[horizontal ? "width" : "height"];
1891
- set$(ctx, "footerSize", size);
1945
+ setFooterSize(ctx, size);
1892
1946
  onLayoutFooter == null ? void 0 : onLayoutFooter(rect, fromLayoutEffect);
1893
1947
  },
1894
1948
  [ctx, horizontal, onLayoutFooter]
@@ -1916,6 +1970,13 @@ var ListComponent = typedMemo(function ListComponent2({
1916
1970
  /* @__PURE__ */ React3__namespace.createElement(ScrollAdjust, null),
1917
1971
  ListHeaderComponent && /* @__PURE__ */ React3__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
1918
1972
  ListEmptyComponent && getComponent(ListEmptyComponent),
1973
+ alignItemsAtEndPadding > 0 && /* @__PURE__ */ React3__namespace.createElement(
1974
+ View,
1975
+ {
1976
+ style: horizontal ? { flexShrink: 0, width: alignItemsAtEndPadding } : { flexShrink: 0, height: alignItemsAtEndPadding }
1977
+ },
1978
+ null
1979
+ ),
1919
1980
  canRender && !ListEmptyComponent && /* @__PURE__ */ React3__namespace.createElement(
1920
1981
  Containers,
1921
1982
  {
@@ -2407,7 +2468,7 @@ function calculateOffsetForIndex(ctx, index) {
2407
2468
 
2408
2469
  // src/core/getTopOffsetAdjustment.ts
2409
2470
  function getTopOffsetAdjustment(ctx) {
2410
- return (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
2471
+ return (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "alignItemsAtEndPadding") || 0) + (peek$(ctx, "headerSize") || 0);
2411
2472
  }
2412
2473
 
2413
2474
  // src/utils/getId.ts
@@ -2443,6 +2504,7 @@ function addTotalSize(ctx, key, add, notifyTotalSize = true) {
2443
2504
  if (notifyTotalSize) {
2444
2505
  set$(ctx, "totalSize", totalSize);
2445
2506
  }
2507
+ updateContentMetrics(ctx);
2446
2508
  }
2447
2509
  } else if (notifyTotalSize && ctx.values.get("totalSize") !== totalSize) {
2448
2510
  set$(ctx, "totalSize", totalSize);
@@ -2462,14 +2524,14 @@ function setSize(ctx, itemKey, size, notifyTotalSize = true) {
2462
2524
  }
2463
2525
 
2464
2526
  // src/utils/getItemSize.ts
2465
- function getKnownOrFixedSize(ctx, key, index, data) {
2466
- var _a3;
2527
+ function getKnownOrFixedSize(ctx, key, index, data, resolved) {
2528
+ var _a3, _b;
2467
2529
  const state = ctx.state;
2468
2530
  const { getFixedItemSize, getItemType } = state.props;
2469
2531
  let size = key ? state.sizesKnown.get(key) : void 0;
2470
2532
  if (size === void 0 && key && getFixedItemSize) {
2471
- const itemType = getItemType ? (_a3 = getItemType(data, index)) != null ? _a3 : "" : "";
2472
- size = getFixedItemSize(data, index, itemType);
2533
+ const itemType = (_b = resolved == null ? void 0 : resolved.itemType) != null ? _b : getItemType ? (_a3 = getItemType(data, index)) != null ? _a3 : "" : "";
2534
+ size = (resolved == null ? void 0 : resolved.didResolveFixedItemSize) ? resolved.fixedItemSize : getFixedItemSize(data, index, itemType);
2473
2535
  if (size !== void 0) {
2474
2536
  state.sizesKnown.set(key, size);
2475
2537
  }
@@ -2488,8 +2550,8 @@ function areKnownOrFixedItemSizesAvailable(ctx, startIndex, endIndex) {
2488
2550
  }
2489
2551
  return true;
2490
2552
  }
2491
- function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, notifyTotalSize) {
2492
- var _a3, _b, _c;
2553
+ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, notifyTotalSize, resolved) {
2554
+ var _a3, _b, _c, _d;
2493
2555
  const state = ctx.state;
2494
2556
  const {
2495
2557
  sizes,
@@ -2508,14 +2570,14 @@ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, no
2508
2570
  return renderedSize;
2509
2571
  }
2510
2572
  }
2511
- size = getKnownOrFixedSize(ctx, key, index, data);
2573
+ size = getKnownOrFixedSize(ctx, key, index, data, resolved);
2512
2574
  if (size !== void 0) {
2513
2575
  setSize(ctx, key, size, notifyTotalSize);
2514
2576
  return size;
2515
2577
  }
2516
- const itemType = getItemType ? (_a3 = getItemType(data, index)) != null ? _a3 : "" : "";
2578
+ const itemType = (_b = resolved == null ? void 0 : resolved.itemType) != null ? _b : getItemType ? (_a3 = getItemType(data, index)) != null ? _a3 : "" : "";
2517
2579
  if (useAverageSize && !scrollingTo) {
2518
- const averageSizeForType = (_b = averageSizes[itemType]) == null ? void 0 : _b.avg;
2580
+ const averageSizeForType = (_c = averageSizes[itemType]) == null ? void 0 : _c.avg;
2519
2581
  if (averageSizeForType !== void 0) {
2520
2582
  size = roundSize(averageSizeForType);
2521
2583
  }
@@ -2524,7 +2586,7 @@ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, no
2524
2586
  return renderedSize;
2525
2587
  }
2526
2588
  if (size === void 0 && useAverageSize && scrollingTo) {
2527
- const averageSizeForType = (_c = scrollingTo.averageSizeSnapshot) == null ? void 0 : _c[itemType];
2589
+ const averageSizeForType = (_d = scrollingTo.averageSizeSnapshot) == null ? void 0 : _d[itemType];
2528
2590
  if (averageSizeForType !== void 0) {
2529
2591
  size = roundSize(averageSizeForType);
2530
2592
  }
@@ -3085,8 +3147,8 @@ function updateScroll(ctx, newScroll, forceUpdate, options) {
3085
3147
  if ((options == null ? void 0 : options.markHasScrolled) !== false) {
3086
3148
  state.hasScrolled = true;
3087
3149
  }
3088
- state.lastBatchingAction = Date.now();
3089
3150
  const currentTime = Date.now();
3151
+ state.lastBatchingAction = currentTime;
3090
3152
  const adjust = scrollAdjustHandler.getAdjust();
3091
3153
  const adjustChanged = lastScrollAdjustForHistory !== void 0 && Math.abs(adjust - lastScrollAdjustForHistory) > 0.1;
3092
3154
  if (adjustChanged) {
@@ -3395,26 +3457,22 @@ function advanceCurrentInitialScrollSession(ctx, options) {
3395
3457
  }
3396
3458
 
3397
3459
  // src/utils/checkAllSizesKnown.ts
3398
- function isNullOrUndefined2(value) {
3399
- return value === null || value === void 0;
3400
- }
3401
- function getMountedIndicesInRange(state, start, end) {
3402
- if (!isNullOrUndefined2(end) && !isNullOrUndefined2(start) && start >= 0 && end >= 0) {
3403
- return Array.from(state.containerItemKeys.keys()).map((key) => state.indexByKey.get(key)).filter((index) => index !== void 0 && index >= start && index <= end).sort((a, b) => a - b);
3460
+ function checkAllSizesKnown(state, start, end) {
3461
+ if (start == null || end == null || start < 0 || end < start) {
3462
+ return false;
3404
3463
  }
3405
- return [];
3406
- }
3407
- function getMountedBufferedIndices(state) {
3408
- return getMountedIndicesInRange(state, state.startBuffered, state.endBuffered);
3409
- }
3410
- function getMountedNoBufferIndices(state) {
3411
- return getMountedIndicesInRange(state, state.startNoBuffer, state.endNoBuffer);
3412
- }
3413
- function checkAllSizesKnown(state, indices) {
3414
- return indices.length > 0 && indices.every((index) => {
3415
- const key = getId(state, index);
3416
- return key !== void 0 && state.sizesKnown.has(key);
3417
- });
3464
+ let hasMountedIndex = false;
3465
+ for (const key of state.containerItemKeys.keys()) {
3466
+ const index = state.indexByKey.get(key);
3467
+ if (index !== void 0 && index >= start && index <= end) {
3468
+ hasMountedIndex = true;
3469
+ const id = getId(state, index);
3470
+ if (id === void 0 || !state.sizesKnown.has(id)) {
3471
+ return false;
3472
+ }
3473
+ }
3474
+ }
3475
+ return hasMountedIndex;
3418
3476
  }
3419
3477
 
3420
3478
  // src/core/bootstrapInitialScroll.ts
@@ -3915,8 +3973,7 @@ function evaluateBootstrapInitialScroll(ctx) {
3915
3973
  bootstrapInitialScroll.targetIndexSeed = void 0;
3916
3974
  }
3917
3975
  const resolvedOffset = resolveInitialScrollOffset(ctx, initialScroll);
3918
- const mountedBufferedIndices = getMountedBufferedIndices(state);
3919
- const areMountedBufferedIndicesMeasured = checkAllSizesKnown(state, mountedBufferedIndices);
3976
+ const areMountedBufferedIndicesMeasured = checkAllSizesKnown(state, state.startBuffered, state.endBuffered);
3920
3977
  const didResolvedOffsetChange = Math.abs(bootstrapInitialScroll.scroll - resolvedOffset) > 1;
3921
3978
  const { data } = state.props;
3922
3979
  const visibleIndices = getBootstrapRevealVisibleIndices({
@@ -4492,7 +4549,14 @@ function updateSnapToOffsets(ctx) {
4492
4549
  }
4493
4550
 
4494
4551
  // src/core/updateItemPositions.ts
4495
- function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false, doMVCP, optimizeForVisibleWindow = false } = {
4552
+ function updateItemPositions(ctx, dataChanged, {
4553
+ doMVCP,
4554
+ forceFullUpdate = false,
4555
+ optimizeForVisibleWindow = false,
4556
+ scrollBottomBuffered,
4557
+ scrollVelocity,
4558
+ startIndex
4559
+ } = {
4496
4560
  doMVCP: false,
4497
4561
  forceFullUpdate: false,
4498
4562
  optimizeForVisibleWindow: false,
@@ -4519,7 +4583,7 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
4519
4583
  const extraData = peek$(ctx, "extraData");
4520
4584
  const layoutConfig = overrideItemLayout ? { span: 1 } : void 0;
4521
4585
  const lastScrollDelta = state.lastScrollDelta;
4522
- const velocity = getScrollVelocity(state);
4586
+ const velocity = scrollVelocity != null ? scrollVelocity : getScrollVelocity(state);
4523
4587
  const shouldOptimize = !forceFullUpdate && !dataChanged && (optimizeForVisibleWindow || Math.abs(velocity) > 0 || state.scrollLength > 0 && lastScrollDelta > state.scrollLength);
4524
4588
  const maxVisibleArea = scrollBottomBuffered + 1e3;
4525
4589
  const useAverageSize = true;
@@ -4699,25 +4763,28 @@ function updateViewableItemsWithConfig(data, viewabilityConfigCallbackPair, stat
4699
4763
  const configId = viewabilityConfig.id;
4700
4764
  const viewabilityState = ensureViewabilityState(ctx, configId);
4701
4765
  const { viewableItems: previousViewableItems, start, end, startBuffered, endBuffered } = viewabilityState;
4702
- const viewabilityTokens = /* @__PURE__ */ new Map();
4766
+ let staleViewabilityAmountIds;
4703
4767
  for (const [containerId, value] of ctx.mapViewabilityAmountValues) {
4704
- viewabilityTokens.set(
4768
+ const nextValue = computeViewability(
4769
+ state,
4770
+ ctx,
4771
+ viewabilityConfig,
4705
4772
  containerId,
4706
- computeViewability(
4707
- state,
4708
- ctx,
4709
- viewabilityConfig,
4710
- containerId,
4711
- value.key,
4712
- scrollSize,
4713
- value.item,
4714
- value.index
4715
- )
4773
+ value.key,
4774
+ scrollSize,
4775
+ value.item,
4776
+ value.index
4716
4777
  );
4778
+ if (nextValue.sizeVisible < 0) {
4779
+ staleViewabilityAmountIds != null ? staleViewabilityAmountIds : staleViewabilityAmountIds = [];
4780
+ staleViewabilityAmountIds.push(containerId);
4781
+ }
4717
4782
  }
4718
4783
  const changed = [];
4784
+ const previousViewableKeys = /* @__PURE__ */ new Set();
4719
4785
  if (previousViewableItems) {
4720
4786
  for (const viewToken of previousViewableItems) {
4787
+ previousViewableKeys.add(viewToken.key);
4721
4788
  const containerId = findContainerId(ctx, viewToken.key);
4722
4789
  if (!checkIsViewable(
4723
4790
  state,
@@ -4749,7 +4816,7 @@ function updateViewableItemsWithConfig(data, viewabilityConfigCallbackPair, stat
4749
4816
  key
4750
4817
  };
4751
4818
  viewableItems.push(viewToken);
4752
- if (!(previousViewableItems == null ? void 0 : previousViewableItems.find((v) => v.key === viewToken.key))) {
4819
+ if (!previousViewableKeys.has(viewToken.key)) {
4753
4820
  changed.push(viewToken);
4754
4821
  }
4755
4822
  }
@@ -4770,24 +4837,21 @@ function updateViewableItemsWithConfig(data, viewabilityConfigCallbackPair, stat
4770
4837
  onViewableItemsChanged({ changed, end, endBuffered, start, startBuffered, viewableItems });
4771
4838
  }
4772
4839
  }
4773
- for (const [containerId, value] of ctx.mapViewabilityAmountValues) {
4774
- if (value.sizeVisible < 0) {
4775
- ctx.mapViewabilityAmountValues.delete(containerId);
4840
+ if (staleViewabilityAmountIds) {
4841
+ for (const containerId of staleViewabilityAmountIds) {
4842
+ const value = ctx.mapViewabilityAmountValues.get(containerId);
4843
+ if (value && value.sizeVisible < 0) {
4844
+ ctx.mapViewabilityAmountValues.delete(containerId);
4845
+ }
4776
4846
  }
4777
4847
  }
4778
4848
  }
4779
- function shallowEqual(prev, next) {
4780
- if (!prev) return false;
4781
- const keys = Object.keys(next);
4782
- for (let i = 0; i < keys.length; i++) {
4783
- const k = keys[i];
4784
- if (prev[k] !== next[k]) return false;
4785
- }
4786
- return true;
4849
+ function areViewabilityAmountTokensEqual(prev, next) {
4850
+ return !!prev && prev.containerId === next.containerId && prev.index === next.index && prev.isViewable === next.isViewable && prev.item === next.item && prev.key === next.key && prev.percentOfScroller === next.percentOfScroller && prev.percentVisible === next.percentVisible && prev.scrollSize === next.scrollSize && prev.size === next.size && prev.sizeVisible === next.sizeVisible;
4787
4851
  }
4788
4852
  function computeViewability(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index) {
4789
4853
  const { sizes, scroll: scrollState } = state;
4790
- const topPad = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
4854
+ const topPad = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "alignItemsAtEndPadding") || 0) + (peek$(ctx, "headerSize") || 0);
4791
4855
  const { itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold } = viewabilityConfig;
4792
4856
  const viewAreaMode = viewAreaCoveragePercentThreshold != null;
4793
4857
  const viewablePercentThreshold = viewAreaMode ? viewAreaCoveragePercentThreshold : itemVisiblePercentThreshold;
@@ -4808,7 +4872,7 @@ function computeViewability(state, ctx, viewabilityConfig, containerId, key, scr
4808
4872
  sizeVisible: -1
4809
4873
  };
4810
4874
  const prev2 = ctx.mapViewabilityAmountValues.get(containerId);
4811
- if (!shallowEqual(prev2, value2)) {
4875
+ if (!areViewabilityAmountTokensEqual(prev2, value2)) {
4812
4876
  ctx.mapViewabilityAmountValues.set(containerId, value2);
4813
4877
  const cb = ctx.mapViewabilityAmountCallbacks.get(containerId);
4814
4878
  if (cb) {
@@ -4838,7 +4902,7 @@ function computeViewability(state, ctx, viewabilityConfig, containerId, key, scr
4838
4902
  sizeVisible
4839
4903
  };
4840
4904
  const prev = ctx.mapViewabilityAmountValues.get(containerId);
4841
- if (!shallowEqual(prev, value)) {
4905
+ if (!areViewabilityAmountTokensEqual(prev, value)) {
4842
4906
  ctx.mapViewabilityAmountValues.set(containerId, value);
4843
4907
  const cb = ctx.mapViewabilityAmountCallbacks.get(containerId);
4844
4908
  if (cb) {
@@ -4889,126 +4953,152 @@ function getExpandedContainerPoolSize(dataLength, numContainers) {
4889
4953
  }
4890
4954
 
4891
4955
  // src/utils/findAvailableContainers.ts
4892
- function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers, protectedKeys) {
4956
+ function findAvailableContainers(ctx, needNewContainers, startBuffered, endBuffered, pendingRemoval, getRequiredItemType, protectedKeys) {
4957
+ const numNeeded = needNewContainers.length;
4958
+ if (numNeeded === 0) {
4959
+ return [];
4960
+ }
4893
4961
  const numContainers = peek$(ctx, "numContainers");
4894
4962
  const state = ctx.state;
4895
4963
  const { stickyContainerPool, containerItemTypes } = state;
4896
4964
  const shouldAvoidAssignedContainerReuse = state.props.recycleItems && !!state.props.positionComponentInternal;
4897
- const result = [];
4898
- const availableContainers = [];
4899
- const pendingRemovalSet = new Set(pendingRemoval);
4965
+ const allocations = [];
4966
+ const pendingRemovalSet = pendingRemoval.length > 0 ? new Set(pendingRemoval) : void 0;
4900
4967
  let pendingRemovalChanged = false;
4968
+ let nextNewContainerIndex = numContainers;
4969
+ const usedContainers = /* @__PURE__ */ new Set();
4970
+ let availableContainers;
4901
4971
  const stickyHeaderIndicesSet = state.props.stickyHeaderIndicesSet;
4902
- const stickyHeaderItemIndices = (needNewContainers == null ? void 0 : needNewContainers.filter((index) => stickyHeaderIndicesSet.has(index))) || [];
4903
4972
  const canReuseContainer = (containerIndex, requiredType) => {
4904
4973
  if (!requiredType) return true;
4905
4974
  const existingType = containerItemTypes.get(containerIndex);
4906
4975
  if (!existingType) return true;
4907
4976
  return existingType === requiredType;
4908
4977
  };
4909
- const neededTypes = requiredItemTypes ? [...requiredItemTypes] : [];
4910
- let typeIndex = 0;
4911
- for (let i = 0; i < stickyHeaderItemIndices.length; i++) {
4912
- const requiredType = neededTypes[typeIndex];
4913
- let foundContainer = false;
4914
- for (const containerIndex of stickyContainerPool) {
4915
- const key = peek$(ctx, `containerItemKey${containerIndex}`);
4916
- const isPendingRemoval = pendingRemovalSet.has(containerIndex);
4917
- if ((key === void 0 || isPendingRemoval) && canReuseContainer(containerIndex, requiredType) && !result.includes(containerIndex)) {
4918
- result.push(containerIndex);
4919
- if (isPendingRemoval && pendingRemovalSet.delete(containerIndex)) {
4920
- pendingRemovalChanged = true;
4921
- }
4922
- foundContainer = true;
4923
- if (requiredItemTypes) typeIndex++;
4924
- break;
4925
- }
4978
+ const pushAllocation = (itemIndex, itemType, containerIndex) => {
4979
+ allocations.push({
4980
+ containerIndex,
4981
+ itemIndex,
4982
+ itemType
4983
+ });
4984
+ usedContainers.add(containerIndex);
4985
+ if (pendingRemovalSet == null ? void 0 : pendingRemovalSet.delete(containerIndex)) {
4986
+ pendingRemovalChanged = true;
4926
4987
  }
4927
- if (!foundContainer) {
4928
- const newContainerIndex = numContainers + result.filter((index) => index >= numContainers).length;
4929
- result.push(newContainerIndex);
4988
+ };
4989
+ const pushNewContainer = (itemIndex, itemType, isSticky) => {
4990
+ const newContainerIndex = nextNewContainerIndex++;
4991
+ pushAllocation(itemIndex, itemType, newContainerIndex);
4992
+ if (isSticky) {
4930
4993
  stickyContainerPool.add(newContainerIndex);
4931
- if (requiredItemTypes) typeIndex++;
4932
- }
4933
- }
4934
- for (let u = 0; u < numContainers && result.length < numNeeded; u++) {
4935
- if (stickyContainerPool.has(u)) {
4936
- continue;
4937
4994
  }
4938
- const key = peek$(ctx, `containerItemKey${u}`);
4939
- const requiredType = neededTypes[typeIndex];
4940
- const isPending = key !== void 0 && pendingRemovalSet.has(u);
4941
- const canUse = key === void 0 || isPending && canReuseContainer(u, requiredType);
4942
- if (canUse) {
4943
- if (isPending) {
4944
- pendingRemovalSet.delete(u);
4945
- pendingRemovalChanged = true;
4946
- }
4947
- result.push(u);
4948
- if (requiredItemTypes) {
4949
- typeIndex++;
4950
- }
4995
+ return newContainerIndex;
4996
+ };
4997
+ const canUseContainer = (containerIndex, itemType) => {
4998
+ if (usedContainers.has(containerIndex) || stickyContainerPool.has(containerIndex)) {
4999
+ return false;
4951
5000
  }
4952
- }
4953
- if (!shouldAvoidAssignedContainerReuse) {
4954
- for (let u = 0; u < numContainers && result.length < numNeeded; u++) {
4955
- if (stickyContainerPool.has(u)) {
4956
- continue;
4957
- }
4958
- const key = peek$(ctx, `containerItemKey${u}`);
4959
- if (key === void 0) continue;
4960
- if ((protectedKeys == null ? void 0 : protectedKeys.has(key)) && state.indexByKey.has(key)) continue;
4961
- const index = state.indexByKey.get(key);
4962
- const isOutOfView = index < startBuffered || index > endBuffered;
4963
- if (isOutOfView) {
4964
- const distance = index < startBuffered ? startBuffered - index : index - endBuffered;
4965
- if (!requiredItemTypes || typeIndex < neededTypes.length && canReuseContainer(u, neededTypes[typeIndex])) {
4966
- availableContainers.push({ distance, index: u });
5001
+ const key = peek$(ctx, `containerItemKey${containerIndex}`);
5002
+ const isPending = !!(pendingRemovalSet == null ? void 0 : pendingRemovalSet.has(containerIndex));
5003
+ return (key === void 0 || isPending) && canReuseContainer(containerIndex, itemType);
5004
+ };
5005
+ const findStickyContainer = (itemType) => {
5006
+ let foundContainer;
5007
+ for (const containerIndex of stickyContainerPool) {
5008
+ if (!usedContainers.has(containerIndex)) {
5009
+ const key = peek$(ctx, `containerItemKey${containerIndex}`);
5010
+ const isPendingRemoval = !!(pendingRemovalSet == null ? void 0 : pendingRemovalSet.has(containerIndex));
5011
+ if ((key === void 0 || isPendingRemoval) && canReuseContainer(containerIndex, itemType)) {
5012
+ foundContainer = containerIndex;
5013
+ break;
4967
5014
  }
4968
5015
  }
4969
5016
  }
4970
- }
4971
- const remaining = numNeeded - result.length;
4972
- if (remaining > 0) {
4973
- if (availableContainers.length > 0) {
4974
- if (availableContainers.length > remaining) {
4975
- availableContainers.sort(comparatorByDistance);
4976
- availableContainers.length = remaining;
5017
+ return foundContainer;
5018
+ };
5019
+ const findUnassignedOrPendingContainer = (itemType) => {
5020
+ let foundContainer;
5021
+ for (let containerIndex = 0; containerIndex < numContainers && foundContainer === void 0; containerIndex++) {
5022
+ if (canUseContainer(containerIndex, itemType)) {
5023
+ foundContainer = containerIndex;
4977
5024
  }
4978
- for (const container of availableContainers) {
4979
- result.push(container.index);
4980
- if (requiredItemTypes) {
4981
- typeIndex++;
5025
+ }
5026
+ return foundContainer;
5027
+ };
5028
+ const getAvailableContainers = () => {
5029
+ if (!availableContainers) {
5030
+ availableContainers = [];
5031
+ if (!shouldAvoidAssignedContainerReuse) {
5032
+ for (let containerIndex = 0; containerIndex < numContainers; containerIndex++) {
5033
+ if (usedContainers.has(containerIndex) || stickyContainerPool.has(containerIndex)) {
5034
+ continue;
5035
+ }
5036
+ const key = peek$(ctx, `containerItemKey${containerIndex}`);
5037
+ if (key === void 0) continue;
5038
+ if ((protectedKeys == null ? void 0 : protectedKeys.has(key)) && state.indexByKey.has(key)) continue;
5039
+ const index = state.indexByKey.get(key);
5040
+ const isOutOfView = index < startBuffered || index > endBuffered;
5041
+ if (isOutOfView) {
5042
+ const distance = index < startBuffered ? startBuffered - index : index - endBuffered;
5043
+ availableContainers.push({ distance, index: containerIndex });
5044
+ }
4982
5045
  }
5046
+ availableContainers.sort(comparatorByDistance);
4983
5047
  }
4984
5048
  }
4985
- const stillNeeded = numNeeded - result.length;
4986
- if (stillNeeded > 0) {
4987
- for (let i = 0; i < stillNeeded; i++) {
4988
- result.push(numContainers + i);
5049
+ return availableContainers;
5050
+ };
5051
+ const findAvailableContainer = (itemType) => {
5052
+ const containers = getAvailableContainers();
5053
+ let matchIndex = -1;
5054
+ for (let i = 0; i < containers.length && matchIndex === -1; i++) {
5055
+ const containerIndex = containers[i].index;
5056
+ if (!usedContainers.has(containerIndex) && canReuseContainer(containerIndex, itemType)) {
5057
+ matchIndex = i;
4989
5058
  }
4990
- if (IS_DEV && numContainers + stillNeeded > peek$(ctx, "numContainersPooled")) {
4991
- console.warn(
4992
- "[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",
4993
- {
4994
- debugInfo: {
4995
- numContainers,
4996
- numContainersPooled: peek$(ctx, "numContainersPooled"),
4997
- numNeeded,
4998
- stillNeeded
4999
- }
5000
- }
5001
- );
5059
+ }
5060
+ return matchIndex === -1 ? void 0 : containers.splice(matchIndex, 1)[0].index;
5061
+ };
5062
+ for (const itemIndex of needNewContainers) {
5063
+ const itemType = getRequiredItemType == null ? void 0 : getRequiredItemType(itemIndex);
5064
+ const isSticky = stickyHeaderIndicesSet.has(itemIndex);
5065
+ let containerIndex;
5066
+ if (isSticky) {
5067
+ containerIndex = findStickyContainer(itemType);
5068
+ } else {
5069
+ containerIndex = findUnassignedOrPendingContainer(itemType);
5070
+ if (containerIndex === void 0) {
5071
+ containerIndex = findAvailableContainer(itemType);
5002
5072
  }
5003
5073
  }
5074
+ if (containerIndex !== void 0) {
5075
+ pushAllocation(itemIndex, itemType, containerIndex);
5076
+ } else {
5077
+ pushNewContainer(itemIndex, itemType, isSticky);
5078
+ }
5004
5079
  }
5005
5080
  if (pendingRemovalChanged) {
5006
5081
  pendingRemoval.length = 0;
5007
- for (const value of pendingRemovalSet) {
5008
- pendingRemoval.push(value);
5082
+ if (pendingRemovalSet) {
5083
+ for (const value of pendingRemovalSet) {
5084
+ pendingRemoval.push(value);
5085
+ }
5009
5086
  }
5010
5087
  }
5011
- return result.sort(comparatorDefault);
5088
+ if (IS_DEV && nextNewContainerIndex > peek$(ctx, "numContainersPooled")) {
5089
+ console.warn(
5090
+ "[legend-list] No unused container available, so creating one on demand. This can be a minor performance issue and is likely caused by the estimatedItemSize being too large. Consider decreasing estimatedItemSize.",
5091
+ {
5092
+ debugInfo: {
5093
+ numContainers,
5094
+ numContainersPooled: peek$(ctx, "numContainersPooled"),
5095
+ numNeeded,
5096
+ stillNeeded: nextNewContainerIndex - numContainers
5097
+ }
5098
+ }
5099
+ );
5100
+ }
5101
+ return allocations;
5012
5102
  }
5013
5103
  function comparatorByDistance(a, b) {
5014
5104
  return b.distance - a.distance;
@@ -5034,21 +5124,28 @@ function findCurrentStickyIndex(stickyArray, scroll, state) {
5034
5124
  }
5035
5125
  return -1;
5036
5126
  }
5037
- function getActiveStickyIndices(ctx, stickyHeaderIndices) {
5127
+ function isStickyIndexActive(ctx, targetIndex) {
5038
5128
  const state = ctx.state;
5039
- return new Set(
5040
- Array.from(state.stickyContainerPool).map((i) => peek$(ctx, `containerItemKey${i}`)).map((key) => key ? state.indexByKey.get(key) : void 0).filter((idx) => idx !== void 0 && stickyHeaderIndices.has(idx))
5041
- );
5129
+ let isActive = false;
5130
+ for (const containerIndex of state.stickyContainerPool) {
5131
+ const key = peek$(ctx, `containerItemKey${containerIndex}`);
5132
+ const itemIndex = key ? state.indexByKey.get(key) : void 0;
5133
+ if (itemIndex === targetIndex) {
5134
+ isActive = true;
5135
+ break;
5136
+ }
5137
+ }
5138
+ return isActive;
5042
5139
  }
5043
- function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, needNewContainersSet, startBuffered, endBuffered) {
5140
+ function handleStickyActivation(ctx, stickyArray, currentStickyIdx, needNewContainers, needNewContainersSet, startBuffered, endBuffered) {
5044
5141
  var _a3;
5045
5142
  const state = ctx.state;
5046
- const activeIndices = getActiveStickyIndices(ctx, stickyHeaderIndices);
5047
5143
  set$(ctx, "activeStickyIndex", currentStickyIdx >= 0 ? stickyArray[currentStickyIdx] : -1);
5048
5144
  for (let offset = 0; offset <= 1; offset++) {
5049
5145
  const idx = currentStickyIdx - offset;
5050
- if (idx < 0 || activeIndices.has(stickyArray[idx])) continue;
5146
+ if (idx < 0) continue;
5051
5147
  const stickyIndex = stickyArray[idx];
5148
+ if (isStickyIndexActive(ctx, stickyIndex)) continue;
5052
5149
  const stickyId = (_a3 = state.idCache[stickyIndex]) != null ? _a3 : getId(state, stickyIndex);
5053
5150
  if (stickyId && !state.containerItemKeys.has(stickyId) && (stickyIndex < startBuffered || stickyIndex > endBuffered) && !needNewContainersSet.has(stickyIndex)) {
5054
5151
  needNewContainersSet.add(stickyIndex);
@@ -5090,10 +5187,86 @@ function handleStickyRecycling(ctx, stickyArray, scroll, drawDistance, currentSt
5090
5187
  }
5091
5188
  }
5092
5189
  }
5190
+ function trackVisibleRange(range, i, top, size, scroll, scrollBottom) {
5191
+ let didPassVisibleEnd = false;
5192
+ if (range.startNoBuffer === null && top + size > scroll) {
5193
+ range.startNoBuffer = i;
5194
+ }
5195
+ if (range.firstFullyOnScreenIndex === void 0 && top >= scroll - 10 && top <= scrollBottom) {
5196
+ range.firstFullyOnScreenIndex = i;
5197
+ }
5198
+ if (range.startNoBuffer !== null) {
5199
+ if (top <= scrollBottom) {
5200
+ range.endNoBuffer = i;
5201
+ } else {
5202
+ didPassVisibleEnd = true;
5203
+ }
5204
+ }
5205
+ return didPassVisibleEnd;
5206
+ }
5207
+ function getIdsInVisibleRange(state, range) {
5208
+ var _a3, _b;
5209
+ const idsInView = [];
5210
+ const firstVisibleAnchorIndex = (_a3 = range.firstFullyOnScreenIndex) != null ? _a3 : range.startNoBuffer;
5211
+ if (firstVisibleAnchorIndex !== null && firstVisibleAnchorIndex !== void 0 && range.endNoBuffer !== null) {
5212
+ for (let i = firstVisibleAnchorIndex; i <= range.endNoBuffer; i++) {
5213
+ const id = (_b = state.idCache[i]) != null ? _b : getId(state, i);
5214
+ idsInView.push(id);
5215
+ }
5216
+ }
5217
+ return idsInView;
5218
+ }
5219
+ function updateViewabilityForCachedRange(ctx, viewabilityConfigCallbackPairs, scrollLength, scroll, scrollBottom) {
5220
+ var _a3, _b;
5221
+ const state = ctx.state;
5222
+ const {
5223
+ endBuffered,
5224
+ idCache,
5225
+ positions,
5226
+ props: { data },
5227
+ sizes,
5228
+ startBuffered
5229
+ } = state;
5230
+ if (startBuffered === null || endBuffered === null || startBuffered < 0 || endBuffered < startBuffered) {
5231
+ return;
5232
+ }
5233
+ const visibleRange = {
5234
+ endNoBuffer: null,
5235
+ firstFullyOnScreenIndex: void 0,
5236
+ startNoBuffer: null
5237
+ };
5238
+ for (let i = startBuffered; i <= endBuffered && i < data.length; i++) {
5239
+ const id = (_a3 = idCache[i]) != null ? _a3 : getId(state, i);
5240
+ const size = (_b = sizes.get(id)) != null ? _b : getItemSize(ctx, id, i, data[i]);
5241
+ const top = positions[i];
5242
+ const didPassVisibleEnd = trackVisibleRange(visibleRange, i, top, size, scroll, scrollBottom);
5243
+ if (didPassVisibleEnd) {
5244
+ break;
5245
+ }
5246
+ }
5247
+ Object.assign(state, {
5248
+ endNoBuffer: visibleRange.endNoBuffer,
5249
+ firstFullyOnScreenIndex: visibleRange.firstFullyOnScreenIndex,
5250
+ idsInView: getIdsInVisibleRange(state, visibleRange),
5251
+ startNoBuffer: visibleRange.startNoBuffer
5252
+ });
5253
+ if (visibleRange.startNoBuffer !== null && visibleRange.endNoBuffer !== null) {
5254
+ updateViewableItems(
5255
+ state,
5256
+ ctx,
5257
+ viewabilityConfigCallbackPairs,
5258
+ scrollLength,
5259
+ visibleRange.startNoBuffer,
5260
+ visibleRange.endNoBuffer,
5261
+ startBuffered,
5262
+ endBuffered
5263
+ );
5264
+ }
5265
+ }
5093
5266
  function calculateItemsInView(ctx, params = {}) {
5094
5267
  const state = ctx.state;
5095
5268
  batchedUpdates(() => {
5096
- var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
5269
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
5097
5270
  const {
5098
5271
  columns,
5099
5272
  containerItemKeys,
@@ -5129,7 +5302,7 @@ function calculateItemsInView(ctx, params = {}) {
5129
5302
  return;
5130
5303
  }
5131
5304
  let totalSize = getContentSize(ctx);
5132
- const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
5305
+ const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "alignItemsAtEndPadding") + peek$(ctx, "headerSize");
5133
5306
  const numColumns = peek$(ctx, "numColumns");
5134
5307
  const speed = getScrollVelocity(state);
5135
5308
  const scrollExtra = 0;
@@ -5194,6 +5367,15 @@ function calculateItemsInView(ctx, params = {}) {
5194
5367
  state.scrollForNextCalculateItemsInView = void 0;
5195
5368
  } else if ((top === null || scrollTopBuffered > top) && (bottom === null || scrollBottomBuffered < bottom)) {
5196
5369
  if (!isInMVCPActiveMode(state)) {
5370
+ if (viewabilityConfigCallbackPairs) {
5371
+ updateViewabilityForCachedRange(
5372
+ ctx,
5373
+ viewabilityConfigCallbackPairs,
5374
+ scrollLength,
5375
+ scroll,
5376
+ scrollBottom
5377
+ );
5378
+ }
5197
5379
  finishCalculateItemsInView == null ? void 0 : finishCalculateItemsInView();
5198
5380
  return;
5199
5381
  }
@@ -5210,6 +5392,7 @@ function calculateItemsInView(ctx, params = {}) {
5210
5392
  forceFullUpdate: !!forceFullItemPositions,
5211
5393
  optimizeForVisibleWindow,
5212
5394
  scrollBottomBuffered,
5395
+ scrollVelocity: speed,
5213
5396
  startIndex
5214
5397
  });
5215
5398
  totalSize = getContentSize(ctx);
@@ -5235,10 +5418,8 @@ function calculateItemsInView(ctx, params = {}) {
5235
5418
  updateScroll2(state.scroll);
5236
5419
  updateScrollRange();
5237
5420
  }
5238
- let startNoBuffer = null;
5239
5421
  let startBuffered = null;
5240
5422
  let startBufferedId = null;
5241
- let endNoBuffer = null;
5242
5423
  let endBuffered = null;
5243
5424
  let loopStart = (_f = suppressInitialScrollSideEffects ? bootstrapInitialScrollState == null ? void 0 : bootstrapInitialScrollState.targetIndexSeed : void 0) != null ? _f : !dataChanged && startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
5244
5425
  for (let i = loopStart; i >= 0; i--) {
@@ -5272,19 +5453,18 @@ function calculateItemsInView(ctx, params = {}) {
5272
5453
  maxIndexRendered = Math.max(maxIndexRendered, index);
5273
5454
  }
5274
5455
  }
5275
- let firstFullyOnScreenIndex;
5456
+ const visibleRange = {
5457
+ endNoBuffer: null,
5458
+ firstFullyOnScreenIndex: void 0,
5459
+ startNoBuffer: null
5460
+ };
5276
5461
  const dataLength = data.length;
5277
5462
  for (let i = Math.max(0, loopStart); i < dataLength && (!foundEnd || i <= maxIndexRendered); i++) {
5278
5463
  const id = (_i = idCache[i]) != null ? _i : getId(state, i);
5279
5464
  const size = (_j = sizes.get(id)) != null ? _j : getItemSize(ctx, id, i, data[i]);
5280
5465
  const top = positions[i];
5281
5466
  if (!foundEnd) {
5282
- if (startNoBuffer === null && top + size > scroll) {
5283
- startNoBuffer = i;
5284
- }
5285
- if (firstFullyOnScreenIndex === void 0 && top >= scroll - 10 && top <= scrollBottom) {
5286
- firstFullyOnScreenIndex = i;
5287
- }
5467
+ trackVisibleRange(visibleRange, i, top, size, scroll, scrollBottom);
5288
5468
  if (startBuffered === null && top + size > scrollTopBuffered) {
5289
5469
  startBuffered = i;
5290
5470
  startBufferedId = id;
@@ -5294,10 +5474,7 @@ function calculateItemsInView(ctx, params = {}) {
5294
5474
  nextTop = top;
5295
5475
  }
5296
5476
  }
5297
- if (startNoBuffer !== null) {
5298
- if (top <= scrollBottom) {
5299
- endNoBuffer = i;
5300
- }
5477
+ if (visibleRange.startNoBuffer !== null) {
5301
5478
  if (top <= scrollBottomBuffered) {
5302
5479
  endBuffered = i;
5303
5480
  if (scrollBottomBuffered > totalSize) {
@@ -5311,22 +5488,14 @@ function calculateItemsInView(ctx, params = {}) {
5311
5488
  }
5312
5489
  }
5313
5490
  }
5314
- const idsInView = [];
5315
- const firstVisibleAnchorIndex = firstFullyOnScreenIndex != null ? firstFullyOnScreenIndex : startNoBuffer;
5316
- if (firstVisibleAnchorIndex !== null && firstVisibleAnchorIndex !== void 0 && endNoBuffer !== null) {
5317
- for (let i = firstVisibleAnchorIndex; i <= endNoBuffer; i++) {
5318
- const id = (_k = idCache[i]) != null ? _k : getId(state, i);
5319
- idsInView.push(id);
5320
- }
5321
- }
5322
5491
  Object.assign(state, {
5323
5492
  endBuffered,
5324
- endNoBuffer,
5325
- firstFullyOnScreenIndex,
5326
- idsInView,
5493
+ endNoBuffer: visibleRange.endNoBuffer,
5494
+ firstFullyOnScreenIndex: visibleRange.firstFullyOnScreenIndex,
5495
+ idsInView: getIdsInVisibleRange(state, visibleRange),
5327
5496
  startBuffered,
5328
5497
  startBufferedId,
5329
- startNoBuffer
5498
+ startNoBuffer: visibleRange.startNoBuffer
5330
5499
  });
5331
5500
  if (enableScrollForNextCalculateItemsInView && nextTop !== void 0 && nextBottom !== void 0) {
5332
5501
  state.scrollForNextCalculateItemsInView = isNullOrUndefined(nextTop) && isNullOrUndefined(nextBottom) ? void 0 : {
@@ -5348,7 +5517,7 @@ function calculateItemsInView(ctx, params = {}) {
5348
5517
  const needNewContainers = [];
5349
5518
  const needNewContainersSet = /* @__PURE__ */ new Set();
5350
5519
  for (let i = startBuffered; i <= endBuffered; i++) {
5351
- const id = (_l = idCache[i]) != null ? _l : getId(state, i);
5520
+ const id = (_k = idCache[i]) != null ? _k : getId(state, i);
5352
5521
  if (!containerItemKeys.has(id)) {
5353
5522
  needNewContainersSet.add(i);
5354
5523
  needNewContainers.push(i);
@@ -5357,7 +5526,7 @@ function calculateItemsInView(ctx, params = {}) {
5357
5526
  if (alwaysRenderArr.length > 0) {
5358
5527
  for (const index of alwaysRenderArr) {
5359
5528
  if (index < 0 || index >= dataLength) continue;
5360
- const id = (_m = idCache[index]) != null ? _m : getId(state, index);
5529
+ const id = (_l = idCache[index]) != null ? _l : getId(state, index);
5361
5530
  if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
5362
5531
  needNewContainersSet.add(index);
5363
5532
  needNewContainers.push(index);
@@ -5367,7 +5536,6 @@ function calculateItemsInView(ctx, params = {}) {
5367
5536
  if (stickyHeaderIndicesArr.length > 0) {
5368
5537
  handleStickyActivation(
5369
5538
  ctx,
5370
- stickyHeaderIndicesSet,
5371
5539
  stickyHeaderIndicesArr,
5372
5540
  currentStickyIdx,
5373
5541
  needNewContainers,
@@ -5379,35 +5547,34 @@ function calculateItemsInView(ctx, params = {}) {
5379
5547
  set$(ctx, "activeStickyIndex", -1);
5380
5548
  }
5381
5549
  if (needNewContainers.length > 0) {
5382
- const requiredItemTypes = getItemType ? needNewContainers.map((i) => {
5550
+ const getRequiredItemType = getItemType ? (i) => {
5383
5551
  const itemType = getItemType(data[i], i);
5384
5552
  return itemType !== void 0 ? String(itemType) : "";
5385
- }) : void 0;
5386
- const availableContainers = findAvailableContainers(
5553
+ } : void 0;
5554
+ const availableContainerAllocations = findAvailableContainers(
5387
5555
  ctx,
5388
- needNewContainers.length,
5556
+ needNewContainers,
5389
5557
  startBuffered,
5390
5558
  endBuffered,
5391
5559
  pendingRemoval,
5392
- requiredItemTypes,
5393
- needNewContainers,
5560
+ getRequiredItemType,
5394
5561
  protectedContainerKeys
5395
5562
  );
5396
- for (let idx = 0; idx < needNewContainers.length; idx++) {
5397
- const i = needNewContainers[idx];
5398
- const containerIndex = availableContainers[idx];
5399
- const id = (_n = idCache[i]) != null ? _n : getId(state, i);
5563
+ for (const allocation of availableContainerAllocations) {
5564
+ const i = allocation.itemIndex;
5565
+ const containerIndex = allocation.containerIndex;
5566
+ const id = (_m = idCache[i]) != null ? _m : getId(state, i);
5400
5567
  const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
5401
5568
  if (oldKey && oldKey !== id) {
5402
5569
  containerItemKeys.delete(oldKey);
5403
5570
  }
5404
5571
  set$(ctx, `containerItemKey${containerIndex}`, id);
5405
5572
  set$(ctx, `containerItemData${containerIndex}`, data[i]);
5406
- if (requiredItemTypes) {
5407
- state.containerItemTypes.set(containerIndex, requiredItemTypes[idx]);
5573
+ if (allocation.itemType !== void 0) {
5574
+ state.containerItemTypes.set(containerIndex, allocation.itemType);
5408
5575
  }
5409
5576
  containerItemKeys.set(id, containerIndex);
5410
- (_o = state.userScrollAnchorReset) == null ? void 0 : _o.keys.add(id);
5577
+ (_n = state.userScrollAnchorReset) == null ? void 0 : _n.keys.add(id);
5411
5578
  const containerSticky = `containerSticky${containerIndex}`;
5412
5579
  const isSticky = stickyHeaderIndicesSet.has(i);
5413
5580
  const isAlwaysRender = alwaysRenderSet.has(i);
@@ -5445,7 +5612,7 @@ function calculateItemsInView(ctx, params = {}) {
5445
5612
  if (alwaysRenderArr.length > 0) {
5446
5613
  for (const index of alwaysRenderArr) {
5447
5614
  if (index < 0 || index >= dataLength) continue;
5448
- const id = (_p = idCache[index]) != null ? _p : getId(state, index);
5615
+ const id = (_o = idCache[index]) != null ? _o : getId(state, index);
5449
5616
  const containerIndex = containerItemKeys.get(id);
5450
5617
  if (containerIndex !== void 0) {
5451
5618
  state.stickyContainerPool.add(containerIndex);
@@ -5464,10 +5631,11 @@ function calculateItemsInView(ctx, params = {}) {
5464
5631
  alwaysRenderSet
5465
5632
  );
5466
5633
  }
5634
+ const pendingRemovalSet = pendingRemoval.length > 0 ? new Set(pendingRemoval) : void 0;
5467
5635
  let didChangePositions = false;
5468
5636
  for (let i = 0; i < numContainers; i++) {
5469
5637
  const itemKey = peek$(ctx, `containerItemKey${i}`);
5470
- if (pendingRemoval.includes(i)) {
5638
+ if (pendingRemovalSet == null ? void 0 : pendingRemovalSet.has(i)) {
5471
5639
  if (itemKey !== void 0) {
5472
5640
  containerItemKeys.delete(itemKey);
5473
5641
  }
@@ -5498,24 +5666,24 @@ function calculateItemsInView(ctx, params = {}) {
5498
5666
  evaluateBootstrapInitialScroll(ctx);
5499
5667
  return;
5500
5668
  }
5501
- const mountedBufferedIndices = getMountedBufferedIndices(state);
5502
- const mountedNoBufferIndices = getMountedNoBufferIndices(state);
5503
- const readinessIndices = hasActiveInitialScroll(state) ? mountedBufferedIndices : mountedNoBufferIndices.length > 0 ? mountedNoBufferIndices : mountedBufferedIndices;
5504
- if (!queuedInitialLayout && readinessIndices.length > 0 && checkAllSizesKnown(state, readinessIndices)) {
5505
- setDidLayout(ctx);
5506
- handleInitialScrollLayoutReady(ctx);
5669
+ if (!queuedInitialLayout && !state.didContainersLayout) {
5670
+ const isInitialLayoutReady = hasActiveInitialScroll(state) ? checkAllSizesKnown(state, state.startBuffered, state.endBuffered) : checkAllSizesKnown(state, state.startNoBuffer, state.endNoBuffer) || checkAllSizesKnown(state, state.startBuffered, state.endBuffered);
5671
+ if (isInitialLayoutReady) {
5672
+ setDidLayout(ctx);
5673
+ handleInitialScrollLayoutReady(ctx);
5674
+ }
5507
5675
  }
5508
- if (viewabilityConfigCallbackPairs && startNoBuffer !== null && endNoBuffer !== null) {
5676
+ if (viewabilityConfigCallbackPairs && visibleRange.startNoBuffer !== null && visibleRange.endNoBuffer !== null) {
5509
5677
  if (!didMVCPAdjustScroll) {
5510
5678
  updateViewableItems(
5511
5679
  ctx.state,
5512
5680
  ctx,
5513
5681
  viewabilityConfigCallbackPairs,
5514
5682
  scrollLength,
5515
- startNoBuffer,
5516
- endNoBuffer,
5517
- startBuffered != null ? startBuffered : startNoBuffer,
5518
- endBuffered != null ? endBuffered : endNoBuffer
5683
+ visibleRange.startNoBuffer,
5684
+ visibleRange.endNoBuffer,
5685
+ startBuffered != null ? startBuffered : visibleRange.startNoBuffer,
5686
+ endBuffered != null ? endBuffered : visibleRange.endNoBuffer
5519
5687
  );
5520
5688
  }
5521
5689
  }
@@ -5678,6 +5846,7 @@ function handleLayout(ctx, layoutParam, setCanRender) {
5678
5846
  if (didChange) {
5679
5847
  state.scrollLength = scrollLength;
5680
5848
  state.otherAxisSize = otherAxisSize;
5849
+ updateContentMetrics(ctx);
5681
5850
  state.lastBatchingAction = Date.now();
5682
5851
  state.scrollForNextCalculateItemsInView = void 0;
5683
5852
  if (scrollLength > 0) {
@@ -5974,6 +6143,7 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5974
6143
  } = state;
5975
6144
  if (!data) return;
5976
6145
  const index = state.indexByKey.get(itemKey);
6146
+ let resolvedMeasurementItem;
5977
6147
  if (getFixedItemSize) {
5978
6148
  if (index === void 0) {
5979
6149
  return;
@@ -5984,6 +6154,12 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5984
6154
  }
5985
6155
  const type = getItemType ? (_a3 = getItemType(itemData, index)) != null ? _a3 : "" : "";
5986
6156
  const size2 = getFixedItemSize(itemData, index, type);
6157
+ resolvedMeasurementItem = {
6158
+ didResolveFixedItemSize: true,
6159
+ fixedItemSize: size2,
6160
+ itemData,
6161
+ itemType: type
6162
+ };
5987
6163
  if (size2 !== void 0 && size2 === sizesKnown.get(itemKey)) {
5988
6164
  updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
5989
6165
  return;
@@ -5993,7 +6169,7 @@ function updateItemSize(ctx, itemKey, sizeObj) {
5993
6169
  let shouldMaintainScrollAtEnd = false;
5994
6170
  let minIndexSizeChanged;
5995
6171
  const prevSizeKnown = state.sizesKnown.get(itemKey);
5996
- const diff = updateOneItemSize(ctx, itemKey, sizeObj);
6172
+ const diff = updateOneItemSize(ctx, itemKey, sizeObj, resolvedMeasurementItem);
5997
6173
  const size = roundSize(horizontal ? sizeObj.width : sizeObj.height);
5998
6174
  if (diff !== 0) {
5999
6175
  minIndexSizeChanged = minIndexSizeChanged !== void 0 ? Math.min(minIndexSizeChanged, index) : index;
@@ -6018,7 +6194,7 @@ function updateItemSize(ctx, itemKey, sizeObj) {
6018
6194
  state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, minIndexSizeChanged) : minIndexSizeChanged;
6019
6195
  }
6020
6196
  updateOtherAxisSizeIfNeeded(ctx, sizeObj, horizontal);
6021
- if (didContainersLayout || checkAllSizesKnown(state, getMountedBufferedIndices(state))) {
6197
+ if (didContainersLayout || checkAllSizesKnown(state, state.startBuffered, state.endBuffered)) {
6022
6198
  if (needsRecalculate) {
6023
6199
  state.scrollForNextCalculateItemsInView = void 0;
6024
6200
  runOrScheduleMVCPRecalculate(ctx);
@@ -6032,8 +6208,8 @@ function updateItemSize(ctx, itemKey, sizeObj) {
6032
6208
  }
6033
6209
  }
6034
6210
  }
6035
- function updateOneItemSize(ctx, itemKey, sizeObj) {
6036
- var _a3, _b;
6211
+ function updateOneItemSize(ctx, itemKey, sizeObj, resolvedMeasurementItem) {
6212
+ var _a3, _b, _c;
6037
6213
  const state = ctx.state;
6038
6214
  const {
6039
6215
  indexByKey,
@@ -6043,20 +6219,25 @@ function updateOneItemSize(ctx, itemKey, sizeObj) {
6043
6219
  } = state;
6044
6220
  if (!data) return 0;
6045
6221
  const index = indexByKey.get(itemKey);
6046
- const itemData = data[index];
6047
- let itemType;
6048
- let fixedItemSize;
6049
- if (getFixedItemSize) {
6050
- itemType = getItemType ? (_a3 = getItemType(itemData, index)) != null ? _a3 : "" : "";
6222
+ const itemData = (_a3 = resolvedMeasurementItem == null ? void 0 : resolvedMeasurementItem.itemData) != null ? _a3 : data[index];
6223
+ let itemType = resolvedMeasurementItem == null ? void 0 : resolvedMeasurementItem.itemType;
6224
+ let fixedItemSize = resolvedMeasurementItem == null ? void 0 : resolvedMeasurementItem.fixedItemSize;
6225
+ if (getFixedItemSize && !(resolvedMeasurementItem == null ? void 0 : resolvedMeasurementItem.didResolveFixedItemSize)) {
6226
+ itemType = getItemType ? (_b = getItemType(itemData, index)) != null ? _b : "" : "";
6051
6227
  fixedItemSize = getFixedItemSize(itemData, index, itemType);
6052
6228
  }
6053
- const prevSize = getItemSize(ctx, itemKey, index, itemData);
6229
+ const resolvedItemSize = (resolvedMeasurementItem == null ? void 0 : resolvedMeasurementItem.didResolveFixedItemSize) || itemType !== void 0 || fixedItemSize !== void 0 ? {
6230
+ didResolveFixedItemSize: resolvedMeasurementItem == null ? void 0 : resolvedMeasurementItem.didResolveFixedItemSize,
6231
+ fixedItemSize,
6232
+ itemType
6233
+ } : void 0;
6234
+ const prevSize = getItemSize(ctx, itemKey, index, itemData, void 0, void 0, void 0, resolvedItemSize);
6054
6235
  const rawSize = horizontal ? sizeObj.width : sizeObj.height;
6055
6236
  const prevSizeKnown = sizesKnown.get(itemKey);
6056
6237
  const size = Math.round(rawSize) ;
6057
6238
  sizesKnown.set(itemKey, size);
6058
6239
  if (fixedItemSize === void 0 && size > 0) {
6059
- itemType != null ? itemType : itemType = getItemType ? (_b = getItemType(itemData, index)) != null ? _b : "" : "";
6240
+ itemType != null ? itemType : itemType = getItemType ? (_c = getItemType(itemData, index)) != null ? _c : "" : "";
6060
6241
  let averages = averageSizes[itemType];
6061
6242
  if (!averages) {
6062
6243
  averages = averageSizes[itemType] = { avg: 0, num: 0 };
@@ -6158,6 +6339,11 @@ function getAverageItemSizes(state) {
6158
6339
  }
6159
6340
  return averageItemSizes;
6160
6341
  }
6342
+ function triggerMountedContainerLayouts(ctx) {
6343
+ for (const triggerLayout of ctx.containerLayoutTriggers.values()) {
6344
+ triggerLayout();
6345
+ }
6346
+ }
6161
6347
  function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {
6162
6348
  const state = ctx.state;
6163
6349
  const IMPERATIVE_SCROLL_SETTLE_MAX_WAIT_MS = 800;
@@ -6283,6 +6469,7 @@ function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {
6283
6469
  state.columns.length = 0;
6284
6470
  state.columnSpans.length = 0;
6285
6471
  }
6472
+ triggerMountedContainerLayouts(ctx);
6286
6473
  (_b = state.triggerCalculateItemsInView) == null ? void 0 : _b.call(state, { forceFullItemPositions: true });
6287
6474
  };
6288
6475
  return {
@@ -6325,10 +6512,7 @@ function createImperativeHandle(ctx, scheduleImperativeScrollCommit) {
6325
6512
  startBuffered: state.startBuffered
6326
6513
  }),
6327
6514
  reportContentInset: (inset) => {
6328
- var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6329
- const previousInset = state.contentInsetOverride;
6330
- state.contentInsetOverride = inset != null ? inset : void 0;
6331
- const didChange = ((_a3 = previousInset == null ? void 0 : previousInset.top) != null ? _a3 : 0) !== ((_c = (_b = state.contentInsetOverride) == null ? void 0 : _b.top) != null ? _c : 0) || ((_d = previousInset == null ? void 0 : previousInset.bottom) != null ? _d : 0) !== ((_f = (_e = state.contentInsetOverride) == null ? void 0 : _e.bottom) != null ? _f : 0) || ((_g = previousInset == null ? void 0 : previousInset.left) != null ? _g : 0) !== ((_i = (_h = state.contentInsetOverride) == null ? void 0 : _h.left) != null ? _i : 0) || ((_j = previousInset == null ? void 0 : previousInset.right) != null ? _j : 0) !== ((_l = (_k = state.contentInsetOverride) == null ? void 0 : _k.right) != null ? _l : 0);
6515
+ const didChange = setContentInsetOverride(ctx, inset);
6332
6516
  updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
6333
6517
  if (didChange) {
6334
6518
  retargetActiveInitialScrollAtEnd(ctx);
@@ -6684,10 +6868,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6684
6868
  ...restProps
6685
6869
  } = rest;
6686
6870
  const contentContainerStyleBase = StyleSheet.flatten(contentContainerStyleProp);
6687
- const shouldFlexGrow = alignItemsAtEnd && (horizontal ? (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minWidth) == null : (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minHeight) == null);
6871
+ const useAlignItemsAtEndPadding = alignItemsAtEnd && !horizontal && (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minHeight) == null && dataProp.length > 0;
6872
+ const shouldFlexGrow = alignItemsAtEnd && !useAlignItemsAtEndPadding && (horizontal ? (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minWidth) == null : (contentContainerStyleBase == null ? void 0 : contentContainerStyleBase.minHeight) == null);
6688
6873
  const contentContainerStyle = {
6689
6874
  ...contentContainerStyleBase,
6690
- ...alignItemsAtEnd ? {
6875
+ ...alignItemsAtEnd && !useAlignItemsAtEndPadding ? {
6691
6876
  display: "flex",
6692
6877
  flexDirection: horizontal ? "row" : "column",
6693
6878
  ...shouldFlexGrow ? { flexGrow: 1 } : {},
@@ -6851,6 +7036,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6851
7036
  const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
6852
7037
  state.props = {
6853
7038
  alignItemsAtEnd,
7039
+ alignItemsAtEndPaddingEnabled: useAlignItemsAtEndPadding,
6854
7040
  alwaysRender,
6855
7041
  alwaysRenderIndicesArr: alwaysRenderIndices.arr,
6856
7042
  alwaysRenderIndicesSet: alwaysRenderIndices.set,
@@ -6908,6 +7094,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6908
7094
  const prevPaddingTop = peek$(ctx, "stylePaddingTop");
6909
7095
  setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
6910
7096
  refState.current.props.stylePaddingBottom = stylePaddingBottomState;
7097
+ updateContentMetrics(ctx);
6911
7098
  let paddingDiff = stylePaddingTopState - prevPaddingTop;
6912
7099
  if (shouldAdjustPadding && maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") ;
6913
7100
  };
@@ -7026,7 +7213,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
7026
7213
  }, [snapToIndices]);
7027
7214
  React3.useLayoutEffect(
7028
7215
  () => initializeStateVars(true),
7029
- [dataVersion, memoizedLastItemKeys.join(","), numColumnsProp, stylePaddingBottomState, stylePaddingTopState]
7216
+ [
7217
+ dataVersion,
7218
+ memoizedLastItemKeys.join(","),
7219
+ numColumnsProp,
7220
+ stylePaddingBottomState,
7221
+ stylePaddingTopState,
7222
+ useAlignItemsAtEndPadding
7223
+ ]
7030
7224
  );
7031
7225
  React3.useLayoutEffect(() => {
7032
7226
  const {
@@ -7085,7 +7279,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
7085
7279
  viewabilityConfigCallbackPairs
7086
7280
  });
7087
7281
  state.viewabilityConfigCallbackPairs = viewability;
7088
- state.enableScrollForNextCalculateItemsInView = !viewability;
7282
+ state.enableScrollForNextCalculateItemsInView = true;
7089
7283
  if (viewability) {
7090
7284
  state.scrollForNextCalculateItemsInView = void 0;
7091
7285
  }