@legendapp/list 3.0.0-beta.20 → 3.0.0-beta.22

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/index.js CHANGED
@@ -35,7 +35,7 @@ var Text = View;
35
35
 
36
36
  // src/state/getContentInsetEnd.ts
37
37
  function getContentInsetEnd(state) {
38
- var _a3;
38
+ var _a3, _b;
39
39
  const { props } = state;
40
40
  const horizontal = props.horizontal;
41
41
  let contentInset = props.contentInset;
@@ -49,7 +49,16 @@ function getContentInsetEnd(state) {
49
49
  }
50
50
  }
51
51
  }
52
- return (horizontal ? contentInset == null ? void 0 : contentInset.right : contentInset == null ? void 0 : contentInset.bottom) || 0;
52
+ const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
53
+ const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
54
+ if (overrideInset) {
55
+ const mergedInset = { top: 0, left: 0, right: 0, bottom: 0, ...baseInset, ...overrideInset };
56
+ return (horizontal ? mergedInset.right : mergedInset.bottom) || 0;
57
+ }
58
+ if (baseInset) {
59
+ return (horizontal ? baseInset.right : baseInset.bottom) || 0;
60
+ }
61
+ return 0;
53
62
  }
54
63
 
55
64
  // src/state/getContentSize.ts
@@ -316,7 +325,7 @@ var PositionViewState = typedMemo(function PositionViewState2({
316
325
  };
317
326
  const composed = isArray(style) ? Object.assign({}, ...style) : style;
318
327
  const combinedStyle = horizontal ? { ...base, ...composed, left: position } : { ...base, ...composed, top: position };
319
- const { animatedScrollY, stickyOffset, onLayout, ...webProps } = props;
328
+ const { animatedScrollY, stickyOffset, onLayout, index, ...webProps } = props;
320
329
  return /* @__PURE__ */ React3__namespace.createElement("div", { ref: refView, ...webProps, style: combinedStyle });
321
330
  });
