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

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,17 +483,13 @@ function useOnLayoutSync({
483
483
  };
484
484
  const rect = element.getBoundingClientRect();
485
485
  emit(toLayout(rect), true);
486
- let prevRect = rect;
487
486
  return createResizeObserver(element, (entry) => {
488
487
  var _a4;
489
488
  const target = entry.target instanceof HTMLElement ? entry.target : void 0;
490
489
  const rect2 = (_a4 = entry.contentRect) != null ? _a4 : target == null ? void 0 : target.getBoundingClientRect();
491
- if (rect2.width !== prevRect.width || rect2.height !== prevRect.height) {
492
- prevRect = rect2;
493
- emit(toLayout(rect2), false);
494
- }
490
+ emit(toLayout(rect2), false);
495
491
  });
496
- }, deps || []);
492
+ }, deps);
497
493
  return {};
498
494
  }
499
495
  function toLayout(rect) {
@@ -1041,26 +1037,8 @@ function ScrollAdjust() {
1041
1037
  if (scrollView && scrollOffset !== lastScrollOffsetRef.current) {
1042
1038
  const scrollDelta = scrollOffset - lastScrollOffsetRef.current;
1043
1039
  if (scrollDelta !== 0) {
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
- }
1040
+ scrollView.scrollBy(0, scrollDelta);
1041
+ console.log("ScrollAdjust (web scrollBy)", scrollDelta, "total offset:", scrollOffset);
1064
1042
  }
1065
1043
  lastScrollOffsetRef.current = scrollOffset;
1066
1044
  }
@@ -1114,7 +1092,7 @@ var ListComponent = typedMemo(function ListComponent2({
1114
1092
  scrollAdjustHandler,
1115
1093
  onLayoutHeader,
1116
1094
  snapToIndices,
1117
- stickyHeaderIndices,
1095
+ stickyIndices,
1118
1096
  ...rest
1119
1097
  }) {
1120
1098
  const ctx = useStateContext();
@@ -1149,7 +1127,7 @@ var ListComponent = typedMemo(function ListComponent2({
1149
1127
  ScrollComponent: snapToIndices ? ScrollComponent : void 0,
1150
1128
  style
1151
1129
  },
1152
- /* @__PURE__ */ React3.createElement(ScrollAdjust, null),
1130
+ maintainVisibleContentPosition && /* @__PURE__ */ React3.createElement(ScrollAdjust, null),
1153
1131
  ENABLE_DEVMODE ? /* @__PURE__ */ React3.createElement(PaddingDevMode, null) : /* @__PURE__ */ React3.createElement(Padding, null),
1154
1132
  ListHeaderComponent && /* @__PURE__ */ React3.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
1155
1133
  ListEmptyComponent && getComponent(ListEmptyComponent),
@@ -1340,67 +1318,6 @@ function calculateOffsetWithOffsetPosition(ctx, state, offsetParam, params) {
1340
1318
  return offset;
1341
1319
  }
1342
1320
 
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
-
1404
1321
  // src/utils/checkThreshold.ts
1405
1322
  var HYSTERESIS_MULTIPLIER = 1.3;
1406
1323
  var checkThreshold = (distance, atThreshold, threshold, wasReached, snapshot, context, onReached, setSnapshot) => {
@@ -1511,7 +1428,24 @@ function checkAtTop(state) {
1511
1428
  );
1512
1429
  }
1513
1430
 
1514
- // src/core/updateScroll.ts
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
+ }
1515
1449
  function updateScroll(ctx, state, newScroll, forceUpdate) {
1516
1450
  var _a3;
1517
1451
  const scrollingTo = peek$(ctx, "scrollingTo");
@@ -1554,15 +1488,73 @@ function updateScroll(ctx, state, newScroll, forceUpdate) {
1554
1488
  }
1555
1489
  }
1556
1490
 
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
+
1557
1552
  // src/utils/requestAdjust.ts
1558
1553
  function requestAdjust(ctx, state, positionDiff, dataChanged) {
1559
1554
  if (Math.abs(positionDiff) > 0.1) {
1560
1555
  const doit = () => {
1561
1556
  {
1562
1557
  state.scrollAdjustHandler.requestAdjust(positionDiff);
1563
- if (state.adjustingFromInitialMount) {
1564
- state.adjustingFromInitialMount--;
1565
- }
1566
1558
  }
1567
1559
  };
1568
1560
  state.scroll += positionDiff;
@@ -1571,7 +1563,6 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
1571
1563
  if (didLayout) {
1572
1564
  doit();
1573
1565
  } else {
1574
- state.adjustingFromInitialMount = (state.adjustingFromInitialMount || 0) + 1;
1575
1566
  requestAnimationFrame(doit);
1576
1567
  }
1577
1568
  }
@@ -1631,16 +1622,18 @@ function ensureInitialAnchor(ctx, state) {
1631
1622
 
1632
1623
  // src/core/mvcp.ts
1633
1624
  function prepareMVCP(ctx, state, dataChanged) {
1634
- const { idsInView, positions, props } = state;
1635
- const { maintainVisibleContentPosition } = props;
1625
+ const {
1626
+ idsInView,
1627
+ positions,
1628
+ props: { maintainVisibleContentPosition }
1629
+ } = state;
1636
1630
  const scrollingTo = peek$(ctx, "scrollingTo");
1637
1631
  let prevPosition;
1638
1632
  let targetId;
1639
1633
  const idsInViewWithPositions = [];
1640
1634
  const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
1641
- const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
1642
- const indexByKey = state.indexByKey;
1643
- if (shouldMVCP) {
1635
+ if (maintainVisibleContentPosition) {
1636
+ const indexByKey = state.indexByKey;
1644
1637
  if (scrollTarget !== void 0) {
1645
1638
  targetId = getId(state, scrollTarget);
1646
1639
  } else if (idsInView.length > 0 && peek$(ctx, "containersDidLayout")) {
@@ -1653,44 +1646,44 @@ function prepareMVCP(ctx, state, dataChanged) {
1653
1646
  }
1654
1647
  }
1655
1648
  } else {
1656
- targetId = idsInView.find((id) => indexByKey.get(id) !== void 0);
1649
+ targetId = state.idsInView.find((id) => indexByKey.get(id) !== void 0);
1657
1650
  }
1658
1651
  }
1659
1652
  if (targetId !== void 0) {
1660
1653
  prevPosition = positions.get(targetId);
1661
1654
  }
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
- }
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;
1672
1665
  }
1673
1666
  }
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
- }
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;
1685
1678
  }
1686
- positionDiff = diff;
1687
1679
  }
1680
+ positionDiff = diff;
1688
1681
  }
