@legendapp/list 3.0.0-beta.50 → 3.0.0-beta.52

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
@@ -5100,12 +5100,14 @@ function handleLayout(ctx, layoutParam, setCanRender) {
5100
5100
  }
5101
5101
 
5102
5102
  // src/core/updateScroll.ts
5103
- function updateScroll(ctx, newScroll, forceUpdate) {
5103
+ function updateScroll(ctx, newScroll, forceUpdate, options) {
5104
5104
  var _a3;
5105
5105
  const state = ctx.state;
5106
5106
  const { ignoreScrollFromMVCP, lastScrollAdjustForHistory, scrollAdjustHandler, scrollHistory, scrollingTo } = state;
5107
5107
  const prevScroll = state.scroll;
5108
- state.hasScrolled = true;
5108
+ if ((options == null ? void 0 : options.markHasScrolled) !== false) {
5109
+ state.hasScrolled = true;
5110
+ }
5109
5111
  state.lastBatchingAction = Date.now();
5110
5112
  const currentTime = Date.now();
5111
5113
  const adjust = scrollAdjustHandler.getAdjust();
@@ -5324,13 +5326,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {
5324
5326
  nextSize = Math.max(0, state.scrollLength - contentBelowAnchor - anchorOffset);
5325
5327
  }
5326
5328
  }
5327
- if (previousSize === nextSize) {
5328
- return nextSize;
5329
- }
5330
- set$(ctx, "anchoredEndSpaceSize", nextSize);
5331
- (_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
5332
- if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
5333
- updateScroll(ctx, state.scroll, true);
5329
+ if (previousSize !== nextSize) {
5330
+ set$(ctx, "anchoredEndSpaceSize", nextSize);
5331
+ (_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
5332
+ if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
5333
+ updateScroll(ctx, state.scroll, true);
5334
+ }
5334
5335
  }
5335
5336
  return nextSize;
5336
5337
  }
@@ -5559,14 +5560,14 @@ function createImperativeHandle(ctx) {
5559
5560
  const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
5560
5561
  let imperativeScrollToken = 0;
5561
5562
  const isSettlingAfterDataChange = () => !!state.didDataChange || !!state.didColumnsChange || state.queuedMVCPRecalculate !== void 0 || state.ignoreScrollFromMVCP !== void 0;
5562
- const runWhenSettled = (token, run) => {
5563
+ const runWhenReady = (token, run, isReady) => {
5563
5564
  const startedAt = Date.now();
5564
5565
  let stableFrames = 0;
5565
5566
  const check = () => {
5566
5567
  if (token !== imperativeScrollToken) {
5567
5568
  return;
5568
5569
  }
5569
- if (isSettlingAfterDataChange()) {
5570
+ if (isSettlingAfterDataChange() || !isReady()) {
5570
5571
  stableFrames = 0;
5571
5572
  } else {
5572
5573
  stableFrames += 1;
@@ -5581,10 +5582,10 @@ function createImperativeHandle(ctx) {
5581
5582
  requestAnimationFrame(check);
5582
5583
  };
5583
5584
  const runScrollWithPromise = (run, options) => new Promise((resolve) => {
5584
- var _a3;
5585
+ var _a3, _b;
5585
5586
  const token = ++imperativeScrollToken;
5586
- const shouldWaitOneFrame = !!(options == null ? void 0 : options.shouldWaitOneFrame);
5587
- (_a3 = state.pendingScrollResolve) == null ? void 0 : _a3.call(state);
5587
+ const isReady = (_a3 = options == null ? void 0 : options.isReady) != null ? _a3 : (() => true);
5588
+ (_b = state.pendingScrollResolve) == null ? void 0 : _b.call(state);
5588
5589
  state.pendingScrollResolve = resolve;
5589
5590
  const runNow = () => {
5590
5591
  if (token !== imperativeScrollToken) {
@@ -5598,11 +5599,10 @@ function createImperativeHandle(ctx) {
5598
5599
  resolve();
5599
5600
  }
5600
5601
  };
5601
- const execute = shouldWaitOneFrame ? () => requestAnimationFrame(runNow) : runNow;
5602
- if (isSettlingAfterDataChange()) {
5603
- runWhenSettled(token, execute);
5602
+ if (isSettlingAfterDataChange() || !isReady()) {
5603
+ runWhenReady(token, runNow, isReady);
5604
5604
  } else {
5605
- execute();
5605
+ runNow();
5606
5606
  }
5607
5607
  });
5608
5608
  const scrollIndexIntoView = (options) => {
@@ -5684,7 +5684,7 @@ function createImperativeHandle(ctx) {
5684
5684
  }),
5685
5685
  reportContentInset: (inset) => {
5686
5686
  state.contentInsetOverride = inset != null ? inset : void 0;
5687
- updateScroll(ctx, state.scroll, true);
5687
+ updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
5688
5688
  },
5689
5689
  scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
5690
5690
  scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
@@ -5713,15 +5713,24 @@ function createImperativeHandle(ctx) {
5713
5713
  }
5714
5714
  return false;
5715
5715
  }),
5716
- scrollToIndex: (params) => runScrollWithPromise(
5717
- () => {
5716
+ scrollToIndex: (params) => {
5717
+ const shouldWaitForOutOfRangeTarget = params.index >= 0 && params.index >= state.props.data.length;
5718
+ const options = shouldWaitForOutOfRangeTarget ? {
5719
+ isReady: () => {
5720
+ var _a3;
5721
+ const props = state.props;
5722
+ const anchorIndex = (_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.anchorIndex;
5723
+ const lastIndex = props.data.length - 1;
5724
+ const isInRange = params.index < props.data.length;
5725
+ const shouldWaitForAnchorSize = isInRange && anchorIndex !== void 0 && anchorIndex >= 0 && params.index >= anchorIndex && !props.getFixedItemSize && !state.sizesKnown.has(getId(state, lastIndex));
5726
+ return isInRange && !shouldWaitForAnchorSize;
5727
+ }
5728
+ } : void 0;
5729
+ return runScrollWithPromise(() => {
5718
5730
  scrollToIndex(ctx, params);
5719
5731
  return true;
5720
- },
5721
- {
5722
- shouldWaitOneFrame: params.index >= 0 && params.index >= state.props.data.length
5723
- }
5724
- ),
5732
+ }, options);
5733
+ },
5725
5734
  scrollToItem: ({ item, ...props }) => runScrollWithPromise(() => {
5726
5735
  const data = state.props.data;
5727
5736
  const index = data.indexOf(item);
@@ -5753,32 +5762,32 @@ var addIndex = (result, dataLength, index) => {
5753
5762
  result.add(index);
5754
5763
  }
5755
5764
  };
5756
- function getAlwaysRenderIndices(config, data, keyExtractor) {
5765
+ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnchorIndex) {
5757
5766
  var _a3, _b;
5758
- if (!config || data.length === 0) {
5767
+ if (data.length === 0) {
5759
5768
  return [];
5760
5769
  }
5761
5770
  const result = /* @__PURE__ */ new Set();
5762
5771
  const dataLength = data.length;
5763
- const topCount = toCount(config.top);
5772
+ const topCount = toCount(config == null ? void 0 : config.top);
5764
5773
  if (topCount > 0) {
5765
5774
  for (let i = 0; i < Math.min(topCount, dataLength); i++) {
5766
5775
  addIndex(result, dataLength, i);
5767
5776
  }
5768
5777
  }
5769
- const bottomCount = toCount(config.bottom);
5778
+ const bottomCount = toCount(config == null ? void 0 : config.bottom);
5770
5779
  if (bottomCount > 0) {
5771
5780
  for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
5772
5781
  addIndex(result, dataLength, i);
5773
5782
  }
5774
5783
  }
5775
- if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
5784
+ if ((_a3 = config == null ? void 0 : config.indices) == null ? void 0 : _a3.length) {
5776
5785
  for (const index of config.indices) {
5777
5786
  if (!Number.isFinite(index)) continue;
5778
5787
  addIndex(result, dataLength, Math.floor(index));
5779
5788
  }
5780
5789
  }
5781
- if ((_b = config.keys) == null ? void 0 : _b.length) {
5790
+ if ((_b = config == null ? void 0 : config.keys) == null ? void 0 : _b.length) {
5782
5791
  const keys = new Set(config.keys);
5783
5792
  for (let i = 0; i < dataLength && keys.size > 0; i++) {
5784
5793
  const key = keyExtractor(data[i], i);
@@ -5788,6 +5797,12 @@ function getAlwaysRenderIndices(config, data, keyExtractor) {
5788
5797
  }
5789
5798
  }
5790
5799
  }
5800
+ if (anchoredEndSpaceAnchorIndex !== void 0 && Number.isFinite(anchoredEndSpaceAnchorIndex)) {
5801
+ const anchorIndex = Math.floor(anchoredEndSpaceAnchorIndex);
5802
+ for (let i = anchorIndex >= 0 ? anchorIndex : dataLength; i < dataLength; i++) {
5803
+ addIndex(result, dataLength, i);
5804
+ }
5805
+ }
5791
5806
  const indices = Array.from(result);
5792
5807
  indices.sort(sortAsc);
5793
5808
  return indices;
@@ -5951,7 +5966,7 @@ var LegendList = typedMemo(
5951
5966
  })
5952
5967
  );
5953
5968
  var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
5954
- var _a3, _b, _c, _d, _e, _f, _g, _h;
5969
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
5955
5970
  const noopOnScroll = React3.useCallback((_event) => {
5956
5971
  }, []);
5957
5972
  if (props.recycleItems === void 0) {
@@ -6080,9 +6095,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6080
6095
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
6081
6096
  const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
6082
6097
  const alwaysRenderIndices = React3.useMemo(() => {
6083
- const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
6098
+ const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
6084
6099
  return { arr: indices, set: new Set(indices) };
6085
6100
  }, [
6101
+ anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
6086
6102
  alwaysRender == null ? void 0 : alwaysRender.top,
6087
6103
  alwaysRender == null ? void 0 : alwaysRender.bottom,
6088
6104
  (_d = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _d.join(","),
@@ -6188,6 +6204,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6188
6204
  const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
6189
6205
  const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
6190
6206
  const anchoredEndSpaceResolved = anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
6207
+ const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
6191
6208
  state.props = {
6192
6209
  alignItemsAtEnd,
6193
6210
  alwaysRender,
@@ -6297,6 +6314,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6297
6314
  });
6298
6315
  }, [dataProp.length, didDataChangeLocal, initialScrollAtEnd, stylePaddingBottomState, usesBootstrapInitialScroll]);
6299
6316
  React3.useLayoutEffect(() => {
6317
+ var _a4;
6318
+ if (didAnchoredEndSpaceAnchorIndexChange) {
6319
+ state.scrollForNextCalculateItemsInView = void 0;
6320
+ (_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state);
6321
+ }
6300
6322
  maybeUpdateAnchoredEndSpace(ctx);
6301
6323
  }, [
6302
6324
  ctx,
@@ -6305,6 +6327,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6305
6327
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
6306
6328
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorMaxSize,
6307
6329
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorOffset,
6330
+ didAnchoredEndSpaceAnchorIndexChange,
6308
6331
  numColumnsProp
6309
6332
  ]);
6310
6333
  const onLayoutFooter = React3.useCallback(
@@ -6458,7 +6481,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6458
6481
  onScroll: onScrollHandler,
6459
6482
  recycleItems,
6460
6483
  refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React3__namespace.cloneElement(refreshControlElement, {
6461
- progressViewOffset: ((_g = refreshControlElement.props.progressViewOffset) != null ? _g : 0) + stylePaddingTopState
6484
+ progressViewOffset: ((_h = refreshControlElement.props.progressViewOffset) != null ? _h : 0) + stylePaddingTopState
6462
6485
  }) : refreshControlElement : onRefresh && /* @__PURE__ */ React3__namespace.createElement(
6463
6486
  RefreshControl,
6464
6487
  {
@@ -6469,7 +6492,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6469
6492
  ),
6470
6493
  refScrollView: combinedRef,
6471
6494
  renderScrollComponent,
6472
- scrollAdjustHandler: (_h = refState.current) == null ? void 0 : _h.scrollAdjustHandler,
6495
+ scrollAdjustHandler: (_i = refState.current) == null ? void 0 : _i.scrollAdjustHandler,
6473
6496
  scrollEventThrottle: 0,
6474
6497
  snapToIndices,
6475
6498
  stickyHeaderIndices,
package/index.mjs CHANGED
@@ -5079,12 +5079,14 @@ function handleLayout(ctx, layoutParam, setCanRender) {
5079
5079
  }
5080
5080
 
5081
5081
  // src/core/updateScroll.ts
5082
- function updateScroll(ctx, newScroll, forceUpdate) {
5082
+ function updateScroll(ctx, newScroll, forceUpdate, options) {
5083
5083
  var _a3;
5084
5084
  const state = ctx.state;
5085
5085
  const { ignoreScrollFromMVCP, lastScrollAdjustForHistory, scrollAdjustHandler, scrollHistory, scrollingTo } = state;
5086
5086
  const prevScroll = state.scroll;
5087
- state.hasScrolled = true;
5087
+ if ((options == null ? void 0 : options.markHasScrolled) !== false) {
5088
+ state.hasScrolled = true;
5089
+ }
5088
5090
  state.lastBatchingAction = Date.now();
5089
5091
  const currentTime = Date.now();
5090
5092
  const adjust = scrollAdjustHandler.getAdjust();
@@ -5303,13 +5305,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {
5303
5305
  nextSize = Math.max(0, state.scrollLength - contentBelowAnchor - anchorOffset);
5304
5306
  }
5305
5307
  }
5306
- if (previousSize === nextSize) {
5307
- return nextSize;
5308
- }
5309
- set$(ctx, "anchoredEndSpaceSize", nextSize);
5310
- (_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
5311
- if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
5312
- updateScroll(ctx, state.scroll, true);
5308
+ if (previousSize !== nextSize) {
5309
+ set$(ctx, "anchoredEndSpaceSize", nextSize);
5310
+ (_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
5311
+ if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
5312
+ updateScroll(ctx, state.scroll, true);
5313
+ }
5313
5314
  }
5314
5315
  return nextSize;
5315
5316
  }
@@ -5538,14 +5539,14 @@ function createImperativeHandle(ctx) {
5538
5539
  const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
5539
5540
  let imperativeScrollToken = 0;
5540
5541
  const isSettlingAfterDataChange = () => !!state.didDataChange || !!state.didColumnsChange || state.queuedMVCPRecalculate !== void 0 || state.ignoreScrollFromMVCP !== void 0;
5541
- const runWhenSettled = (token, run) => {
5542
+ const runWhenReady = (token, run, isReady) => {
5542
5543
  const startedAt = Date.now();
5543
5544
  let stableFrames = 0;
5544
5545
  const check = () => {
5545
5546
  if (token !== imperativeScrollToken) {
5546
5547
  return;
5547
5548
  }
5548
- if (isSettlingAfterDataChange()) {
5549
+ if (isSettlingAfterDataChange() || !isReady()) {
5549
5550
  stableFrames = 0;
5550
5551
  } else {
5551
5552
  stableFrames += 1;
@@ -5560,10 +5561,10 @@ function createImperativeHandle(ctx) {
5560
5561
  requestAnimationFrame(check);
5561
5562
  };
5562
5563
  const runScrollWithPromise = (run, options) => new Promise((resolve) => {
5563
- var _a3;
5564
+ var _a3, _b;
5564
5565
  const token = ++imperativeScrollToken;
5565
- const shouldWaitOneFrame = !!(options == null ? void 0 : options.shouldWaitOneFrame);
5566
- (_a3 = state.pendingScrollResolve) == null ? void 0 : _a3.call(state);
5566
+ const isReady = (_a3 = options == null ? void 0 : options.isReady) != null ? _a3 : (() => true);
5567
+ (_b = state.pendingScrollResolve) == null ? void 0 : _b.call(state);
5567
5568
  state.pendingScrollResolve = resolve;
5568
5569
  const runNow = () => {
5569
5570
  if (token !== imperativeScrollToken) {
@@ -5577,11 +5578,10 @@ function createImperativeHandle(ctx) {
5577
5578
  resolve();
5578
5579
  }
5579
5580
  };
5580
- const execute = shouldWaitOneFrame ? () => requestAnimationFrame(runNow) : runNow;
5581
- if (isSettlingAfterDataChange()) {
5582
- runWhenSettled(token, execute);
5581
+ if (isSettlingAfterDataChange() || !isReady()) {
5582
+ runWhenReady(token, runNow, isReady);
5583
5583
  } else {
5584
- execute();
5584
+ runNow();
5585
5585
  }
5586
5586
  });
5587
5587
  const scrollIndexIntoView = (options) => {
@@ -5663,7 +5663,7 @@ function createImperativeHandle(ctx) {
5663
5663
  }),
5664
5664
  reportContentInset: (inset) => {
5665
5665
  state.contentInsetOverride = inset != null ? inset : void 0;
5666
- updateScroll(ctx, state.scroll, true);
5666
+ updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
5667
5667
  },
5668
5668
  scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
5669
5669
  scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
@@ -5692,15 +5692,24 @@ function createImperativeHandle(ctx) {
5692
5692
  }
5693
5693
  return false;
5694
5694
  }),
5695
- scrollToIndex: (params) => runScrollWithPromise(
5696
- () => {
5695
+ scrollToIndex: (params) => {
5696
+ const shouldWaitForOutOfRangeTarget = params.index >= 0 && params.index >= state.props.data.length;
5697
+ const options = shouldWaitForOutOfRangeTarget ? {
5698
+ isReady: () => {
5699
+ var _a3;
5700
+ const props = state.props;
5701
+ const anchorIndex = (_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.anchorIndex;
5702
+ const lastIndex = props.data.length - 1;
5703
+ const isInRange = params.index < props.data.length;
5704
+ const shouldWaitForAnchorSize = isInRange && anchorIndex !== void 0 && anchorIndex >= 0 && params.index >= anchorIndex && !props.getFixedItemSize && !state.sizesKnown.has(getId(state, lastIndex));
5705
+ return isInRange && !shouldWaitForAnchorSize;
5706
+ }
5707
+ } : void 0;
5708
+ return runScrollWithPromise(() => {
5697
5709
  scrollToIndex(ctx, params);
5698
5710
  return true;
5699
- },
5700
- {
5701
- shouldWaitOneFrame: params.index >= 0 && params.index >= state.props.data.length
5702
- }
5703
- ),
5711
+ }, options);
5712
+ },
5704
5713
  scrollToItem: ({ item, ...props }) => runScrollWithPromise(() => {
5705
5714
  const data = state.props.data;
5706
5715
  const index = data.indexOf(item);
@@ -5732,32 +5741,32 @@ var addIndex = (result, dataLength, index) => {
5732
5741
  result.add(index);
5733
5742
  }
5734
5743
  };
5735
- function getAlwaysRenderIndices(config, data, keyExtractor) {
5744
+ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnchorIndex) {
5736
5745
  var _a3, _b;
5737
- if (!config || data.length === 0) {
5746
+ if (data.length === 0) {
5738
5747
  return [];
5739
5748
  }
5740
5749
  const result = /* @__PURE__ */ new Set();
5741
5750
  const dataLength = data.length;
5742
- const topCount = toCount(config.top);
5751
+ const topCount = toCount(config == null ? void 0 : config.top);
5743
5752
  if (topCount > 0) {
5744
5753
  for (let i = 0; i < Math.min(topCount, dataLength); i++) {
5745
5754
  addIndex(result, dataLength, i);
5746
5755
  }
5747
5756
  }
5748
- const bottomCount = toCount(config.bottom);
5757
+ const bottomCount = toCount(config == null ? void 0 : config.bottom);
5749
5758
  if (bottomCount > 0) {
5750
5759
  for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
5751
5760
  addIndex(result, dataLength, i);
5752
5761
  }
5753
5762
  }
5754
- if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
5763
+ if ((_a3 = config == null ? void 0 : config.indices) == null ? void 0 : _a3.length) {
5755
5764
  for (const index of config.indices) {
5756
5765
  if (!Number.isFinite(index)) continue;
5757
5766
  addIndex(result, dataLength, Math.floor(index));
5758
5767
  }
5759
5768
  }
5760
- if ((_b = config.keys) == null ? void 0 : _b.length) {
5769
+ if ((_b = config == null ? void 0 : config.keys) == null ? void 0 : _b.length) {
5761
5770
  const keys = new Set(config.keys);
5762
5771
  for (let i = 0; i < dataLength && keys.size > 0; i++) {
5763
5772
  const key = keyExtractor(data[i], i);
@@ -5767,6 +5776,12 @@ function getAlwaysRenderIndices(config, data, keyExtractor) {
5767
5776
  }
5768
5777
  }
5769
5778
  }
5779
+ if (anchoredEndSpaceAnchorIndex !== void 0 && Number.isFinite(anchoredEndSpaceAnchorIndex)) {
5780
+ const anchorIndex = Math.floor(anchoredEndSpaceAnchorIndex);
5781
+ for (let i = anchorIndex >= 0 ? anchorIndex : dataLength; i < dataLength; i++) {
5782
+ addIndex(result, dataLength, i);
5783
+ }
5784
+ }
5770
5785
  const indices = Array.from(result);
5771
5786
  indices.sort(sortAsc);
5772
5787
  return indices;
@@ -5930,7 +5945,7 @@ var LegendList = typedMemo(
5930
5945
  })
5931
5946
  );
5932
5947
  var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
5933
- var _a3, _b, _c, _d, _e, _f, _g, _h;
5948
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
5934
5949
  const noopOnScroll = useCallback((_event) => {
5935
5950
  }, []);
5936
5951
  if (props.recycleItems === void 0) {
@@ -6059,9 +6074,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6059
6074
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
6060
6075
  const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
6061
6076
  const alwaysRenderIndices = useMemo(() => {
6062
- const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
6077
+ const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
6063
6078
  return { arr: indices, set: new Set(indices) };
6064
6079
  }, [
6080
+ anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
6065
6081
  alwaysRender == null ? void 0 : alwaysRender.top,
6066
6082
  alwaysRender == null ? void 0 : alwaysRender.bottom,
6067
6083
  (_d = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _d.join(","),
@@ -6167,6 +6183,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6167
6183
  const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
6168
6184
  const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
6169
6185
  const anchoredEndSpaceResolved = anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
6186
+ const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
6170
6187
  state.props = {
6171
6188
  alignItemsAtEnd,
6172
6189
  alwaysRender,
@@ -6276,6 +6293,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6276
6293
  });
6277
6294
  }, [dataProp.length, didDataChangeLocal, initialScrollAtEnd, stylePaddingBottomState, usesBootstrapInitialScroll]);
6278
6295
  useLayoutEffect(() => {
6296
+ var _a4;
6297
+ if (didAnchoredEndSpaceAnchorIndexChange) {
6298
+ state.scrollForNextCalculateItemsInView = void 0;
6299
+ (_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state);
6300
+ }
6279
6301
  maybeUpdateAnchoredEndSpace(ctx);
6280
6302
  }, [
6281
6303
  ctx,
@@ -6284,6 +6306,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6284
6306
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
6285
6307
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorMaxSize,
6286
6308
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorOffset,
6309
+ didAnchoredEndSpaceAnchorIndexChange,
6287
6310
  numColumnsProp
6288
6311
  ]);
6289
6312
  const onLayoutFooter = useCallback(
@@ -6437,7 +6460,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6437
6460
  onScroll: onScrollHandler,
6438
6461
  recycleItems,
6439
6462
  refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React3.cloneElement(refreshControlElement, {
6440
- progressViewOffset: ((_g = refreshControlElement.props.progressViewOffset) != null ? _g : 0) + stylePaddingTopState
6463
+ progressViewOffset: ((_h = refreshControlElement.props.progressViewOffset) != null ? _h : 0) + stylePaddingTopState
6441
6464
  }) : refreshControlElement : onRefresh && /* @__PURE__ */ React3.createElement(
6442
6465
  RefreshControl,
6443
6466
  {
@@ -6448,7 +6471,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6448
6471
  ),
6449
6472
  refScrollView: combinedRef,
6450
6473
  renderScrollComponent,
6451
- scrollAdjustHandler: (_h = refState.current) == null ? void 0 : _h.scrollAdjustHandler,
6474
+ scrollAdjustHandler: (_i = refState.current) == null ? void 0 : _i.scrollAdjustHandler,
6452
6475
  scrollEventThrottle: 0,
6453
6476
  snapToIndices,
6454
6477
  stickyHeaderIndices,