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

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/keyboard-chat.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
- import { useEffect, useMemo, useCallback } from 'react';
2
+ import { useRef, useEffect, useMemo, useCallback } from 'react';
3
3
  import { KeyboardChatScrollView } from 'react-native-keyboard-controller';
4
4
  import { useSharedValue } from 'react-native-reanimated';
5
5
  import { internal } from '@legendapp/list/react-native';
6
6
  import { AnimatedLegendList } from '@legendapp/list/reanimated';
7
7
 
8
8
  // src/integrations/keyboard-chat.tsx
9
- var { typedForwardRef } = internal;
9
+ var { typedForwardRef, useCombinedRef } = internal;
10
10
  var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(props, forwardedRef) {
11
11
  const {
12
12
  anchoredEndSpace,
@@ -17,6 +17,8 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
17
17
  offset,
18
18
  ...rest
19
19
  } = props;
20
+ const refLegendList = useRef(null);
21
+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);
20
22
  const blankSpace = useSharedValue(0);
21
23
  useEffect(() => {
22
24
  if (!anchoredEndSpace) {
@@ -37,6 +39,10 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
37
39
  }
38
40
  };
39
41
  }, [anchoredEndSpace, blankSpace]);
42
+ const onContentInsetChange = useCallback((insets) => {
43
+ var _a;
44
+ (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
45
+ }, []);
40
46
  const memoList = useCallback(
41
47
  (scrollProps) => {
42
48
  return /* @__PURE__ */ React.createElement(
@@ -48,7 +54,8 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
48
54
  extraContentPadding,
49
55
  freeze,
50
56
  keyboardLiftBehavior,
51
- offset
57
+ offset,
58
+ onContentInsetChange
52
59
  }
53
60
  );
54
61
  },
@@ -58,6 +65,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
58
65
  extraContentPadding,
59
66
  freeze,
60
67
  keyboardLiftBehavior,
68
+ onContentInsetChange,
61
69
  offset
62
70
  ]
63
71
  );