322
331
  var PositionViewSticky = typedMemo(function PositionViewSticky2({
@@ -1753,7 +1762,7 @@ function updateScroll(ctx, newScroll, forceUpdate) {
1753
1762
  const scrollDelta = Math.abs(newScroll - prevScroll);
1754
1763
  const scrollLength = state.scrollLength;
1755
1764
  const lastCalculated = state.scrollLastCalculate;
1756
- const shouldUpdate = state.dataChangeNeedsScrollUpdate || state.scrollLastCalculate === void 0 || lastCalculated === void 0 || Math.abs(state.scroll - lastCalculated) > 2;
1765
+ const shouldUpdate = forceUpdate || state.dataChangeNeedsScrollUpdate || state.scrollLastCalculate === void 0 || lastCalculated === void 0 || Math.abs(state.scroll - lastCalculated) > 2;
1757
1766
  if (shouldUpdate) {
1758
1767
  state.scrollLastCalculate = state.scroll;
1759
1768
  state.ignoreScrollFromMVCPIgnored = false;
@@ -2532,7 +2541,7 @@ function getActiveStickyIndices(ctx, stickyHeaderIndices) {
2532
2541
  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))
2533
2542
  );
2534
2543
  }
2535
- function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
2544
+ function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, needNewContainersSet, startBuffered, endBuffered) {
2536
2545
  var _a3;
2537
2546
  const state = ctx.state;
2538
2547
  const activeIndices = getActiveStickyIndices(ctx, stickyHeaderIndices);
@@ -2542,18 +2551,20 @@ function handleStickyActivation(ctx, stickyHeaderIndices, stickyArray, currentSt
2542
2551
  if (idx < 0 || activeIndices.has(stickyArray[idx])) continue;
2543
2552
  const stickyIndex = stickyArray[idx];
2544
2553
  const stickyId = (_a3 = state.idCache[stickyIndex]) != null ? _a3 : getId(state, stickyIndex);
2545
- if (stickyId && !state.containerItemKeys.has(stickyId) && (stickyIndex < startBuffered || stickyIndex > endBuffered)) {
2554
+ if (stickyId && !state.containerItemKeys.has(stickyId) && (stickyIndex < startBuffered || stickyIndex > endBuffered) && !needNewContainersSet.has(stickyIndex)) {
2555
+ needNewContainersSet.add(stickyIndex);
2546
2556
  needNewContainers.push(stickyIndex);
2547
2557
  }
2548
2558
  }
2549
2559
  }
2550
- function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentStickyIdx, pendingRemoval) {
2560
+ function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentStickyIdx, pendingRemoval, alwaysRenderIndicesSet) {
2551
2561
  var _a3, _b, _c;
2552
2562
  const state = ctx.state;
2553
2563
  for (const containerIndex of state.stickyContainerPool) {
2554
2564
  const itemKey = peek$(ctx, `containerItemKey${containerIndex}`);
2555
2565
  const itemIndex = itemKey ? state.indexByKey.get(itemKey) : void 0;
2556
2566
  if (itemIndex === void 0) continue;
2567
+ if (alwaysRenderIndicesSet.has(itemIndex)) continue;
2557
2568
  const arrayIdx = stickyArray.indexOf(itemIndex);
2558
2569
  if (arrayIdx === -1) {
2559
2570
  state.stickyContainerPool.delete(containerIndex);
@@ -2585,7 +2596,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, scrollBuffer, currentSt
2585
2596
  function calculateItemsInView(ctx, params = {}) {
2586
2597
  const state = ctx.state;
2587
2598
  reactDom.unstable_batchedUpdates(() => {
2588
- var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2599
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2589
2600
  const {
2590
2601
  columns,
2591
2602
  containerItemKeys,
@@ -2595,7 +2606,15 @@ function calculateItemsInView(ctx, params = {}) {
2595
2606
  initialScroll,
2596
2607
  minIndexSizeChanged,
2597
2608
  positions,
2598
- props: { getItemType, itemsAreEqual, keyExtractor, onStickyHeaderChange, scrollBuffer },
2609
+ props: {
2610
+ alwaysRenderIndicesArr,
2611
+ alwaysRenderIndicesSet,
2612
+ getItemType,
2613
+ itemsAreEqual,
2614
+ keyExtractor,
2615
+ onStickyHeaderChange,
2616
+ scrollBuffer
2617
+ },
2599
2618
  scrollForNextCalculateItemsInView,
2600
2619
  scrollLength,
2601
2620
  sizes,
@@ -2605,6 +2624,8 @@ function calculateItemsInView(ctx, params = {}) {
2605
2624
  const { data } = state.props;
2606
2625
  const stickyIndicesArr = state.props.stickyIndicesArr || [];
2607
2626
  const stickyIndicesSet = state.props.stickyIndicesSet || /* @__PURE__ */ new Set();
2627
+ const alwaysRenderArr = alwaysRenderIndicesArr || [];
2628
+ const alwaysRenderSet = alwaysRenderIndicesSet || /* @__PURE__ */ new Set();
2608
2629
  const prevNumContainers = peek$(ctx, "numContainers");
2609
2630
  if (!data || scrollLength === 0 || !prevNumContainers) {
2610
2631
  return;
@@ -2781,12 +2802,24 @@ function calculateItemsInView(ctx, params = {}) {
2781
2802
  }
2782
2803
  if (startBuffered !== null && endBuffered !== null) {
2783
2804
  const needNewContainers = [];
2805
+ const needNewContainersSet = /* @__PURE__ */ new Set();
2784
2806
  for (let i = startBuffered; i <= endBuffered; i++) {
2785
2807
  const id = (_h = idCache[i]) != null ? _h : getId(state, i);
2786
2808
  if (!containerItemKeys.has(id)) {
2809
+ needNewContainersSet.add(i);
2787
2810
  needNewContainers.push(i);
2788
2811
  }
2789
2812
  }
2813
+ if (alwaysRenderArr.length > 0) {
2814
+ for (const index of alwaysRenderArr) {
2815
+ if (index < 0 || index >= dataLength) continue;
2816
+ const id = (_i = idCache[index]) != null ? _i : getId(state, index);
2817
+ if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
2818
+ needNewContainersSet.add(index);
2819
+ needNewContainers.push(index);
2820
+ }
2821
+ }
2822
+ }
2790
2823
  if (stickyIndicesArr.length > 0) {
2791
2824
  handleStickyActivation(
2792
2825
  ctx,
@@ -2794,6 +2827,7 @@ function calculateItemsInView(ctx, params = {}) {
2794
2827
  stickyIndicesArr,
2795
2828
  currentStickyIdx,
2796
2829
  needNewContainers,
2830
+ needNewContainersSet,
2797
2831
  startBuffered,
2798
2832
  endBuffered
2799
2833
  );
@@ -2817,7 +2851,7 @@ function calculateItemsInView(ctx, params = {}) {
2817
2851
  for (let idx = 0; idx < needNewContainers.length; idx++) {
2818
2852
  const i = needNewContainers[idx];
2819
2853
  const containerIndex = availableContainers[idx];
2820
- const id = (_i = idCache[i]) != null ? _i : getId(state, i);
2854
+ const id = (_j = idCache[i]) != null ? _j : getId(state, i);
2821
2855
  const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
2822
2856
  if (oldKey && oldKey !== id) {
2823
2857
  containerItemKeys.delete(oldKey);
@@ -2829,14 +2863,23 @@ function calculateItemsInView(ctx, params = {}) {
2829
2863
  }
2830
2864
  containerItemKeys.set(id, containerIndex);
2831
2865
  const containerSticky = `containerSticky${containerIndex}`;
2832
- if (stickyIndicesSet.has(i)) {
2866
+ const isSticky = stickyIndicesSet.has(i);
2867
+ const isAlwaysRender = alwaysRenderSet.has(i);
2868
+ if (isSticky) {
2833
2869
  set$(ctx, containerSticky, true);
2834
2870
  const topPadding = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
2835
2871
  set$(ctx, `containerStickyOffset${containerIndex}`, topPadding);
2836
2872
  state.stickyContainerPool.add(containerIndex);
2837
- } else if (peek$(ctx, containerSticky)) {
2838
- set$(ctx, containerSticky, false);
2839
- state.stickyContainerPool.delete(containerIndex);
2873
+ } else {
2874
+ if (peek$(ctx, containerSticky)) {
2875
+ set$(ctx, containerSticky, false);
2876
+ set$(ctx, `containerStickyOffset${containerIndex}`, void 0);
2877
+ }
2878
+ if (isAlwaysRender) {
2879
+ state.stickyContainerPool.add(containerIndex);
2880
+ } else if (state.stickyContainerPool.has(containerIndex)) {
2881
+ state.stickyContainerPool.delete(containerIndex);
2882
+ }
2840
2883
  }
2841
2884
  if (containerIndex >= numContainers) {
2842
2885
  numContainers = containerIndex + 1;
@@ -2849,9 +2892,27 @@ function calculateItemsInView(ctx, params = {}) {
2849
2892
  }
2850
2893
  }
2851
2894
  }
2895
+ if (alwaysRenderArr.length > 0) {
2896
+ for (const index of alwaysRenderArr) {
2897
+ if (index < 0 || index >= dataLength) continue;
2898
+ const id = (_k = idCache[index]) != null ? _k : getId(state, index);
2899
+ const containerIndex = containerItemKeys.get(id);
2900
+ if (containerIndex !== void 0) {
2901
+ state.stickyContainerPool.add(containerIndex);
2902
+ }
2903
+ }
2904
+ }
2852
2905
  }
2853
- if (stickyIndicesArr.length > 0) {
2854
- handleStickyRecycling(ctx, stickyIndicesArr, scroll, scrollBuffer, currentStickyIdx, pendingRemoval);
2906
+ if (state.stickyContainerPool.size > 0) {
2907
+ handleStickyRecycling(
2908
+ ctx,
2909
+ stickyIndicesArr,
2910
+ scroll,
2911
+ scrollBuffer,
2912
+ currentStickyIdx,
2913
+ pendingRemoval,
2914
+ alwaysRenderSet
2915
+ );
2855
2916
  }
2856
2917
  let didChangePositions = false;
2857
2918
  for (let i = 0; i < numContainers; i++) {
@@ -2874,7 +2935,7 @@ function calculateItemsInView(ctx, params = {}) {
2874
2935
  const itemIndex = indexByKey.get(itemKey);
2875
2936
  const item = data[itemIndex];
2876
2937
  if (item !== void 0) {
2877
- const id = (_j = idCache[itemIndex]) != null ? _j : getId(state, itemIndex);
2938
+ const id = (_l = idCache[itemIndex]) != null ? _l : getId(state, itemIndex);
2878
2939
  const positionValue = positions.get(id);
2879
2940
  if (positionValue === void 0) {
2880
2941
  set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
@@ -3191,7 +3252,7 @@ function handleLayout(ctx, layout, setCanRender) {
3191
3252
 
3192
3253
  // src/core/onScroll.ts
3193
3254
  function onScroll(ctx, event) {
3194
- var _a3, _b, _c;
3255
+ var _a3, _b, _c, _d;
3195
3256
  const state = ctx.state;
3196
3257
  const {
3197
3258
  scrollProcessingEnabled,
@@ -3203,6 +3264,15 @@ function onScroll(ctx, event) {
3203
3264
  if (((_b = (_a3 = event.nativeEvent) == null ? void 0 : _a3.contentSize) == null ? void 0 : _b.height) === 0 && ((_c = event.nativeEvent.contentSize) == null ? void 0 : _c.width) === 0) {
3204
3265
  return;
3205
3266
  }
3267
+ let insetChanged = false;
3268
+ if ((_d = event.nativeEvent) == null ? void 0 : _d.contentInset) {
3269
+ const { contentInset } = event.nativeEvent;
3270
+ const prevInset = state.nativeContentInset;
3271
+ if (!prevInset || prevInset.top !== contentInset.top || prevInset.bottom !== contentInset.bottom || prevInset.left !== contentInset.left || prevInset.right !== contentInset.right) {
3272
+ state.nativeContentInset = contentInset;
3273
+ insetChanged = true;
3274
+ }
3275
+ }
3206
3276
  let newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
3207
3277
  if (state.scrollingTo) {
3208
3278
  const maxOffset = clampScrollOffset(ctx, newScroll);
@@ -3218,7 +3288,7 @@ function onScroll(ctx, event) {
3218
3288
  }
3219
3289
  }
3220
3290
  state.scrollPending = newScroll;
3221
- updateScroll(ctx, newScroll);
3291
+ updateScroll(ctx, newScroll, insetChanged);
3222
3292
  if (state.scrollingTo) {
3223
3293
  checkFinishedScroll(ctx);
3224
3294
  }
@@ -3391,7 +3461,10 @@ function updateOneItemSize(ctx, itemKey, sizeObj) {
3391
3461
  if (!averages) {
3392
3462
  averages = averageSizes[itemType] = { avg: 0, num: 0 };
3393
3463
  }
3394
- if (prevSizeKnown !== void 0 && prevSizeKnown > 0) {
3464
+ if (averages.num === 0) {
3465
+ averages.avg = size;
3466
+ averages.num++;
3467
+ } else if (prevSizeKnown !== void 0 && prevSizeKnown > 0) {
3395
3468
  averages.avg += (size - prevSizeKnown) / averages.num;
3396
3469
  } else {
3397
3470
  averages.avg = (averages.avg * averages.num + size) / (averages.num + 1);
@@ -3476,7 +3549,7 @@ function createImperativeHandle(ctx) {
3476
3549
  getScrollResponder: () => refScroller.current.getScrollResponder(),
3477
3550
  getState: () => ({
3478
3551
  activeStickyIndex: peek$(ctx, "activeStickyIndex"),
3479
- contentLength: state.totalSize,
3552
+ contentLength: getContentSize(ctx),
3480
3553
  data: state.props.data,
3481
3554
  elementAtIndex: (index) => {
3482
3555
  var _a3;
@@ -3492,6 +3565,7 @@ function createImperativeHandle(ctx) {
3492
3565
  positions: state.positions,
3493
3566
  scroll: state.scroll,
3494
3567
  scrollLength: state.scrollLength,
3568
+ scrollVelocity: getScrollVelocity(state),
3495
3569
  sizeAtIndex: (index) => state.sizesKnown.get(getId(state, index)),
3496
3570
  sizes: state.sizesKnown,
3497
3571
  start: state.startNoBuffer,
@@ -3529,6 +3603,10 @@ function createImperativeHandle(ctx) {
3529
3603
  }
3530
3604
  },
3531
3605
  scrollToOffset: (params) => scrollTo(ctx, params),
3606
+ reportContentInset: (inset) => {
3607
+ state.contentInsetOverride = inset != null ? inset : void 0;
3608
+ updateScroll(ctx, state.scroll, true);
3609
+ },
3532
3610
  setScrollProcessingEnabled: (enabled) => {
3533
3611
  state.scrollProcessingEnabled = enabled;
3534
3612
  },
@@ -3538,6 +3616,54 @@ function createImperativeHandle(ctx) {
3538
3616
  }
3539
3617
  };
3540
3618
  }
3619
+
3620
+ // src/utils/getAlwaysRenderIndices.ts
3621
+ var sortAsc = (a, b) => a - b;
3622
+ var toCount = (value) => typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : 0;
3623
+ var addIndex = (result, dataLength, index) => {
3624
+ if (index >= 0 && index < dataLength) {
3625
+ result.add(index);
3626
+ }
3627
+ };
3628
+ function getAlwaysRenderIndices(config, data, keyExtractor) {
3629
+ var _a3, _b;
3630
+ if (!config || data.length === 0) {
3631
+ return [];
3632
+ }
3633
+ const result = /* @__PURE__ */ new Set();
3634
+ const dataLength = data.length;
3635
+ const topCount = toCount(config.top);
3636
+ if (topCount > 0) {
3637
+ for (let i = 0; i < Math.min(topCount, dataLength); i++) {
3638
+ addIndex(result, dataLength, i);
3639
+ }
3640
+ }
3641
+ const bottomCount = toCount(config.bottom);
3642
+ if (bottomCount > 0) {
3643
+ for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
3644
+ addIndex(result, dataLength, i);
3645
+ }
3646
+ }
3647
+ if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
3648
+ for (const index of config.indices) {
3649
+ if (!Number.isFinite(index)) continue;
3650
+ addIndex(result, dataLength, Math.floor(index));
3651
+ }
3652
+ }
3653
+ if ((_b = config.keys) == null ? void 0 : _b.length) {
3654
+ const keys = new Set(config.keys);
3655
+ for (let i = 0; i < dataLength && keys.size > 0; i++) {
3656
+ const key = keyExtractor(data[i], i);
3657
+ if (keys.has(key)) {
3658
+ addIndex(result, dataLength, i);
3659
+ keys.delete(key);
3660
+ }
3661
+ }
3662
+ }
3663
+ const indices = Array.from(result);
3664
+ indices.sort(sortAsc);
3665
+ return indices;
3666
+ }
3541
3667
  function getRenderedItem(ctx, key) {
3542
3668
  var _a3;
3543
3669
  const state = ctx.state;
@@ -3654,9 +3780,10 @@ var LegendList = typedMemo(
3654
3780
  })
3655
3781
  );
3656
3782
  var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
3657
- var _a3, _b;
3783
+ var _a3, _b, _c, _d;
3658
3784
  const {
3659
3785
  alignItemsAtEnd = false,
3786
+ alwaysRender,
3660
3787
  columnWrapperStyle,
3661
3788
  contentContainerStyle: contentContainerStyleProp,
3662
3789
  contentInset,
@@ -3685,6 +3812,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3685
3812
  onEndReached,
3686
3813
  onEndReachedThreshold = 0.5,
3687
3814
  onItemSizeChanged,
3815
+ onMetricsChange,
3688
3816
  onLayout: onLayoutProp,
3689
3817
  onLoad,
3690
3818
  onMomentumScrollEnd,
@@ -3733,6 +3861,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3733
3861
  const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
3734
3862
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : (_item, index) => index.toString();
3735
3863
  const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
3864
+ const alwaysRenderIndices = React3.useMemo(() => {
3865
+ const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
3866
+ return { arr: indices, set: new Set(indices) };
3867
+ }, [
3868
+ alwaysRender == null ? void 0 : alwaysRender.top,
3869
+ alwaysRender == null ? void 0 : alwaysRender.bottom,
3870
+ (_a3 = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _a3.join(","),
3871
+ (_b = alwaysRender == null ? void 0 : alwaysRender.keys) == null ? void 0 : _b.join(","),
3872
+ dataProp,
3873
+ dataVersion,
3874
+ keyExtractor
3875
+ ]);
3736
3876
  if (IS_DEV && stickyIndicesDeprecated && !stickyHeaderIndicesProp) {
3737
3877
  warnDevOnce(
3738
3878
  "stickyIndices",
@@ -3764,7 +3904,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3764
3904
  attempts: 0,
3765
3905
  index: initialScrollProp.index,
3766
3906
  settledTicks: 0,
3767
- viewOffset: (_a3 = initialScrollProp.viewOffset) != null ? _a3 : 0,
3907
+ viewOffset: (_c = initialScrollProp.viewOffset) != null ? _c : 0,
3768
3908
  viewPosition: initialScrollProp.viewPosition
3769
3909
  } : void 0,
3770
3910
  initialScroll: initialScrollProp,
@@ -3778,6 +3918,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3778
3918
  lastScrollDelta: 0,
3779
3919
  loadStartTime: Date.now(),
3780
3920
  minIndexSizeChanged: 0,
3921
+ contentInsetOverride: void 0,
3922
+ nativeContentInset: void 0,
3781
3923
  nativeMarginTop: 0,
3782
3924
  positions: /* @__PURE__ */ new Map(),
3783
3925
  props: {},
@@ -3824,6 +3966,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3824
3966
  const throttleScrollFn = scrollEventThrottle && onScrollProp ? useThrottledOnScroll(onScrollProp, scrollEventThrottle) : onScrollProp;
3825
3967
  state.props = {
3826
3968
  alignItemsAtEnd,
3969
+ alwaysRender,
3970
+ alwaysRenderIndicesArr: alwaysRenderIndices.arr,
3971
+ alwaysRenderIndicesSet: alwaysRenderIndices.set,
3827
3972
  animatedProps: animatedPropsInternal,
3828
3973
  contentInset,
3829
3974
  data: dataProp,
@@ -3989,6 +4134,34 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3989
4134
  stylePaddingBottomState,
3990
4135
  stylePaddingTopState
3991
4136
  ]);
4137
+ React3.useEffect(() => {
4138
+ if (!onMetricsChange) {
4139
+ return;
4140
+ }
4141
+ let lastMetrics;
4142
+ const emitMetrics = () => {
4143
+ const metrics = {
4144
+ alignItemsAtEndPadding: peek$(ctx, "alignItemsPaddingTop") || 0,
4145
+ footerSize: peek$(ctx, "footerSize") || 0,
4146
+ headerSize: peek$(ctx, "headerSize") || 0
4147
+ };
4148
+ if (!lastMetrics || metrics.alignItemsAtEndPadding !== lastMetrics.alignItemsAtEndPadding || metrics.headerSize !== lastMetrics.headerSize || metrics.footerSize !== lastMetrics.footerSize) {
4149
+ lastMetrics = metrics;
4150
+ onMetricsChange(metrics);
4151
+ }
4152
+ };
4153
+ emitMetrics();
4154
+ const unsubscribe = [
4155
+ listen$(ctx, "alignItemsPaddingTop", emitMetrics),
4156
+ listen$(ctx, "headerSize", emitMetrics),
4157
+ listen$(ctx, "footerSize", emitMetrics)
4158
+ ];
4159
+ return () => {
4160
+ for (const unsub of unsubscribe) {
4161
+ unsub();
4162
+ }
4163
+ };
4164
+ }, [ctx, onMetricsChange]);
3992
4165
  React3.useEffect(() => {
3993
4166
  const viewability = setupViewability({
3994
4167
  onViewableItemsChanged,
@@ -4046,7 +4219,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
4046
4219
  }
4047
4220
  ),
4048
4221
  refScrollView: combinedRef,
4049
- scrollAdjustHandler: (_b = refState.current) == null ? void 0 : _b.scrollAdjustHandler,
4222
+ scrollAdjustHandler: (_d = refState.current) == null ? void 0 : _d.scrollAdjustHandler,
4050
4223
  scrollEventThrottle: 0,
4051
4224
  snapToIndices,
4052
4225
  stickyHeaderConfig,