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

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.mjs CHANGED
@@ -145,7 +145,10 @@ function useSelector$(signalName, selector) {
145
145
  }
146
146
 
147
147
  // src/state/getContentInsetEnd.ts
148
- function getContentInsetEnd(ctx) {
148
+ function getContentInsetEndAdjustmentEnd(adjustment) {
149
+ return Math.max(0, adjustment != null ? adjustment : 0);
150
+ }
151
+ function getContentInsetEnd(ctx, contentInsetEndAdjustmentOverride) {
149
152
  var _a3, _b;
150
153
  const state = ctx.state;
151
154
  const { props } = state;
@@ -153,14 +156,21 @@ function getContentInsetEnd(ctx) {
153
156
  const contentInset = props.contentInset;
154
157
  const baseInset = contentInset != null ? contentInset : state.nativeContentInset;
155
158
  const baseEndInset = (horizontal ? baseInset == null ? void 0 : baseInset.right : baseInset == null ? void 0 : baseInset.bottom) || 0;
159
+ const contentInsetEndAdjustment = getContentInsetEndAdjustmentEnd(
160
+ contentInsetEndAdjustmentOverride != null ? contentInsetEndAdjustmentOverride : props.contentInsetEndAdjustment
161
+ );
156
162
  const anchoredEndSpaceSize = peek$(ctx, "anchoredEndSpaceSize");
157
163
  const anchoredEndInset = ((_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.includeInEndInset) && anchoredEndSpaceSize ? anchoredEndSpaceSize : 0;
158
164
  const overrideInset = (_b = state.contentInsetOverride) != null ? _b : void 0;
165
+ const adjustedBaseEndInset = baseEndInset + contentInsetEndAdjustment;
159
166
  if (overrideInset) {
160
167
  const mergedInset = { bottom: 0, right: 0, ...baseInset, ...overrideInset };
161
- return Math.max((horizontal ? mergedInset.right : mergedInset.bottom) || 0, anchoredEndInset);
168
+ return Math.max(
169
+ ((horizontal ? mergedInset.right : mergedInset.bottom) || 0) + contentInsetEndAdjustment,
170
+ anchoredEndInset
171
+ );
162
172
  }
163
- return Math.max(baseEndInset, anchoredEndInset);
173
+ return Math.max(adjustedBaseEndInset, anchoredEndInset);
164
174
  }
165
175
 
166
176
  // src/state/getContentSize.ts
@@ -658,6 +668,49 @@ function isInMVCPActiveMode(state) {
658
668
  }
659
669
 
660
670
  // src/components/Container.tsx
671
+ function getContainerPositionStyle({
672
+ columnWrapperStyle,
673
+ horizontal,
674
+ hasItemSeparator,
675
+ numColumns,
676
+ otherAxisPos,
677
+ otherAxisSize
678
+ }) {
679
+ let paddingStyles;
680
+ if (columnWrapperStyle) {
681
+ const { columnGap, rowGap, gap } = columnWrapperStyle;
682
+ if (horizontal) {
683
+ paddingStyles = {
684
+ paddingBottom: numColumns > 1 ? (rowGap || gap || 0) / 2 : void 0,
685
+ paddingRight: columnGap || gap || void 0,
686
+ paddingTop: numColumns > 1 ? (rowGap || gap || 0) / 2 : void 0
687
+ };
688
+ } else {
689
+ paddingStyles = {
690
+ paddingBottom: rowGap || gap || void 0,
691
+ paddingLeft: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0,
692
+ paddingRight: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0
693
+ };
694
+ }
695
+ }
696
+ return horizontal ? {
697
+ boxSizing: paddingStyles ? "border-box" : void 0,
698
+ flexDirection: hasItemSeparator ? "row" : void 0,
699
+ height: otherAxisSize,
700
+ left: 0,
701
+ position: "absolute",
702
+ top: otherAxisPos,
703
+ ...paddingStyles || {}
704
+ } : {
705
+ boxSizing: paddingStyles ? "border-box" : void 0,
706
+ left: otherAxisPos,
707
+ position: "absolute",
708
+ right: numColumns > 1 ? null : 0,
709
+ top: 0,
710
+ width: otherAxisSize,
711
+ ...paddingStyles || {}
712
+ };
713
+ }
661
714
  var Container = typedMemo(function Container2({
662
715
  id,
663
716
  recycleItems,
@@ -696,42 +749,17 @@ var Container = typedMemo(function Container2({
696
749
  const resolvedSpan = Math.min(Math.max(span || 1, 1), numColumns);
697
750
  const otherAxisPos = numColumns > 1 ? `${(resolvedColumn - 1) / numColumns * 100}%` : 0;
698
751
  const otherAxisSize = numColumns > 1 ? `${resolvedSpan / numColumns * 100}%` : void 0;
699
- const style = useMemo(() => {
700
- let paddingStyles;
701
- if (columnWrapperStyle) {
702
- const { columnGap, rowGap, gap } = columnWrapperStyle;
703
- if (horizontal) {
704
- paddingStyles = {
705
- paddingBottom: numColumns > 1 ? (rowGap || gap || 0) / 2 : void 0,
706
- paddingRight: columnGap || gap || void 0,
707
- paddingTop: numColumns > 1 ? (rowGap || gap || 0) / 2 : void 0
708
- };
709
- } else {
710
- paddingStyles = {
711
- paddingBottom: rowGap || gap || void 0,
712
- paddingLeft: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0,
713
- paddingRight: numColumns > 1 ? (columnGap || gap || 0) / 2 : void 0
714
- };
715
- }
716
- }
717
- return horizontal ? {
718
- boxSizing: paddingStyles ? "border-box" : void 0,
719
- flexDirection: ItemSeparatorComponent ? "row" : void 0,
720
- height: otherAxisSize,
721
- left: 0,
722
- position: "absolute",
723
- top: otherAxisPos,
724
- ...paddingStyles || {}
725
- } : {
726
- boxSizing: paddingStyles ? "border-box" : void 0,
727
- left: otherAxisPos,
728
- position: "absolute",
729
- right: numColumns > 1 ? null : 0,
730
- top: 0,
731
- width: otherAxisSize,
732
- ...paddingStyles || {}
733
- };
734
- }, [horizontal, otherAxisPos, otherAxisSize, columnWrapperStyle, numColumns]);
752
+ const style = useMemo(
753
+ () => getContainerPositionStyle({
754
+ columnWrapperStyle,
755
+ hasItemSeparator: !!ItemSeparatorComponent,
756
+ horizontal,
757
+ numColumns,
758
+ otherAxisPos,
759
+ otherAxisSize
760
+ }),
761
+ [horizontal, otherAxisPos, otherAxisSize, columnWrapperStyle, numColumns, ItemSeparatorComponent]
762
+ );
735
763
  const renderedItemInfo = useMemo(
736
764
  () => itemKey !== void 0 ? getRenderedItem2(itemKey) : null,
737
765
  [itemKey, data, extraData]
@@ -1042,6 +1070,9 @@ function useRafCoalescer(callback) {
1042
1070
  return coalescer;
1043
1071
  }
1044
1072
 
1073
+ // src/components/webConstants.ts
1074
+ var LEGEND_LIST_CONTENT_CONTAINER_CLASS = "legend-list-content-container";
1075
+
1045
1076
  // src/components/webScrollUtils.ts
1046
1077
  function getDocumentScrollerNode() {
1047
1078
  if (typeof document === "undefined") {
@@ -1126,6 +1157,11 @@ function resolveWindowScrollTarget({ clampedOffset, horizontal, listPos, scroll
1126
1157
  }
1127
1158
 
1128
1159
  // src/components/ListComponentScrollView.tsx
1160
+ function getContentInsetEndAdjustmentEnd2(ctx) {
1161
+ var _a3, _b;
1162
+ const adjustment = (_b = (_a3 = ctx.state) == null ? void 0 : _a3.props) == null ? void 0 : _b.contentInsetEndAdjustment;
1163
+ return Math.max(0, adjustment != null ? adjustment : 0);
1164
+ }
1129
1165
  var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
1130
1166
  children,
1131
1167
  style,
@@ -1143,7 +1179,9 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
1143
1179
  onLayout,
1144
1180
  ...props
1145
1181
  }, ref) {
1182
+ var _a3, _b, _c;
1146
1183
  const ctx = useStateContext();
1184
+ const [anchoredEndSpaceSize] = useArr$(["anchoredEndSpaceSize"]);
1147
1185
  const scrollRef = useRef(null);
1148
1186
  const contentRef = useRef(null);
1149
1187
  const isWindowScroll = useWindowScroll;
@@ -1205,10 +1243,9 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
1205
1243
  useImperativeHandle(ref, () => {
1206
1244
  const api = {
1207
1245
  getBoundingClientRect: () => {
1208
- var _a3;
1209
- return (_a3 = scrollRef.current) == null ? void 0 : _a3.getBoundingClientRect();
1246
+ var _a4;
1247
+ return (_a4 = scrollRef.current) == null ? void 0 : _a4.getBoundingClientRect();
1210
1248
  },
1211
- getContentNode: () => contentRef.current,
1212
1249
  getCurrentScrollOffset,
1213
1250
  getScrollableNode: () => resolveScrollableNode(scrollRef.current, isWindowScroll),
1214
1251
  getScrollEventTarget: () => getScrollTarget(),
@@ -1334,6 +1371,10 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
1334
1371
  },
1335
1372
  ...StyleSheet.flatten(style)
1336
1373
  };
1374
+ const contentInsetEndAdjustment = getContentInsetEndAdjustmentEnd2(ctx);
1375
+ const anchoredEndInset = ((_c = (_b = (_a3 = ctx.state) == null ? void 0 : _a3.props) == null ? void 0 : _b.anchoredEndSpace) == null ? void 0 : _c.includeInEndInset) && anchoredEndSpaceSize ? anchoredEndSpaceSize : 0;
1376
+ const renderedContentInsetEndAdjustment = Math.max(0, contentInsetEndAdjustment - anchoredEndInset);
1377
+ const contentInsetEndAdjustmentSpacerStyle = renderedContentInsetEndAdjustment ? horizontal ? { flexShrink: 0, width: renderedContentInsetEndAdjustment } : { height: renderedContentInsetEndAdjustment } : void 0;
1337
1378
  const contentStyle = {
1338
1379
  display: horizontal ? "flex" : "block",
1339
1380
  flexDirection: horizontal ? "row" : void 0,
@@ -1341,6 +1382,7 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
1341
1382
  minWidth: horizontal ? "100%" : void 0,
1342
1383
  ...StyleSheet.flatten(contentContainerStyle)
1343
1384
  };
1385
+ const className = contentContainerClassName ? `${LEGEND_LIST_CONTENT_CONTAINER_CLASS} ${contentContainerClassName}` : LEGEND_LIST_CONTENT_CONTAINER_CLASS;
1344
1386
  const {
1345
1387
  contentContainerClassName: _contentContainerClassName,
1346
1388
  contentInset: _contentInset,
@@ -1349,7 +1391,7 @@ var ListComponentScrollView = forwardRef(function ListComponentScrollView2({
1349
1391
  useWindowScroll: _useWindowScroll,
1350
1392
  ...webProps
1351
1393
  } = props;
1352
- return /* @__PURE__ */ React3.createElement("div", { ref: scrollRef, ...webProps, style: scrollViewStyle }, refreshControl, /* @__PURE__ */ React3.createElement("div", { className: contentContainerClassName, ref: contentRef, style: contentStyle }, children));
1394
+ return /* @__PURE__ */ React3.createElement("div", { ref: scrollRef, ...webProps, style: scrollViewStyle }, refreshControl, /* @__PURE__ */ React3.createElement("div", { className, ref: contentRef, style: contentStyle }, children, contentInsetEndAdjustmentSpacerStyle ? /* @__PURE__ */ React3.createElement("div", { "aria-hidden": true, style: contentInsetEndAdjustmentSpacerStyle }) : null));
1353
1395
  });
1354
1396
  function useValueListener$(key, callback) {
1355
1397
  const ctx = useStateContext();
@@ -1377,11 +1419,18 @@ function getScrollAdjustAxis(horizontal) {
1377
1419
  y: 1
1378
1420
  };
1379
1421
  }
1422
+ function resolveScrollAdjustContentNode(el, contentNode) {
1423
+ if ((contentNode == null ? void 0 : contentNode.isConnected) && contentNode.parentElement === el) {
1424
+ return contentNode;
1425
+ }
1426
+ return el.querySelector(`:scope > .${LEGEND_LIST_CONTENT_CONTAINER_CLASS}`);
1427
+ }
1380
1428
  function ScrollAdjust() {
1381
1429
  const ctx = useStateContext();
1382
1430
  const lastScrollOffsetRef = React3.useRef(0);
1383
1431
  const resetPaddingRafRef = React3.useRef(void 0);
1384
1432
  const resetPaddingBaselineRef = React3.useRef(void 0);
1433
+ const contentNodeRef = React3.useRef(null);
1385
1434
  const callback = React3.useCallback(() => {
1386
1435
  var _a3, _b;
1387
1436
  const scrollAdjust = peek$(ctx, "scrollAdjust");
@@ -1392,9 +1441,10 @@ function ScrollAdjust() {
1392
1441
  const scrollDelta = scrollOffset - lastScrollOffsetRef.current;
1393
1442
  if (scrollDelta !== 0) {
1394
1443
  const axis = getScrollAdjustAxis(!!ctx.state.props.horizontal);
1395
- const contentNode = scrollView.getContentNode();
1396
1444
  const prevScroll = scrollView.getCurrentScrollOffset();
1397
1445
  const el = scrollView.getScrollableNode();
1446
+ const contentNode = resolveScrollAdjustContentNode(el, contentNodeRef.current);
1447
+ contentNodeRef.current = contentNode;
1398
1448
  const scrollBy = () => scrollView.scrollBy(axis.x * scrollDelta, axis.y * scrollDelta);
1399
1449
  if (!contentNode) {
1400
1450
  scrollBy();
@@ -3249,6 +3299,15 @@ function checkFinishedScrollFallback(ctx) {
3249
3299
  }
3250
3300
 
3251
3301
  // src/core/initialScrollLifecycle.ts
3302
+ function retargetActiveInitialScrollAtEnd(ctx) {
3303
+ var _a3;
3304
+ const state = ctx.state;
3305
+ const initialScroll = state.initialScroll;
3306
+ if (!initialScroll || state.didFinishInitialScroll || ((_a3 = state.initialScrollSession) == null ? void 0 : _a3.kind) === "offset" || initialScroll.viewPosition !== 1 || state.props.data.length === 0) {
3307
+ return false;
3308
+ }
3309
+ return advanceCurrentInitialScrollSession(ctx, { forceScroll: true });
3310
+ }
3252
3311
  function handleInitialScrollLayoutReady(ctx) {
3253
3312
  var _a3;
3254
3313
  if (!ctx.state.initialScroll) {
@@ -5305,17 +5364,32 @@ function maybeUpdateAnchoredEndSpace(ctx) {
5305
5364
  nextSize = Math.max(0, state.scrollLength - contentBelowAnchor - anchorOffset);
5306
5365
  }
5307
5366
  }
5308
- if (previousSize === nextSize) {
5309
- return nextSize;
5310
- }
5311
- set$(ctx, "anchoredEndSpaceSize", nextSize);
5312
- (_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
5313
- if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
5314
- updateScroll(ctx, state.scroll, true);
5367
+ if (previousSize !== nextSize) {
5368
+ set$(ctx, "anchoredEndSpaceSize", nextSize);
5369
+ (_a3 = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onSizeChanged) == null ? void 0 : _a3.call(anchoredEndSpace, nextSize);
5370
+ if (anchoredEndSpace == null ? void 0 : anchoredEndSpace.includeInEndInset) {
5371
+ updateScroll(ctx, state.scroll, true);
5372
+ }
5315
5373
  }
5316
5374
  return nextSize;
5317
5375
  }
5318
5376
 
5377
+ // src/core/updateContentInsetEndAdjustment.ts
5378
+ function updateContentInsetEndAdjustment(ctx, previousContentInsetEndAdjustment) {
5379
+ const state = ctx.state;
5380
+ const previousContentInsetEnd = getContentInsetEnd(ctx, previousContentInsetEndAdjustment);
5381
+ const nextContentInsetEnd = getContentInsetEnd(ctx);
5382
+ const insetDiff = nextContentInsetEnd - previousContentInsetEnd;
5383
+ if (insetDiff !== 0) {
5384
+ const wasWithinEndThreshold = !!peek$(ctx, "isWithinMaintainScrollAtEndThreshold");
5385
+ updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
5386
+ const didRetargetInitialScroll = retargetActiveInitialScrollAtEnd(ctx);
5387
+ if (!didRetargetInitialScroll && wasWithinEndThreshold && (insetDiff > 0)) {
5388
+ requestAdjust(ctx, insetDiff);
5389
+ }
5390
+ }
5391
+ }
5392
+
5319
5393
  // src/core/updateItemSize.ts
5320
5394
  function runOrScheduleMVCPRecalculate(ctx) {
5321
5395
  const state = ctx.state;
@@ -5540,14 +5614,14 @@ function createImperativeHandle(ctx) {
5540
5614
  const IMPERATIVE_SCROLL_SETTLE_STABLE_FRAMES = 2;
5541
5615
  let imperativeScrollToken = 0;
5542
5616
  const isSettlingAfterDataChange = () => !!state.didDataChange || !!state.didColumnsChange || state.queuedMVCPRecalculate !== void 0 || state.ignoreScrollFromMVCP !== void 0;
5543
- const runWhenSettled = (token, run) => {
5617
+ const runWhenReady = (token, run, isReady) => {
5544
5618
  const startedAt = Date.now();
5545
5619
  let stableFrames = 0;
5546
5620
  const check = () => {
5547
5621
  if (token !== imperativeScrollToken) {
5548
5622
  return;
5549
5623
  }
5550
- if (isSettlingAfterDataChange()) {
5624
+ if (isSettlingAfterDataChange() || !isReady()) {
5551
5625
  stableFrames = 0;
5552
5626
  } else {
5553
5627
  stableFrames += 1;
@@ -5562,10 +5636,10 @@ function createImperativeHandle(ctx) {
5562
5636
  requestAnimationFrame(check);
5563
5637
  };
5564
5638
  const runScrollWithPromise = (run, options) => new Promise((resolve) => {
5565
- var _a3;
5639
+ var _a3, _b;
5566
5640
  const token = ++imperativeScrollToken;
5567
- const shouldWaitOneFrame = !!(options == null ? void 0 : options.shouldWaitOneFrame);
5568
- (_a3 = state.pendingScrollResolve) == null ? void 0 : _a3.call(state);
5641
+ const isReady = (_a3 = options == null ? void 0 : options.isReady) != null ? _a3 : (() => true);
5642
+ (_b = state.pendingScrollResolve) == null ? void 0 : _b.call(state);
5569
5643
  state.pendingScrollResolve = resolve;
5570
5644
  const runNow = () => {
5571
5645
  if (token !== imperativeScrollToken) {
@@ -5579,11 +5653,10 @@ function createImperativeHandle(ctx) {
5579
5653
  resolve();
5580
5654
  }
5581
5655
  };
5582
- const execute = shouldWaitOneFrame ? () => requestAnimationFrame(runNow) : runNow;
5583
- if (isSettlingAfterDataChange()) {
5584
- runWhenSettled(token, execute);
5656
+ if (isSettlingAfterDataChange() || !isReady()) {
5657
+ runWhenReady(token, runNow, isReady);
5585
5658
  } else {
5586
- execute();
5659
+ runNow();
5587
5660
  }
5588
5661
  });
5589
5662
  const scrollIndexIntoView = (options) => {
@@ -5664,8 +5737,14 @@ function createImperativeHandle(ctx) {
5664
5737
  startBuffered: state.startBuffered
5665
5738
  }),
5666
5739
  reportContentInset: (inset) => {
5740
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
5741
+ const previousInset = state.contentInsetOverride;
5667
5742
  state.contentInsetOverride = inset != null ? inset : void 0;
5743
+ 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);
5668
5744
  updateScroll(ctx, state.scroll, true, { markHasScrolled: false });
5745
+ if (didChange) {
5746
+ retargetActiveInitialScrollAtEnd(ctx);
5747
+ }
5669
5748
  },
5670
5749
  scrollIndexIntoView: (options) => runScrollWithPromise(() => scrollIndexIntoView(options)),
5671
5750
  scrollItemIntoView: ({ item, ...props }) => runScrollWithPromise(() => {
@@ -5694,15 +5773,24 @@ function createImperativeHandle(ctx) {
5694
5773
  }
5695
5774
  return false;
5696
5775
  }),
5697
- scrollToIndex: (params) => runScrollWithPromise(
5698
- () => {
5776
+ scrollToIndex: (params) => {
5777
+ const shouldWaitForOutOfRangeTarget = params.index >= 0 && params.index >= state.props.data.length;
5778
+ const options = shouldWaitForOutOfRangeTarget ? {
5779
+ isReady: () => {
5780
+ var _a3;
5781
+ const props = state.props;
5782
+ const anchorIndex = (_a3 = props.anchoredEndSpace) == null ? void 0 : _a3.anchorIndex;
5783
+ const lastIndex = props.data.length - 1;
5784
+ const isInRange = params.index < props.data.length;
5785
+ const shouldWaitForAnchorSize = isInRange && anchorIndex !== void 0 && anchorIndex >= 0 && params.index >= anchorIndex && !props.getFixedItemSize && !state.sizesKnown.has(getId(state, lastIndex));
5786
+ return isInRange && !shouldWaitForAnchorSize;
5787
+ }
5788
+ } : void 0;
5789
+ return runScrollWithPromise(() => {
5699
5790
  scrollToIndex(ctx, params);
5700
5791
  return true;
5701
- },
5702
- {
5703
- shouldWaitOneFrame: params.index >= 0 && params.index >= state.props.data.length
5704
- }
5705
- ),
5792
+ }, options);
5793
+ },
5706
5794
  scrollToItem: ({ item, ...props }) => runScrollWithPromise(() => {
5707
5795
  const data = state.props.data;
5708
5796
  const index = data.indexOf(item);
@@ -5957,6 +6045,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
5957
6045
  data: dataProp = [],
5958
6046
  dataVersion,
5959
6047
  drawDistance = 250,
6048
+ contentInsetEndAdjustment,
5960
6049
  estimatedItemSize = 100,
5961
6050
  estimatedListSize,
5962
6051
  extraData,
@@ -6066,6 +6155,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6066
6155
  const combinedRef = useCombinedRef(refScroller, refScrollView);
6067
6156
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());
6068
6157
  const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
6158
+ const contentInsetEndAdjustmentResolved = contentInsetEndAdjustment ;
6159
+ const previousContentInsetEndAdjustmentRef = useRef(contentInsetEndAdjustmentResolved);
6069
6160
  const alwaysRenderIndices = useMemo(() => {
6070
6161
  const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);
6071
6162
  return { arr: indices, set: new Set(indices) };
@@ -6185,6 +6276,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6185
6276
  anchoredEndSpace: anchoredEndSpaceResolved,
6186
6277
  animatedProps: animatedPropsInternal,
6187
6278
  contentInset,
6279
+ contentInsetEndAdjustment: contentInsetEndAdjustmentResolved,
6188
6280
  data: dataProp,
6189
6281
  dataVersion,
6190
6282
  drawDistance,
@@ -6302,6 +6394,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
6302
6394
  didAnchoredEndSpaceAnchorIndexChange,
6303
6395
  numColumnsProp
6304
6396
  ]);
6397
+ useLayoutEffect(() => {
6398
+ const previousContentInsetEndAdjustment = previousContentInsetEndAdjustmentRef.current;
6399
+ previousContentInsetEndAdjustmentRef.current = contentInsetEndAdjustmentResolved;
6400
+ updateContentInsetEndAdjustment(ctx, previousContentInsetEndAdjustment);
6401
+ }, [ctx, contentInsetEndAdjustmentResolved]);
6305
6402
  const onLayoutFooter = useCallback(
6306
6403
  (layout) => {
6307
6404
  if (!usesBootstrapInitialScroll) {