@@ -66,7 +74,7 @@ var KeyboardChatLegendList = typedForwardRef(function KeyboardChatLegendList2(pr
66
74
  AnimatedLegendListInternal,
67
75
  {
68
76
  anchoredEndSpace: anchoredEndSpaceWithBlankSpace,
69
- ref: forwardedRef,
77
+ ref: combinedRef,
70
78
  renderScrollComponent: memoList,
71
79
  ...rest
72
80
  }
@@ -210,7 +210,7 @@ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResp
210
210
  reportContentInset(inset?: Partial<Insets$1> | null): void;
211
211
  };
212
212
 
213
- type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent">;
213
+ type KeyboardChatScrollViewPropsUnique = Omit<KeyboardChatScrollViewProps, keyof ScrollViewProps | "inverted" | "ScrollViewComponent" | "onContentInsetChange">;
214
214
  declare const KeyboardAvoidingLegendList: <ItemT>(props: Omit<AnimatedLegendListProps<ItemT>, "renderScrollComponent"> & KeyboardChatScrollViewPropsUnique & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
215
215
 
216
216
  export { KeyboardAvoidingLegendList };
package/keyboard-test.js CHANGED
@@ -26,14 +26,27 @@ function _interopNamespace(e) {
26
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
27
 
28
28
  // src/integrations/keyboard-test.tsx
29
- var { typedForwardRef } = reactNative.internal;
29
+ var { typedForwardRef, useCombinedRef } = reactNative.internal;
30
30
  var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
31
31
  const { extraContentPadding, ...rest } = props;
32
+ const refLegendList = React.useRef(null);
33
+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);
34
+ const onContentInsetChange = React.useCallback((insets) => {
35
+ var _a;
36
+ (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
37
+ }, []);
32
38
  const memoList = React.useCallback(
33
- (listProps) => /* @__PURE__ */ React__namespace.createElement(reactNativeKeyboardController.KeyboardChatScrollView, { ...listProps, extraContentPadding }),
34
- [extraContentPadding]
39
+ (listProps) => /* @__PURE__ */ React__namespace.createElement(
40
+ reactNativeKeyboardController.KeyboardChatScrollView,
41
+ {
42
+ ...listProps,
43
+ extraContentPadding,
44
+ onContentInsetChange
45
+ }
46
+ ),
47
+ [extraContentPadding, onContentInsetChange]
35
48
  );
36
- return /* @__PURE__ */ React__namespace.createElement(reanimated.AnimatedLegendList, { ref: forwardedRef, renderScrollComponent: memoList, ...rest });
49
+ return /* @__PURE__ */ React__namespace.createElement(reanimated.AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
37
50
  });
38
51
 
39
52
  exports.KeyboardAvoidingLegendList = KeyboardAvoidingLegendList;
package/keyboard-test.mjs CHANGED
@@ -1,18 +1,31 @@
1
1
  import * as React from 'react';
2
- import { useCallback } from 'react';
2
+ import { useRef, useCallback } from 'react';
3
3
  import { KeyboardChatScrollView } from 'react-native-keyboard-controller';
4
4
  import { internal } from '@legendapp/list/react-native';
5
5
  import { AnimatedLegendList } from '@legendapp/list/reanimated';
6
6
 
7
7
  // src/integrations/keyboard-test.tsx
8
- var { typedForwardRef } = internal;
8
+ var { typedForwardRef, useCombinedRef } = internal;
9
9
  var KeyboardAvoidingLegendList = typedForwardRef(function KeyboardAvoidingLegendList2(props, forwardedRef) {
10
10
  const { extraContentPadding, ...rest } = props;
11
+ const refLegendList = useRef(null);
12
+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);
13
+ const onContentInsetChange = useCallback((insets) => {
14
+ var _a;
15
+ (_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);
16
+ }, []);
11
17
  const memoList = useCallback(
12
- (listProps) => /* @__PURE__ */ React.createElement(KeyboardChatScrollView, { ...listProps, extraContentPadding }),
13
- [extraContentPadding]
18
+ (listProps) => /* @__PURE__ */ React.createElement(
19
+ KeyboardChatScrollView,
20
+ {
21
+ ...listProps,
22
+ extraContentPadding,
23
+ onContentInsetChange
24
+ }
25
+ ),
26
+ [extraContentPadding, onContentInsetChange]
14
27
  );
15
- return /* @__PURE__ */ React.createElement(AnimatedLegendList, { ref: forwardedRef, renderScrollComponent: memoList, ...rest });
28
+ return /* @__PURE__ */ React.createElement(AnimatedLegendList, { ref: combinedRef, renderScrollComponent: memoList, ...rest });
16
29
  });
17
30
 
18
31
  export { KeyboardAvoidingLegendList };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "3.0.0-beta.50",
3
+ "version": "3.0.0-beta.51",
4
4
  "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,
package/react-native.js CHANGED
@@ -4570,12 +4570,14 @@ var flushSync = (fn) => {
4570
4570
  };
4571
4571
 
4572
4572
  // src/core/updateScroll.ts
4573
- function updateScroll(ctx, newScroll, forceUpdate) {
4573
+ function updateScroll(ctx, newScroll, forceUpdate, options) {
4574
4574
  var _a3;
4575
4575
  const state = ctx.state;
4576
4576
  const { ignoreScrollFromMVCP, lastScrollAdjustForHistory, scrollAdjustHandler, scrollHistory, scrollingTo } = state;
4577
4577
  const prevScroll = state.scroll;
4578
- state.hasScrolled = true;
4578
+ if ((options == null ? void 0 : options.markHasScrolled) !== false) {
4579
+ state.hasScrolled = true;
4580
+ }
4579
4581
  state.lastBatchingAction = Date.now();
4580
4582
  const currentTime = Date.now();
4581
4583
  const adjust = scrollAdjustHandler.getAdjust();
@@ -5169,7 +5171,7 @@ function createImperativeHandle(ctx) {
5169
5171
  }),
5170
5172
  reportContentInset: (inset) => {
5171
5173
  state.contentInsetOverride = inset != null ? inset : void 0;
5172
- updateScroll(ctx, state.scroll, true);
5174
+ updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
5173
5175
  },
5174
5176
  scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
5175
5177
  scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
@@ -5238,32 +5240,32 @@ var addIndex = (result, dataLength, index) => {
5238
5240
  result.add(index);
5239
5241
  }
5240
5242
  };
5241
- function getAlwaysRenderIndices(config, data, keyExtractor) {
5243
+ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnchorIndex) {
5242
5244
  var _a3, _b;
5243
- if (!config || data.length === 0) {
5245
+ if (data.length === 0) {
5244
5246
  return [];
5245
5247
  }
5246
5248
  const result = /* @__PURE__ */ new Set();
5247
5249
  const dataLength = data.length;
5248
- const topCount = toCount(config.top);
5250
+ const topCount = toCount(config == null ? void 0 : config.top);
5249
5251
  if (topCount > 0) {
5250
5252
  for (let i = 0; i < Math.min(topCount, dataLength); i++) {
5251
5253
  addIndex(result, dataLength, i);
5252
5254
  }
5253
5255
  }
5254
- const bottomCount = toCount(config.bottom);
5256
+ const bottomCount = toCount(config == null ? void 0 : config.bottom);
5255
5257
  if (bottomCount > 0) {
5256
5258
  for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
5257
5259
  addIndex(result, dataLength, i);
5258
5260
  }
5259
5261
  }
5260
- if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
5262
+ if ((_a3 = config == null ? void 0 : config.indices) == null ? void 0 : _a3.length) {
5261
5263
  for (const index of config.indices) {
5262
5264
  if (!Number.isFinite(index)) continue;
5263
5265
  addIndex(result, dataLength, Math.floor(index));
5264
5266
  }
5265
5267
  }
5266
- if ((_b = config.keys) == null ? void 0 : _b.length) {
5268
+ if ((_b = config == null ? void 0 : config.keys) == null ? void 0 : _b.length) {
5267
5269
  const keys = new Set(config.keys);
5268
5270
  for (let i = 0; i < dataLength && keys.size > 0; i++) {
5269
5271
  const key = keyExtractor(data[i], i);
@@ -5273,6 +5275,12 @@ function getAlwaysRenderIndices(config, data, keyExtractor) {
5273
5275
  }
5274
5276
  }
5275
5277
  }
5278
+ if (anchoredEndSpaceAnchorIndex !== void 0 && Number.isFinite(anchoredEndSpaceAnchorIndex)) {
5279
+ const anchorIndex = Math.floor(anchoredEndSpaceAnchorIndex);
5280
+ for (let i = anchorIndex >= 0 ? anchorIndex : dataLength; i < dataLength; i++) {
5281
+ addIndex(result, dataLength, i);
5282
+ }
5283
+ }
5276
5284
  const indices = Array.from(result);
5277
5285
  indices.sort(sortAsc);
5278
5286
  return indices;
@@ -5436,7 +5444,7 @@ var LegendList = typedMemo(
5436
5444
  })
5437
5445
  );
5438
5446
  var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
5439
- var _a3, _b, _c, _d, _e, _f, _g, _h;
5447
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
5440
5448
  const noopOnScroll = React2.useCallback((_event) => {
5441
5449
  }, []);
5442
5450
  if (props.recycleItems === void 0) {
@@ -5565,9 +5573,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5565
5573
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
5566
5574
  const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
5567
5575
  const alwaysRenderIndices = React2.useMemo(() => {
5568
- const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
5576
+ const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
5569
5577
  return { arr: indices, set: new Set(indices) };
5570
5578
  }, [
5579
+ anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
5571
5580
  alwaysRender == null ? void 0 : alwaysRender.top,
5572
5581
  alwaysRender == null ? void 0 : alwaysRender.bottom,
5573
5582
  (_d = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _d.join(","),
@@ -5673,6 +5682,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5673
5682
  const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
5674
5683
  const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
5675
5684
  const anchoredEndSpaceResolved = Platform.OS === "web" && anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
5685
+ const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
5676
5686
  state.props = {
5677
5687
  alignItemsAtEnd,
5678
5688
  alwaysRender,
@@ -5787,6 +5797,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5787
5797
  });
5788
5798
  }, [dataProp.length, didDataChangeLocal, initialScrollAtEnd, stylePaddingBottomState, usesBootstrapInitialScroll]);
5789
5799
  React2.useLayoutEffect(() => {
5800
+ var _a4;
5801
+ if (didAnchoredEndSpaceAnchorIndexChange) {
5802
+ state.scrollForNextCalculateItemsInView = void 0;
5803
+ (_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state);
5804
+ }
5790
5805
  maybeUpdateAnchoredEndSpace(ctx);
5791
5806
  }, [
5792
5807
  ctx,
@@ -5795,6 +5810,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5795
5810
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
5796
5811
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorMaxSize,
5797
5812
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorOffset,
5813
+ didAnchoredEndSpaceAnchorIndexChange,
5798
5814
  numColumnsProp
5799
5815
  ]);
5800
5816
  const onLayoutFooter = React2.useCallback(
@@ -5951,7 +5967,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5951
5967
  onScroll: onScrollHandler,
5952
5968
  recycleItems,
5953
5969
  refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React2__namespace.cloneElement(refreshControlElement, {
5954
- progressViewOffset: ((_g = refreshControlElement.props.progressViewOffset) != null ? _g : 0) + stylePaddingTopState
5970
+ progressViewOffset: ((_h = refreshControlElement.props.progressViewOffset) != null ? _h : 0) + stylePaddingTopState
5955
5971
  }) : refreshControlElement : onRefresh && /* @__PURE__ */ React2__namespace.createElement(
5956
5972
  ReactNative.RefreshControl,
5957
5973
  {
@@ -5962,7 +5978,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5962
5978
  ),
5963
5979
  refScrollView: combinedRef,
5964
5980
  renderScrollComponent,
5965
- scrollAdjustHandler: (_h = refState.current) == null ? void 0 : _h.scrollAdjustHandler,
5981
+ scrollAdjustHandler: (_i = refState.current) == null ? void 0 : _i.scrollAdjustHandler,
5966
5982
  scrollEventThrottle: 0,
5967
5983
  snapToIndices,
5968
5984
  stickyHeaderIndices,
package/react-native.mjs CHANGED
@@ -4549,12 +4549,14 @@ var flushSync = (fn) => {
4549
4549
  };
4550
4550
 
4551
4551
  // src/core/updateScroll.ts
4552
- function updateScroll(ctx, newScroll, forceUpdate) {
4552
+ function updateScroll(ctx, newScroll, forceUpdate, options) {
4553
4553
  var _a3;
4554
4554
  const state = ctx.state;
4555
4555
  const { ignoreScrollFromMVCP, lastScrollAdjustForHistory, scrollAdjustHandler, scrollHistory, scrollingTo } = state;
4556
4556
  const prevScroll = state.scroll;
4557
- state.hasScrolled = true;
4557
+ if ((options == null ? void 0 : options.markHasScrolled) !== false) {
4558
+ state.hasScrolled = true;
4559
+ }
4558
4560
  state.lastBatchingAction = Date.now();
4559
4561
  const currentTime = Date.now();
4560
4562
  const adjust = scrollAdjustHandler.getAdjust();
@@ -5148,7 +5150,7 @@ function createImperativeHandle(ctx) {
5148
5150
  }),
5149
5151
  reportContentInset: (inset) => {
5150
5152
  state.contentInsetOverride = inset != null ? inset : void 0;
5151
- updateScroll(ctx, state.scroll, true);
5153
+ updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
5152
5154
  },
5153
5155
  scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
5154
5156
  scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
@@ -5217,32 +5219,32 @@ var addIndex = (result, dataLength, index) => {
5217
5219
  result.add(index);
5218
5220
  }
5219
5221
  };
5220
- function getAlwaysRenderIndices(config, data, keyExtractor) {
5222
+ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnchorIndex) {
5221
5223
  var _a3, _b;
5222
- if (!config || data.length === 0) {
5224
+ if (data.length === 0) {
5223
5225
  return [];
5224
5226
  }
5225
5227
  const result = /* @__PURE__ */ new Set();
5226
5228
  const dataLength = data.length;
5227
- const topCount = toCount(config.top);
5229
+ const topCount = toCount(config == null ? void 0 : config.top);
5228
5230
  if (topCount > 0) {
5229
5231
  for (let i = 0; i < Math.min(topCount, dataLength); i++) {
5230
5232
  addIndex(result, dataLength, i);
5231
5233
  }
5232
5234
  }
5233
- const bottomCount = toCount(config.bottom);
5235
+ const bottomCount = toCount(config == null ? void 0 : config.bottom);
5234
5236
  if (bottomCount > 0) {
5235
5237
  for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
5236
5238
  addIndex(result, dataLength, i);
5237
5239
  }
5238
5240
  }
5239
- if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
5241
+ if ((_a3 = config == null ? void 0 : config.indices) == null ? void 0 : _a3.length) {
5240
5242
  for (const index of config.indices) {
5241
5243
  if (!Number.isFinite(index)) continue;
5242
5244
  addIndex(result, dataLength, Math.floor(index));
5243
5245
  }
5244
5246
  }
5245
- if ((_b = config.keys) == null ? void 0 : _b.length) {
5247
+ if ((_b = config == null ? void 0 : config.keys) == null ? void 0 : _b.length) {
5246
5248
  const keys = new Set(config.keys);
5247
5249
  for (let i = 0; i < dataLength && keys.size > 0; i++) {
5248
5250
  const key = keyExtractor(data[i], i);
@@ -5252,6 +5254,12 @@ function getAlwaysRenderIndices(config, data, keyExtractor) {
5252
5254
  }
5253
5255
  }
5254
5256
  }
5257
+ if (anchoredEndSpaceAnchorIndex !== void 0 && Number.isFinite(anchoredEndSpaceAnchorIndex)) {
5258
+ const anchorIndex = Math.floor(anchoredEndSpaceAnchorIndex);
5259
+ for (let i = anchorIndex >= 0 ? anchorIndex : dataLength; i < dataLength; i++) {
5260
+ addIndex(result, dataLength, i);
5261
+ }
5262
+ }
5255
5263
  const indices = Array.from(result);
5256
5264
  indices.sort(sortAsc);
5257
5265
  return indices;
@@ -5415,7 +5423,7 @@ var LegendList = typedMemo(
5415
5423
  })
5416
5424
  );
5417
5425
  var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
5418
- var _a3, _b, _c, _d, _e, _f, _g, _h;
5426
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
5419
5427
  const noopOnScroll = useCallback((_event) => {
5420
5428
  }, []);
5421
5429
  if (props.recycleItems === void 0) {
@@ -5544,9 +5552,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5544
5552
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
5545
5553
  const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
5546
5554
  const alwaysRenderIndices = useMemo(() => {
5547
- const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
5555
+ const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
5548
5556
  return { arr: indices, set: new Set(indices) };
5549
5557
  }, [
5558
+ anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
5550
5559
  alwaysRender == null ? void 0 : alwaysRender.top,
5551
5560
  alwaysRender == null ? void 0 : alwaysRender.bottom,
5552
5561
  (_d = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _d.join(","),
@@ -5652,6 +5661,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5652
5661
  const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
5653
5662
  const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
5654
5663
  const anchoredEndSpaceResolved = Platform.OS === "web" && anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
5664
+ const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
5655
5665
  state.props = {
5656
5666
  alignItemsAtEnd,
5657
5667
  alwaysRender,
@@ -5766,6 +5776,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5766
5776
  });
5767
5777
  }, [dataProp.length, didDataChangeLocal, initialScrollAtEnd, stylePaddingBottomState, usesBootstrapInitialScroll]);
5768
5778
  useLayoutEffect(() => {
5779
+ var _a4;
5780
+ if (didAnchoredEndSpaceAnchorIndexChange) {
5781
+ state.scrollForNextCalculateItemsInView = void 0;
5782
+ (_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state);
5783
+ }
5769
5784
  maybeUpdateAnchoredEndSpace(ctx);
5770
5785
  }, [
5771
5786
  ctx,
@@ -5774,6 +5789,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5774
5789
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
5775
5790
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorMaxSize,
5776
5791
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorOffset,
5792
+ didAnchoredEndSpaceAnchorIndexChange,
5777
5793
  numColumnsProp
5778
5794
  ]);
5779
5795
  const onLayoutFooter = useCallback(
@@ -5930,7 +5946,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5930
5946
  onScroll: onScrollHandler,
5931
5947
  recycleItems,
5932
5948
  refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React2.cloneElement(refreshControlElement, {
5933
- progressViewOffset: ((_g = refreshControlElement.props.progressViewOffset) != null ? _g : 0) + stylePaddingTopState
5949
+ progressViewOffset: ((_h = refreshControlElement.props.progressViewOffset) != null ? _h : 0) + stylePaddingTopState
5934
5950
  }) : refreshControlElement : onRefresh && /* @__PURE__ */ React2.createElement(
5935
5951
  RefreshControl,
5936
5952
  {
@@ -5941,7 +5957,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5941
5957
  ),
5942
5958
  refScrollView: combinedRef,
5943
5959
  renderScrollComponent,
5944
- scrollAdjustHandler: (_h = refState.current) == null ? void 0 : _h.scrollAdjustHandler,
5960
+ scrollAdjustHandler: (_i = refState.current) == null ? void 0 : _i.scrollAdjustHandler,
5945
5961
  scrollEventThrottle: 0,
5946
5962
  snapToIndices,
5947
5963
  stickyHeaderIndices,
@@ -5103,12 +5103,14 @@ function handleLayout(ctx, layoutParam, setCanRender) {
5103
5103
  }
5104
5104
 
5105
5105
  // src/core/updateScroll.ts
5106
- function updateScroll(ctx, newScroll, forceUpdate) {
5106
+ function updateScroll(ctx, newScroll, forceUpdate, options) {
5107
5107
  var _a3;
5108
5108
  const state = ctx.state;
5109
5109
  const { ignoreScrollFromMVCP, lastScrollAdjustForHistory, scrollAdjustHandler, scrollHistory, scrollingTo } = state;
5110
5110
  const prevScroll = state.scroll;
5111
- state.hasScrolled = true;
5111
+ if ((options == null ? void 0 : options.markHasScrolled) !== false) {
5112
+ state.hasScrolled = true;
5113
+ }
5112
5114
  state.lastBatchingAction = Date.now();
5113
5115
  const currentTime = Date.now();
5114
5116
  const adjust = scrollAdjustHandler.getAdjust();
@@ -5687,7 +5689,7 @@ function createImperativeHandle(ctx) {
5687
5689
  }),
5688
5690
  reportContentInset: (inset) => {
5689
5691
  state.contentInsetOverride = inset != null ? inset : void 0;
5690
- updateScroll(ctx, state.scroll, true);
5692
+ updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
5691
5693
  },
5692
5694
  scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
5693
5695
  scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
@@ -5756,32 +5758,32 @@ var addIndex = (result, dataLength, index) => {
5756
5758
  result.add(index);
5757
5759
  }
5758
5760
  };
5759
- function getAlwaysRenderIndices(config, data, keyExtractor) {
5761
+ function getAlwaysRenderIndices(config, data, keyExtractor, anchoredEndSpaceAnchorIndex) {
5760
5762
  var _a3, _b;
5761
- if (!config || data.length === 0) {
5763
+ if (data.length === 0) {
5762
5764
  return [];
5763
5765
  }
5764
5766
  const result = /* @__PURE__ */ new Set();
5765
5767
  const dataLength = data.length;
5766
- const topCount = toCount(config.top);
5768
+ const topCount = toCount(config == null ? void 0 : config.top);
5767
5769
  if (topCount > 0) {
5768
5770
  for (let i = 0; i < Math.min(topCount, dataLength); i++) {
5769
5771
  addIndex(result, dataLength, i);
5770
5772
  }
5771
5773
  }
5772
- const bottomCount = toCount(config.bottom);
5774
+ const bottomCount = toCount(config == null ? void 0 : config.bottom);
5773
5775
  if (bottomCount > 0) {
5774
5776
  for (let i = Math.max(0, dataLength - bottomCount); i < dataLength; i++) {
5775
5777
  addIndex(result, dataLength, i);
5776
5778
  }
5777
5779
  }
5778
- if ((_a3 = config.indices) == null ? void 0 : _a3.length) {
5780
+ if ((_a3 = config == null ? void 0 : config.indices) == null ? void 0 : _a3.length) {
5779
5781
  for (const index of config.indices) {
5780
5782
  if (!Number.isFinite(index)) continue;
5781
5783
  addIndex(result, dataLength, Math.floor(index));
5782
5784
  }
5783
5785
  }
5784
- if ((_b = config.keys) == null ? void 0 : _b.length) {
5786
+ if ((_b = config == null ? void 0 : config.keys) == null ? void 0 : _b.length) {
5785
5787
  const keys = new Set(config.keys);
5786
5788
  for (let i = 0; i < dataLength && keys.size > 0; i++) {
5787
5789
  const key = keyExtractor(data[i], i);
@@ -5791,6 +5793,12 @@ function getAlwaysRenderIndices(config, data, keyExtractor) {
5791
5793
  }
5792
5794
  }
5793
5795
  }
5796
+ if (anchoredEndSpaceAnchorIndex !== void 0 && Number.isFinite(anchoredEndSpaceAnchorIndex)) {
5797
+ const anchorIndex = Math.floor(anchoredEndSpaceAnchorIndex);
5798
+ for (let i = anchorIndex >= 0 ? anchorIndex : dataLength; i < dataLength; i++) {
5799
+ addIndex(result, dataLength, i);
5800
+ }
5801
+ }
5794
5802
  const indices = Array.from(result);
5795
5803
  indices.sort(sortAsc);
5796
5804
  return indices;
@@ -5954,7 +5962,7 @@ var LegendList = typedMemo(
5954
5962
  })
5955
5963
  );
5956
5964
  var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
5957
- var _a3, _b, _c, _d, _e, _f, _g, _h;
5965
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i;
5958
5966
  const noopOnScroll = React3.useCallback((_event) => {
5959
5967
  }, []);
5960
5968
  if (props.recycleItems === void 0) {
@@ -6083,9 +6091,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6083
6091
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
6084
6092
  const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
6085
6093
  const alwaysRenderIndices = React3.useMemo(() => {
6086
- const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor);
6094
+ const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
6087
6095
  return { arr: indices, set: new Set(indices) };
6088
6096
  }, [
6097
+ anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
6089
6098
  alwaysRender == null ? void 0 : alwaysRender.top,
6090
6099
  alwaysRender == null ? void 0 : alwaysRender.bottom,
6091
6100
  (_d = alwaysRender == null ? void 0 : alwaysRender.indices) == null ? void 0 : _d.join(","),
@@ -6191,6 +6200,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6191
6200
  const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
6192
6201
  const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
6193
6202
  const anchoredEndSpaceResolved = anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
6203
+ const didAnchoredEndSpaceAnchorIndexChange = !isFirstLocal && !didDataChangeLocal && ((_g = state.props.anchoredEndSpace) == null ? void 0 : _g.anchorIndex) !== (anchoredEndSpaceResolved == null ? void 0 : anchoredEndSpaceResolved.anchorIndex);
6194
6204
  state.props = {
6195
6205
  alignItemsAtEnd,
6196
6206
  alwaysRender,
@@ -6300,6 +6310,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6300
6310
  });
6301
6311
  }, [dataProp.length, didDataChangeLocal, initialScrollAtEnd, stylePaddingBottomState, usesBootstrapInitialScroll]);
6302
6312
  React3.useLayoutEffect(() => {
6313
+ var _a4;
6314
+ if (didAnchoredEndSpaceAnchorIndexChange) {
6315
+ state.scrollForNextCalculateItemsInView = void 0;
6316
+ (_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state);
6317
+ }
6303
6318
  maybeUpdateAnchoredEndSpace(ctx);
6304
6319
  }, [
6305
6320
  ctx,
@@ -6308,6 +6323,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6308
6323
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex,
6309
6324
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorMaxSize,
6310
6325
  anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorOffset,
6326
+ didAnchoredEndSpaceAnchorIndexChange,
6311
6327
  numColumnsProp
6312
6328
  ]);
6313
6329
  const onLayoutFooter = React3.useCallback(
@@ -6461,7 +6477,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6461
6477
  onScroll: onScrollHandler,
6462
6478
  recycleItems,
6463
6479
  refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React3__namespace.cloneElement(refreshControlElement, {
6464
- progressViewOffset: ((_g = refreshControlElement.props.progressViewOffset) != null ? _g : 0) + stylePaddingTopState
6480
+ progressViewOffset: ((_h = refreshControlElement.props.progressViewOffset) != null ? _h : 0) + stylePaddingTopState
6465
6481
  }) : refreshControlElement : onRefresh && /* @__PURE__ */ React3__namespace.createElement(
6466
6482
  RefreshControl,
6467
6483
  {
@@ -6472,7 +6488,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6472
6488
  ),
6473
6489
  refScrollView: combinedRef,
6474
6490
  renderScrollComponent,
6475
- scrollAdjustHandler: (_h = refState.current) == null ? void 0 : _h.scrollAdjustHandler,
6491
+ scrollAdjustHandler: (_i = refState.current) == null ? void 0 : _i.scrollAdjustHandler,
6476
6492
  scrollEventThrottle: 0,
6477
6493
  snapToIndices,
6478
6494
  stickyHeaderIndices,