@legendapp/list 2.1.0-beta.12 → 2.1.0-beta.13

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
@@ -483,13 +483,17 @@ function useOnLayoutSync({
483
483
  };
484
484
  const rect = element.getBoundingClientRect();
485
485
  emit(toLayout(rect), true);
486
+ let prevRect = rect;
486
487
  return createResizeObserver(element, (entry) => {
487
488
  var _a4;
488
489
  const target = entry.target instanceof HTMLElement ? entry.target : void 0;
489
490
  const rect2 = (_a4 = entry.contentRect) != null ? _a4 : target == null ? void 0 : target.getBoundingClientRect();
490
- emit(toLayout(rect2), false);
491
+ if (rect2.width !== prevRect.width || rect2.height !== prevRect.height) {
492
+ prevRect = rect2;
493
+ emit(toLayout(rect2), false);
494
+ }
491
495
  });
492
- }, deps);
496
+ }, deps || []);
493
497
  return {};
494
498
  }
495
499
  function toLayout(rect) {
@@ -1037,8 +1041,26 @@ function ScrollAdjust() {
1037
1041
  if (scrollView && scrollOffset !== lastScrollOffsetRef.current) {
1038
1042
  const scrollDelta = scrollOffset - lastScrollOffsetRef.current;
1039
1043
  if (scrollDelta !== 0) {
1040
- scrollView.scrollBy(0, scrollDelta);
1041
- console.log("ScrollAdjust (web scrollBy)", scrollDelta, "total offset:", scrollOffset);
1044
+ const el = scrollView.getScrollableNode();
1045
+ const prevScroll = el.scrollTop;
1046
+ const nextScroll = prevScroll + scrollDelta;
1047
+ const totalSize = el.scrollHeight;
1048
+ if (scrollDelta > 0 && !ctx.internalState.adjustingFromInitialMount && totalSize < nextScroll + el.clientHeight) {
1049
+ const child = el.firstElementChild;
1050
+ const prevPaddingBottom = child.style.paddingBottom;
1051
+ const pad = (nextScroll + el.clientHeight - totalSize) * 2;
1052
+ child.style.paddingBottom = `${pad}px`;
1053
+ void el.offsetHeight;
1054
+ scrollView.scrollBy(0, scrollDelta);
1055
+ setTimeout(() => {
1056
+ child.style.paddingBottom = prevPaddingBottom;
1057
+ }, 100);
1058
+ } else {
1059
+ scrollView.scrollBy(0, scrollDelta);
1060
+ }
1061
+ if (IS_DEV) {
1062
+ console.log("ScrollAdjust (web scrollBy)", scrollDelta, "total offset:", scrollOffset);
1063
+ }
1042
1064
  }
1043
1065
  lastScrollOffsetRef.current = scrollOffset;
1044
1066
  }
@@ -1092,7 +1114,7 @@ var ListComponent = typedMemo(function ListComponent2({
1092
1114
  scrollAdjustHandler,
1093
1115
  onLayoutHeader,
1094
1116
  snapToIndices,
1095
- stickyIndices,
1117
+ stickyHeaderIndices,
1096
1118
  ...rest
1097
1119
  }) {
1098
1120
  const ctx = useStateContext();
@@ -1127,7 +1149,7 @@ var ListComponent = typedMemo(function ListComponent2({
1127
1149
  ScrollComponent: snapToIndices ? ScrollComponent : void 0,
1128
1150
  style
1129
1151
  },
1130
- maintainVisibleContentPosition && /* @__PURE__ */ React3.createElement(ScrollAdjust, null),
1152
+ /* @__PURE__ */ React3.createElement(ScrollAdjust, null),
1131
1153
  ENABLE_DEVMODE ? /* @__PURE__ */ React3.createElement(PaddingDevMode, null) : /* @__PURE__ */ React3.createElement(Padding, null),
1132
1154
  ListHeaderComponent && /* @__PURE__ */ React3.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
1133
1155
  ListEmptyComponent && getComponent(ListEmptyComponent),
@@ -1318,6 +1340,67 @@ function calculateOffsetWithOffsetPosition(ctx, state, offsetParam, params) {
1318
1340
  return offset;
1319
1341
  }
1320
1342
 
1343
+ // src/core/finishScrollTo.ts
1344
+ function finishScrollTo(ctx, state) {
1345
+ var _a3, _b;
1346
+ if (state) {
1347
+ state.scrollHistory.length = 0;
1348
+ state.initialScroll = void 0;
1349
+ state.initialAnchor = void 0;
1350
+ set$(ctx, "scrollingTo", void 0);
1351
+ if (state.pendingTotalSize !== void 0) {
1352
+ addTotalSize(ctx, state, null, state.pendingTotalSize);
1353
+ }
1354
+ if ((_a3 = state.props) == null ? void 0 : _a3.data) {
1355
+ (_b = state.triggerCalculateItemsInView) == null ? void 0 : _b.call(state, { forceFullItemPositions: true });
1356
+ }
1357
+ }
1358
+ }
1359
+
1360
+ // src/core/scrollTo.ts
1361
+ function scrollTo(ctx, state, params) {
1362
+ var _a3;
1363
+ const { noScrollingTo, ...scrollTarget } = params;
1364
+ const { animated, isInitialScroll, offset: scrollTargetOffset, precomputedWithViewOffset } = scrollTarget;
1365
+ const {
1366
+ refScroller,
1367
+ props: { horizontal }
1368
+ } = state;
1369
+ let offset = precomputedWithViewOffset ? scrollTargetOffset : calculateOffsetWithOffsetPosition(ctx, state, scrollTargetOffset, scrollTarget);
1370
+ if (Number.isFinite(state.scrollLength) && Number.isFinite(state.totalSize)) {
1371
+ const maxOffset = Math.max(0, getContentSize(ctx) - state.scrollLength);
1372
+ offset = Math.min(offset, maxOffset);
1373
+ }
1374
+ state.scrollHistory.length = 0;
1375
+ if (!noScrollingTo) {
1376
+ set$(ctx, "scrollingTo", scrollTarget);
1377
+ }
1378
+ state.scrollPending = offset;
1379
+ if (!isInitialScroll || Platform.OS === "android") {
1380
+ (_a3 = refScroller.current) == null ? void 0 : _a3.scrollTo({
1381
+ animated: !!animated,
1382
+ x: horizontal ? offset : 0,
1383
+ y: horizontal ? 0 : offset
1384
+ });
1385
+ }
1386
+ if (!animated) {
1387
+ state.scroll = offset;
1388
+ {
1389
+ const unlisten = listen$(ctx, "containersDidLayout", (value) => {
1390
+ if (value && peek$(ctx, "scrollingTo")) {
1391
+ finishScrollTo(ctx, state);
1392
+ unlisten();
1393
+ }
1394
+ });
1395
+ }
1396
+ if (isInitialScroll) {
1397
+ setTimeout(() => {
1398
+ state.initialScroll = void 0;
1399
+ }, 500);
1400
+ }
1401
+ }
1402
+ }
1403
+
1321
1404
  // src/utils/checkThreshold.ts
1322
1405
  var HYSTERESIS_MULTIPLIER = 1.3;
1323
1406
  var checkThreshold = (distance, atThreshold, threshold, wasReached, snapshot, context, onReached, setSnapshot) => {
@@ -1428,24 +1511,7 @@ function checkAtTop(state) {
1428
1511
  );
1429
1512
  }
1430
1513
 
1431
- // src/core/onScroll.ts
1432
- function onScroll(ctx, state, event) {
1433
- var _a3, _b, _c;
1434
- const {
1435
- scrollProcessingEnabled,
1436
- props: { onScroll: onScrollProp }
1437
- } = state;
1438
- if (scrollProcessingEnabled === false) {
1439
- return;
1440
- }
1441
- 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) {
1442
- return;
1443
- }
1444
- const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
1445
- state.scrollPending = newScroll;
1446
- updateScroll(ctx, state, newScroll);
1447
- onScrollProp == null ? void 0 : onScrollProp(event);
1448
- }
1514
+ // src/core/updateScroll.ts
1449
1515
  function updateScroll(ctx, state, newScroll, forceUpdate) {
1450
1516
  var _a3;
1451
1517
  const scrollingTo = peek$(ctx, "scrollingTo");
@@ -1488,73 +1554,15 @@ function updateScroll(ctx, state, newScroll, forceUpdate) {
1488
1554
  }
1489
1555
  }
1490
1556
 
1491
- // src/core/finishScrollTo.ts
1492
- function finishScrollTo(ctx, state) {
1493
- var _a3, _b;
1494
- if (state) {
1495
- state.scrollHistory.length = 0;
1496
- state.initialScroll = void 0;
1497
- state.initialAnchor = void 0;
1498
- set$(ctx, "scrollingTo", void 0);
1499
- if (state.pendingTotalSize !== void 0) {
1500
- addTotalSize(ctx, state, null, state.pendingTotalSize);
1501
- }
1502
- if ((_a3 = state.props) == null ? void 0 : _a3.data) {
1503
- (_b = state.triggerCalculateItemsInView) == null ? void 0 : _b.call(state, { forceFullItemPositions: true });
1504
- }
1505
- }
1506
- }
1507
-
1508
- // src/core/scrollTo.ts
1509
- function scrollTo(ctx, state, params) {
1510
- var _a3;
1511
- const { noScrollingTo, ...scrollTarget } = params;
1512
- const { animated, isInitialScroll, offset: scrollTargetOffset, precomputedWithViewOffset } = scrollTarget;
1513
- const {
1514
- refScroller,
1515
- props: { horizontal }
1516
- } = state;
1517
- let offset = precomputedWithViewOffset ? scrollTargetOffset : calculateOffsetWithOffsetPosition(ctx, state, scrollTargetOffset, scrollTarget);
1518
- if (Number.isFinite(state.scrollLength) && Number.isFinite(state.totalSize)) {
1519
- const maxOffset = Math.max(0, getContentSize(ctx) - state.scrollLength);
1520
- offset = Math.min(offset, maxOffset);
1521
- }
1522
- state.scrollHistory.length = 0;
1523
- if (!noScrollingTo) {
1524
- set$(ctx, "scrollingTo", scrollTarget);
1525
- }
1526
- state.scrollPending = offset;
1527
- if (!isInitialScroll || Platform.OS === "android") {
1528
- (_a3 = refScroller.current) == null ? void 0 : _a3.scrollTo({
1529
- animated: !!animated,
1530
- x: horizontal ? offset : 0,
1531
- y: horizontal ? 0 : offset
1532
- });
1533
- }
1534
- if (!animated) {
1535
- state.scroll = offset;
1536
- {
1537
- const unlisten = listen$(ctx, "containersDidLayout", (value) => {
1538
- if (value) {
1539
- finishScrollTo(ctx, state);
1540
- unlisten();
1541
- }
1542
- });
1543
- }
1544
- if (isInitialScroll) {
1545
- setTimeout(() => {
1546
- state.initialScroll = void 0;
1547
- }, 500);
1548
- }
1549
- }
1550
- }
1551
-
1552
1557
  // src/utils/requestAdjust.ts
1553
1558
  function requestAdjust(ctx, state, positionDiff, dataChanged) {
1554
1559
  if (Math.abs(positionDiff) > 0.1) {
1555
1560
  const doit = () => {
1556
1561
  {
1557
1562
  state.scrollAdjustHandler.requestAdjust(positionDiff);
1563
+ if (state.adjustingFromInitialMount) {
1564
+ state.adjustingFromInitialMount--;
1565
+ }
1558
1566
  }
1559
1567
  };
1560
1568
  state.scroll += positionDiff;
@@ -1563,6 +1571,7 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
1563
1571
  if (didLayout) {
1564
1572
  doit();
1565
1573
  } else {
1574
+ state.adjustingFromInitialMount = (state.adjustingFromInitialMount || 0) + 1;
1566
1575
  requestAnimationFrame(doit);
1567
1576
  }
1568
1577
  }
@@ -1622,18 +1631,16 @@ function ensureInitialAnchor(ctx, state) {
1622
1631
 
1623
1632
  // src/core/mvcp.ts
1624
1633
  function prepareMVCP(ctx, state, dataChanged) {
1625
- const {
1626
- idsInView,
1627
- positions,
1628
- props: { maintainVisibleContentPosition }
1629
- } = state;
1634
+ const { idsInView, positions, props } = state;
1635
+ const { maintainVisibleContentPosition } = props;
1630
1636
  const scrollingTo = peek$(ctx, "scrollingTo");
1631
1637
  let prevPosition;
1632
1638
  let targetId;
1633
1639
  const idsInViewWithPositions = [];
1634
1640
  const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
1635
- if (maintainVisibleContentPosition) {
1636
- const indexByKey = state.indexByKey;
1641
+ const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
1642
+ const indexByKey = state.indexByKey;
1643
+ if (shouldMVCP) {
1637
1644
  if (scrollTarget !== void 0) {
1638
1645
  targetId = getId(state, scrollTarget);
1639
1646
  } else if (idsInView.length > 0 && peek$(ctx, "containersDidLayout")) {
@@ -1646,44 +1653,44 @@ function prepareMVCP(ctx, state, dataChanged) {
1646
1653
  }
1647
1654
  }
1648
1655
  } else {
1649
- targetId = state.idsInView.find((id) => indexByKey.get(id) !== void 0);
1656
+ targetId = idsInView.find((id) => indexByKey.get(id) !== void 0);
1650
1657
  }
1651
1658
  }
1652
1659
  if (targetId !== void 0) {
1653
1660
  prevPosition = positions.get(targetId);
1654
1661
  }
1655
- }
1656
- return () => {
1657
- let positionDiff;
1658
- if (dataChanged && targetId === void 0) {
1659
- for (let i = 0; i < idsInViewWithPositions.length; i++) {
1660
- const { id, position } = idsInViewWithPositions[i];
1661
- const newPosition = positions.get(id);
1662
- if (newPosition !== void 0) {
1663
- positionDiff = newPosition - position;
1664
- break;
1662
+ return () => {
1663
+ let positionDiff;
1664
+ if (dataChanged && targetId === void 0 && maintainVisibleContentPosition) {
1665
+ for (let i = 0; i < idsInViewWithPositions.length; i++) {
1666
+ const { id, position } = idsInViewWithPositions[i];
1667
+ const newPosition = positions.get(id);
1668
+ if (newPosition !== void 0) {
1669
+ positionDiff = newPosition - position;
1670
+ break;
1671
+ }
1665
1672
  }
1666
1673
  }
1667
- }
1668
- if (targetId !== void 0 && prevPosition !== void 0) {
1669
- const newPosition = positions.get(targetId);
1670
- if (newPosition !== void 0) {
1671
- const totalSize = getContentSize(ctx);
1672
- let diff = newPosition - prevPosition;
1673
- if (diff !== 0 && state.scroll + state.scrollLength > totalSize) {
1674
- if (diff > 0) {
1675
- diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
1676
- } else {
1677
- diff = 0;
1674
+ if (targetId !== void 0 && prevPosition !== void 0) {
1675
+ const newPosition = positions.get(targetId);
1676
+ if (newPosition !== void 0) {
1677
+ const totalSize = getContentSize(ctx);
1678
+ let diff = newPosition - prevPosition;
1679
+ if (diff !== 0 && state.scroll + state.scrollLength > totalSize) {
1680
+ if (diff > 0) {
1681
+ diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
1682
+ } else {
1683
+ diff = 0;
1684
+ }
1678
1685
  }
1686
+ positionDiff = diff;
1679
1687
  }
1680
- positionDiff = diff;
1681
1688
  }
1682
- }
1683
- if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
1684
- requestAdjust(ctx, state, positionDiff);
1685
- }
1686
- };
1689
+ if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
1690
+ requestAdjust(ctx, state, positionDiff);
1691
+ }
1692
+ };
1693
+ }
1687
1694
  }
1688
1695
 
1689
1696
  // src/core/prepareColumnStartState.ts
@@ -1825,7 +1832,8 @@ function updateSnapToOffsets(ctx, state) {
1825
1832
  }
1826
1833
 
1827
1834
  // src/core/updateItemPositions.ts
1828
- function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false } = {
1835
+ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false, doMVCP } = {
1836
+ doMVCP: false,
1829
1837
  forceFullUpdate: false,
1830
1838
  scrollBottomBuffered: -1,
1831
1839
  startIndex: 0
@@ -1837,7 +1845,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1837
1845
  positions,
1838
1846
  idCache,
1839
1847
  sizesKnown,
1840
- props: { getEstimatedItemSize, snapToIndices, enableAverages, maintainVisibleContentPosition }
1848
+ props: { getEstimatedItemSize, snapToIndices, enableAverages }
1841
1849
  } = state;
1842
1850
  const data = state.props.data;
1843
1851
  const dataLength = data.length;
@@ -1848,7 +1856,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1848
1856
  const shouldOptimize = !forceFullUpdate && !dataChanged && Math.abs(getScrollVelocity(state)) > 0;
1849
1857
  const maxVisibleArea = scrollBottomBuffered + 1e3;
1850
1858
  const useAverageSize = enableAverages && !getEstimatedItemSize;
1851
- const preferCachedSize = maintainVisibleContentPosition && (dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0);
1859
+ const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0;
1852
1860
  let currentRowTop = 0;
1853
1861
  let column = 1;
1854
1862
  let maxSizeInRow = 0;
@@ -2303,14 +2311,14 @@ function findCurrentStickyIndex(stickyArray, scroll, state) {
2303
2311
  }
2304
2312
  return -1;
2305
2313
  }
2306
- function getActiveStickyIndices(ctx, state, stickyIndices) {
2314
+ function getActiveStickyIndices(ctx, state, stickyHeaderIndices) {
2307
2315
  return new Set(
2308
- Array.from(state.stickyContainerPool).map((i) => peek$(ctx, `containerItemKey${i}`)).map((key) => key ? state.indexByKey.get(key) : void 0).filter((idx) => idx !== void 0 && stickyIndices.has(idx))
2316
+ 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))
2309
2317
  );
2310
2318
  }
2311
- function handleStickyActivation(ctx, state, stickyIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
2319
+ function handleStickyActivation(ctx, state, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
2312
2320
  var _a3;
2313
- const activeIndices = getActiveStickyIndices(ctx, state, stickyIndices);
2321
+ const activeIndices = getActiveStickyIndices(ctx, state, stickyHeaderIndices);
2314
2322
  state.activeStickyIndex = currentStickyIdx >= 0 ? stickyArray[currentStickyIdx] : void 0;
2315
2323
  for (let offset = 0; offset <= 1; offset++) {
2316
2324
  const idx = currentStickyIdx - offset;
@@ -2446,6 +2454,7 @@ function calculateItemsInView(ctx, state, params = {}) {
2446
2454
  }
2447
2455
  const startIndex = dataChanged ? 0 : (_b = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _b : 0;
2448
2456
  updateItemPositions(ctx, state, dataChanged, {
2457
+ doMVCP,
2449
2458
  forceFullUpdate: !!forceFullItemPositions,
2450
2459
  scrollBottomBuffered,
2451
2460
  startIndex
@@ -2740,6 +2749,7 @@ function doMaintainScrollAtEnd(ctx, state, animated) {
2740
2749
  });
2741
2750
  return true;
2742
2751
  }
2752
+ return false;
2743
2753
  }
2744
2754
 
2745
2755
  // src/utils/updateAveragesOnDataChange.ts
@@ -2908,6 +2918,25 @@ function handleLayout(ctx, state, layout, setCanRender) {
2908
2918
  setCanRender(true);
2909
2919
  }
2910
2920
 
2921
+ // src/core/onScroll.ts
2922
+ function onScroll(ctx, state, event) {
2923
+ var _a3, _b, _c;
2924
+ const {
2925
+ scrollProcessingEnabled,
2926
+ props: { onScroll: onScrollProp }
2927
+ } = state;
2928
+ if (scrollProcessingEnabled === false) {
2929
+ return;
2930
+ }
2931
+ 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) {
2932
+ return;
2933
+ }
2934
+ const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
2935
+ state.scrollPending = newScroll;
2936
+ updateScroll(ctx, state, newScroll);
2937
+ onScrollProp == null ? void 0 : onScrollProp(event);
2938
+ }
2939
+
2911
2940
  // src/core/ScrollAdjustHandler.ts
2912
2941
  var ScrollAdjustHandler = class {
2913
2942
  constructor(ctx) {
@@ -2943,12 +2972,7 @@ var ScrollAdjustHandler = class {
2943
2972
  set$(this.context, "scrollAdjustPending", this.pendingAdjust);
2944
2973
  } else {
2945
2974
  this.appliedAdjust += add;
2946
- const setter = () => set$(this.context, "scrollAdjust", this.appliedAdjust);
2947
- if (this.mounted) {
2948
- setter();
2949
- } else {
2950
- requestAnimationFrame(setter);
2951
- }
2975
+ set$(this.context, "scrollAdjust", this.appliedAdjust);
2952
2976
  }
2953
2977
  }
2954
2978
  setMounted() {
@@ -3109,7 +3133,7 @@ function RefreshControl(_props) {
3109
3133
  }
3110
3134
 
3111
3135
  // src/platform/useStickyScrollHandler.ts
3112
- function useStickyScrollHandler(_stickyIndices, _horizontal, _ctx, onScroll2) {
3136
+ function useStickyScrollHandler(_stickyHeaderIndices, _horizontal, _ctx, onScroll2) {
3113
3137
  return onScroll2;
3114
3138
  }
3115
3139
 
@@ -3332,7 +3356,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3332
3356
  ListHeaderComponent,
3333
3357
  maintainScrollAtEnd = false,
3334
3358
  maintainScrollAtEndThreshold = 0.1,
3335
- maintainVisibleContentPosition = true,
3359
+ maintainVisibleContentPosition = false,
3336
3360
  numColumns: numColumnsProp = 1,
3337
3361
  onEndReached,
3338
3362
  onEndReachedThreshold = 0.5,
@@ -3354,7 +3378,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3354
3378
  renderItem,
3355
3379
  scrollEventThrottle,
3356
3380
  snapToIndices,
3357
- stickyIndices,
3381
+ stickyHeaderIndices: stickyHeaderIndicesProp,
3382
+ stickyIndices: stickyIndicesDeprecated,
3358
3383
  style: styleProp,
3359
3384
  suggestEstimatedItemSize,
3360
3385
  viewabilityConfig,
@@ -3376,6 +3401,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3376
3401
  const estimatedItemSize = estimatedItemSizeProp != null ? estimatedItemSizeProp : DEFAULT_ITEM_SIZE;
3377
3402
  const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
3378
3403
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : (_item, index) => index.toString();
3404
+ const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
3405
+ if (IS_DEV && stickyIndicesDeprecated && !stickyHeaderIndicesProp) {
3406
+ warnDevOnce(
3407
+ "stickyIndices",
3408
+ "stickyIndices has been renamed to stickyHeaderIndices. Please update your props to use stickyHeaderIndices."
3409
+ );
3410
+ }
3379
3411
  const refState = useRef();
3380
3412
  if (!refState.current) {
3381
3413
  if (!ctx.internalState) {
@@ -3487,8 +3519,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3487
3519
  renderItem,
3488
3520
  scrollBuffer,
3489
3521
  snapToIndices,
3490
- stickyIndicesArr: stickyIndices != null ? stickyIndices : [],
3491
- stickyIndicesSet: useMemo(() => new Set(stickyIndices != null ? stickyIndices : []), [stickyIndices == null ? void 0 : stickyIndices.join(",")]),
3522
+ stickyIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],
3523
+ stickyIndicesSet: useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),
3492
3524
  stylePaddingBottom: stylePaddingBottomState,
3493
3525
  stylePaddingTop: stylePaddingTopState,
3494
3526
  suggestEstimatedItemSize: !!suggestEstimatedItemSize
@@ -3508,7 +3540,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3508
3540
  setPaddingTop(ctx, state, { stylePaddingTop: stylePaddingTopState });
3509
3541
  refState.current.props.stylePaddingBottom = stylePaddingBottomState;
3510
3542
  let paddingDiff = stylePaddingTopState - prevPaddingTop;
3511
- if (maintainVisibleContentPosition && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3543
+ if (paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3512
3544
  if (state.scroll < 0) {
3513
3545
  paddingDiff += state.scroll;
3514
3546
  }
@@ -3556,7 +3588,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3556
3588
  state.initialScroll = updatedInitialScroll;
3557
3589
  refState.current.isStartReached = clampedOffset < refState.current.scrollLength * onStartReachedThreshold;
3558
3590
  return clampedOffset;
3559
- }, [renderNum, state.initialScroll]);
3591
+ }, [renderNum]);
3560
3592
  if (isFirstLocal || didDataChangeLocal || numColumnsProp !== peek$(ctx, "numColumns")) {
3561
3593
  refState.current.lastBatchingAction = Date.now();
3562
3594
  if (!keyExtractorProp && !isFirstLocal && didDataChangeLocal) {
@@ -3594,7 +3626,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3594
3626
  precomputedWithViewOffset: true
3595
3627
  });
3596
3628
  }
3597
- }, [initialContentOffset, state.initialScroll]);
3629
+ }, [initialContentOffset]);
3598
3630
  const onLayoutChange = useCallback((layout) => {
3599
3631
  doInitialScroll();
3600
3632
  handleLayout(ctx, state, layout, setCanRender);
@@ -3656,7 +3688,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3656
3688
  }),
3657
3689
  []
3658
3690
  );
3659
- const onScrollHandler = useStickyScrollHandler(stickyIndices, horizontal, ctx, fns.onScroll);
3691
+ const onScrollHandler = useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, fns.onScroll);
3660
3692
  return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
3661
3693
  ListComponent,
3662
3694
  {
@@ -3698,7 +3730,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3698
3730
  scrollAdjustHandler: (_b = refState.current) == null ? void 0 : _b.scrollAdjustHandler,
3699
3731
  scrollEventThrottle: 16 ,
3700
3732
  snapToIndices,
3701
- stickyIndices,
3733
+ stickyHeaderIndices,
3702
3734
  style,
3703
3735
  updateItemSize: fns.updateItemSize,
3704
3736
  waitForInitialLayout