1689
- if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
1690
- requestAdjust(ctx, state, positionDiff);
1691
- }
1692
- };
1693
- }
1682
+ }
1683
+ if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
1684
+ requestAdjust(ctx, state, positionDiff);
1685
+ }
1686
+ };
1694
1687
  }
1695
1688
 
1696
1689
  // src/core/prepareColumnStartState.ts
@@ -1832,8 +1825,7 @@ function updateSnapToOffsets(ctx, state) {
1832
1825
  }
1833
1826
 
1834
1827
  // src/core/updateItemPositions.ts
1835
- function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false, doMVCP } = {
1836
- doMVCP: false,
1828
+ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false } = {
1837
1829
  forceFullUpdate: false,
1838
1830
  scrollBottomBuffered: -1,
1839
1831
  startIndex: 0
@@ -1845,7 +1837,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1845
1837
  positions,
1846
1838
  idCache,
1847
1839
  sizesKnown,
1848
- props: { getEstimatedItemSize, snapToIndices, enableAverages }
1840
+ props: { getEstimatedItemSize, snapToIndices, enableAverages, maintainVisibleContentPosition }
1849
1841
  } = state;
1850
1842
  const data = state.props.data;
1851
1843
  const dataLength = data.length;
@@ -1856,7 +1848,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1856
1848
  const shouldOptimize = !forceFullUpdate && !dataChanged && Math.abs(getScrollVelocity(state)) > 0;
1857
1849
  const maxVisibleArea = scrollBottomBuffered + 1e3;
1858
1850
  const useAverageSize = enableAverages && !getEstimatedItemSize;
1859
- const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0;
1851
+ const preferCachedSize = maintainVisibleContentPosition && (dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0);
1860
1852
  let currentRowTop = 0;
1861
1853
  let column = 1;
1862
1854
  let maxSizeInRow = 0;
@@ -2311,14 +2303,14 @@ function findCurrentStickyIndex(stickyArray, scroll, state) {
2311
2303
  }
2312
2304
  return -1;
2313
2305
  }
2314
- function getActiveStickyIndices(ctx, state, stickyHeaderIndices) {
2306
+ function getActiveStickyIndices(ctx, state, stickyIndices) {
2315
2307
  return new Set(
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))
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))
2317
2309
  );
2318
2310
  }
2319
- function handleStickyActivation(ctx, state, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
2311
+ function handleStickyActivation(ctx, state, stickyIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
2320
2312
  var _a3;
2321
- const activeIndices = getActiveStickyIndices(ctx, state, stickyHeaderIndices);
2313
+ const activeIndices = getActiveStickyIndices(ctx, state, stickyIndices);
2322
2314
  state.activeStickyIndex = currentStickyIdx >= 0 ? stickyArray[currentStickyIdx] : void 0;
2323
2315
  for (let offset = 0; offset <= 1; offset++) {
2324
2316
  const idx = currentStickyIdx - offset;
@@ -2454,7 +2446,6 @@ function calculateItemsInView(ctx, state, params = {}) {
2454
2446
  }
2455
2447
  const startIndex = dataChanged ? 0 : (_b = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _b : 0;
2456
2448
  updateItemPositions(ctx, state, dataChanged, {
2457
- doMVCP,
2458
2449
  forceFullUpdate: !!forceFullItemPositions,
2459
2450
  scrollBottomBuffered,
2460
2451
  startIndex
@@ -2749,7 +2740,6 @@ function doMaintainScrollAtEnd(ctx, state, animated) {
2749
2740
  });
2750
2741
  return true;
2751
2742
  }
2752
- return false;
2753
2743
  }
2754
2744
 
2755
2745
  // src/utils/updateAveragesOnDataChange.ts
@@ -2918,25 +2908,6 @@ function handleLayout(ctx, state, layout, setCanRender) {
2918
2908
  setCanRender(true);
2919
2909
  }
2920
2910
 
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
-
2940
2911
  // src/core/ScrollAdjustHandler.ts
2941
2912
  var ScrollAdjustHandler = class {
2942
2913
  constructor(ctx) {
@@ -2972,7 +2943,12 @@ var ScrollAdjustHandler = class {
2972
2943
  set$(this.context, "scrollAdjustPending", this.pendingAdjust);
2973
2944
  } else {
2974
2945
  this.appliedAdjust += add;
2975
- set$(this.context, "scrollAdjust", this.appliedAdjust);
2946
+ const setter = () => set$(this.context, "scrollAdjust", this.appliedAdjust);
2947
+ if (this.mounted) {
2948
+ setter();
2949
+ } else {
2950
+ requestAnimationFrame(setter);
2951
+ }
2976
2952
  }
2977
2953
  }
2978
2954
  setMounted() {
@@ -3133,7 +3109,7 @@ function RefreshControl(_props) {
3133
3109
  }
3134
3110
 
3135
3111
  // src/platform/useStickyScrollHandler.ts
3136
- function useStickyScrollHandler(_stickyHeaderIndices, _horizontal, _ctx, onScroll2) {
3112
+ function useStickyScrollHandler(_stickyIndices, _horizontal, _ctx, onScroll2) {
3137
3113
  return onScroll2;
3138
3114
  }
3139
3115
 
@@ -3356,7 +3332,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3356
3332
  ListHeaderComponent,
3357
3333
  maintainScrollAtEnd = false,
3358
3334
  maintainScrollAtEndThreshold = 0.1,
3359
- maintainVisibleContentPosition = false,
3335
+ maintainVisibleContentPosition = true,
3360
3336
  numColumns: numColumnsProp = 1,
3361
3337
  onEndReached,
3362
3338
  onEndReachedThreshold = 0.5,
@@ -3378,8 +3354,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3378
3354
  renderItem,
3379
3355
  scrollEventThrottle,
3380
3356
  snapToIndices,
3381
- stickyHeaderIndices: stickyHeaderIndicesProp,
3382
- stickyIndices: stickyIndicesDeprecated,
3357
+ stickyIndices,
3383
3358
  style: styleProp,
3384
3359
  suggestEstimatedItemSize,
3385
3360
  viewabilityConfig,
@@ -3401,13 +3376,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3401
3376
  const estimatedItemSize = estimatedItemSizeProp != null ? estimatedItemSizeProp : DEFAULT_ITEM_SIZE;
3402
3377
  const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
3403
3378
  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
- }
3411
3379
  const refState = useRef();
3412
3380
  if (!refState.current) {
3413
3381
  if (!ctx.internalState) {
@@ -3519,8 +3487,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3519
3487
  renderItem,
3520
3488
  scrollBuffer,
3521
3489
  snapToIndices,
3522
- stickyIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],
3523
- stickyIndicesSet: useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),
3490
+ stickyIndicesArr: stickyIndices != null ? stickyIndices : [],
3491
+ stickyIndicesSet: useMemo(() => new Set(stickyIndices != null ? stickyIndices : []), [stickyIndices == null ? void 0 : stickyIndices.join(",")]),
3524
3492
  stylePaddingBottom: stylePaddingBottomState,
3525
3493
  stylePaddingTop: stylePaddingTopState,
3526
3494
  suggestEstimatedItemSize: !!suggestEstimatedItemSize
@@ -3540,7 +3508,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3540
3508
  setPaddingTop(ctx, state, { stylePaddingTop: stylePaddingTopState });
3541
3509
  refState.current.props.stylePaddingBottom = stylePaddingBottomState;
3542
3510
  let paddingDiff = stylePaddingTopState - prevPaddingTop;
3543
- if (paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3511
+ if (maintainVisibleContentPosition && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
3544
3512
  if (state.scroll < 0) {
3545
3513
  paddingDiff += state.scroll;
3546
3514
  }
@@ -3588,7 +3556,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3588
3556
  state.initialScroll = updatedInitialScroll;
3589
3557
  refState.current.isStartReached = clampedOffset < refState.current.scrollLength * onStartReachedThreshold;
3590
3558
  return clampedOffset;
3591
- }, [renderNum]);
3559
+ }, [renderNum, state.initialScroll]);
3592
3560
  if (isFirstLocal || didDataChangeLocal || numColumnsProp !== peek$(ctx, "numColumns")) {
3593
3561
  refState.current.lastBatchingAction = Date.now();
3594
3562
  if (!keyExtractorProp && !isFirstLocal && didDataChangeLocal) {
@@ -3626,7 +3594,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3626
3594
  precomputedWithViewOffset: true
3627
3595
  });
3628
3596
  }
3629
- }, [initialContentOffset]);
3597
+ }, [initialContentOffset, state.initialScroll]);
3630
3598
  const onLayoutChange = useCallback((layout) => {
3631
3599
  doInitialScroll();
3632
3600
  handleLayout(ctx, state, layout, setCanRender);
@@ -3688,7 +3656,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3688
3656
  }),
3689
3657
  []
3690
3658
  );
3691
- const onScrollHandler = useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, fns.onScroll);
3659
+ const onScrollHandler = useStickyScrollHandler(stickyIndices, horizontal, ctx, fns.onScroll);
3692
3660
  return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
3693
3661
  ListComponent,
3694
3662
  {
@@ -3730,7 +3698,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3730
3698
  scrollAdjustHandler: (_b = refState.current) == null ? void 0 : _b.scrollAdjustHandler,
3731
3699
  scrollEventThrottle: 16 ,
3732
3700
  snapToIndices,
3733
- stickyHeaderIndices,
3701
+ stickyIndices,
3734
3702
  style,
3735
3703
  updateItemSize: fns.updateItemSize,
3736
3704
  waitForInitialLayout