@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.native.js CHANGED
@@ -832,7 +832,7 @@ var ListComponent = typedMemo(function ListComponent2({
832
832
  scrollAdjustHandler,
833
833
  onLayoutHeader,
834
834
  snapToIndices,
835
- stickyHeaderIndices,
835
+ stickyIndices,
836
836
  ...rest
837
837
  }) {
838
838
  const ctx = useStateContext();
@@ -867,7 +867,7 @@ var ListComponent = typedMemo(function ListComponent2({
867
867
  ScrollComponent: snapToIndices ? ScrollComponent : void 0,
868
868
  style
869
869
  },
870
- /* @__PURE__ */ React2__namespace.createElement(ScrollAdjust, null),
870
+ maintainVisibleContentPosition && /* @__PURE__ */ React2__namespace.createElement(ScrollAdjust, null),
871
871
  ENABLE_DEVMODE ? /* @__PURE__ */ React2__namespace.createElement(PaddingDevMode, null) : /* @__PURE__ */ React2__namespace.createElement(Padding, null),
872
872
  ListHeaderComponent && /* @__PURE__ */ React2__namespace.createElement(LayoutView, { onLayoutChange: onLayoutHeader, style: ListHeaderComponentStyle }, getComponent(ListHeaderComponent)),
873
873
  ListEmptyComponent && getComponent(ListEmptyComponent),
@@ -1060,70 +1060,6 @@ function calculateOffsetWithOffsetPosition(ctx, state, offsetParam, params) {
1060
1060
  return offset;
1061
1061
  }
1062
1062
 
1063
- // src/core/finishScrollTo.ts
1064
- function finishScrollTo(ctx, state) {
1065
- var _a3, _b;
1066
- if (state) {
1067
- state.scrollHistory.length = 0;
1068
- state.initialScroll = void 0;
1069
- state.initialAnchor = void 0;
1070
- set$(ctx, "scrollingTo", void 0);
1071
- if (state.pendingTotalSize !== void 0) {
1072
- addTotalSize(ctx, state, null, state.pendingTotalSize);
1073
- }
1074
- if ((_a3 = state.props) == null ? void 0 : _a3.data) {
1075
- (_b = state.triggerCalculateItemsInView) == null ? void 0 : _b.call(state, { forceFullItemPositions: true });
1076
- }
1077
- }
1078
- }
1079
- var Platform2 = reactNative.Platform;
1080
-
1081
- // src/core/scrollTo.ts
1082
- function scrollTo(ctx, state, params) {
1083
- var _a3;
1084
- const { noScrollingTo, ...scrollTarget } = params;
1085
- const { animated, isInitialScroll, offset: scrollTargetOffset, precomputedWithViewOffset } = scrollTarget;
1086
- const {
1087
- refScroller,
1088
- props: { horizontal }
1089
- } = state;
1090
- let offset = precomputedWithViewOffset ? scrollTargetOffset : calculateOffsetWithOffsetPosition(ctx, state, scrollTargetOffset, scrollTarget);
1091
- if (Number.isFinite(state.scrollLength) && Number.isFinite(state.totalSize)) {
1092
- const maxOffset = Math.max(0, getContentSize(ctx) - state.scrollLength);
1093
- offset = Math.min(offset, maxOffset);
1094
- }
1095
- state.scrollHistory.length = 0;
1096
- if (!noScrollingTo) {
1097
- set$(ctx, "scrollingTo", scrollTarget);
1098
- }
1099
- state.scrollPending = offset;
1100
- if (!isInitialScroll || Platform2.OS === "android") {
1101
- (_a3 = refScroller.current) == null ? void 0 : _a3.scrollTo({
1102
- animated: !!animated,
1103
- x: horizontal ? offset : 0,
1104
- y: horizontal ? 0 : offset
1105
- });
1106
- }
1107
- if (!animated) {
1108
- state.scroll = offset;
1109
- if (Platform2.OS === "web") {
1110
- const unlisten = listen$(ctx, "containersDidLayout", (value) => {
1111
- if (value && peek$(ctx, "scrollingTo")) {
1112
- finishScrollTo(ctx, state);
1113
- unlisten();
1114
- }
1115
- });
1116
- } else {
1117
- setTimeout(() => finishScrollTo(ctx, state), 100);
1118
- }
1119
- if (isInitialScroll) {
1120
- setTimeout(() => {
1121
- state.initialScroll = void 0;
1122
- }, 500);
1123
- }
1124
- }
1125
- }
1126
-
1127
1063
  // src/utils/checkThreshold.ts
1128
1064
  var HYSTERESIS_MULTIPLIER = 1.3;
1129
1065
  var checkThreshold = (distance, atThreshold, threshold, wasReached, snapshot, context, onReached, setSnapshot) => {
@@ -1234,7 +1170,24 @@ function checkAtTop(state) {
1234
1170
  );
1235
1171
  }
1236
1172
 
1237
- // src/core/updateScroll.ts
1173
+ // src/core/onScroll.ts
1174
+ function onScroll(ctx, state, event) {
1175
+ var _a3, _b, _c;
1176
+ const {
1177
+ scrollProcessingEnabled,
1178
+ props: { onScroll: onScrollProp }
1179
+ } = state;
1180
+ if (scrollProcessingEnabled === false) {
1181
+ return;
1182
+ }
1183
+ 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) {
1184
+ return;
1185
+ }
1186
+ const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
1187
+ state.scrollPending = newScroll;
1188
+ updateScroll(ctx, state, newScroll);
1189
+ onScrollProp == null ? void 0 : onScrollProp(event);
1190
+ }
1238
1191
  function updateScroll(ctx, state, newScroll, forceUpdate) {
1239
1192
  var _a3;
1240
1193
  const scrollingTo = peek$(ctx, "scrollingTo");
@@ -1277,6 +1230,70 @@ function updateScroll(ctx, state, newScroll, forceUpdate) {
1277
1230
  }
1278
1231
  }
1279
1232
 
1233
+ // src/core/finishScrollTo.ts
1234
+ function finishScrollTo(ctx, state) {
1235
+ var _a3, _b;
1236
+ if (state) {
1237
+ state.scrollHistory.length = 0;
1238
+ state.initialScroll = void 0;
1239
+ state.initialAnchor = void 0;
1240
+ set$(ctx, "scrollingTo", void 0);
1241
+ if (state.pendingTotalSize !== void 0) {
1242
+ addTotalSize(ctx, state, null, state.pendingTotalSize);
1243
+ }
1244
+ if ((_a3 = state.props) == null ? void 0 : _a3.data) {
1245
+ (_b = state.triggerCalculateItemsInView) == null ? void 0 : _b.call(state, { forceFullItemPositions: true });
1246
+ }
1247
+ }
1248
+ }
1249
+ var Platform2 = reactNative.Platform;
1250
+
1251
+ // src/core/scrollTo.ts
1252
+ function scrollTo(ctx, state, params) {
1253
+ var _a3;
1254
+ const { noScrollingTo, ...scrollTarget } = params;
1255
+ const { animated, isInitialScroll, offset: scrollTargetOffset, precomputedWithViewOffset } = scrollTarget;
1256
+ const {
1257
+ refScroller,
1258
+ props: { horizontal }
1259
+ } = state;
1260
+ let offset = precomputedWithViewOffset ? scrollTargetOffset : calculateOffsetWithOffsetPosition(ctx, state, scrollTargetOffset, scrollTarget);
1261
+ if (Number.isFinite(state.scrollLength) && Number.isFinite(state.totalSize)) {
1262
+ const maxOffset = Math.max(0, getContentSize(ctx) - state.scrollLength);
1263
+ offset = Math.min(offset, maxOffset);
1264
+ }
1265
+ state.scrollHistory.length = 0;
1266
+ if (!noScrollingTo) {
1267
+ set$(ctx, "scrollingTo", scrollTarget);
1268
+ }
1269
+ state.scrollPending = offset;
1270
+ if (!isInitialScroll || Platform2.OS === "android") {
1271
+ (_a3 = refScroller.current) == null ? void 0 : _a3.scrollTo({
1272
+ animated: !!animated,
1273
+ x: horizontal ? offset : 0,
1274
+ y: horizontal ? 0 : offset
1275
+ });
1276
+ }
1277
+ if (!animated) {
1278
+ state.scroll = offset;
1279
+ if (Platform2.OS === "web") {
1280
+ const unlisten = listen$(ctx, "containersDidLayout", (value) => {
1281
+ if (value) {
1282
+ finishScrollTo(ctx, state);
1283
+ unlisten();
1284
+ }
1285
+ });
1286
+ } else {
1287
+ setTimeout(() => finishScrollTo(ctx, state), 100);
1288
+ }
1289
+ if (isInitialScroll) {
1290
+ setTimeout(() => {
1291
+ state.initialScroll = void 0;
1292
+ }, 500);
1293
+ }
1294
+ }
1295
+ }
1296
+
1280
1297
  // src/utils/requestAdjust.ts
1281
1298
  function requestAdjust(ctx, state, positionDiff, dataChanged) {
1282
1299
  if (Math.abs(positionDiff) > 0.1) {
@@ -1289,9 +1306,6 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
1289
1306
  });
1290
1307
  } else {
1291
1308
  state.scrollAdjustHandler.requestAdjust(positionDiff);
1292
- if (state.adjustingFromInitialMount) {
1293
- state.adjustingFromInitialMount--;
1294
- }
1295
1309
  }
1296
1310
  };
1297
1311
  state.scroll += positionDiff;
@@ -1324,7 +1338,6 @@ function requestAdjust(ctx, state, positionDiff, dataChanged) {
1324
1338
  }, delay);
1325
1339
  }
1326
1340
  } else {
1327
- state.adjustingFromInitialMount = (state.adjustingFromInitialMount || 0) + 1;
1328
1341
  requestAnimationFrame(doit);
1329
1342
  }
1330
1343
  }
@@ -1384,16 +1397,18 @@ function ensureInitialAnchor(ctx, state) {
1384
1397
 
1385
1398
  // src/core/mvcp.ts
1386
1399
  function prepareMVCP(ctx, state, dataChanged) {
1387
- const { idsInView, positions, props } = state;
1388
- const { maintainVisibleContentPosition } = props;
1400
+ const {
1401
+ idsInView,
1402
+ positions,
1403
+ props: { maintainVisibleContentPosition }
1404
+ } = state;
1389
1405
  const scrollingTo = peek$(ctx, "scrollingTo");
1390
1406
  let prevPosition;
1391
1407
  let targetId;
1392
1408
  const idsInViewWithPositions = [];
1393
1409
  const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
1394
- const shouldMVCP = !dataChanged || maintainVisibleContentPosition;
1395
- const indexByKey = state.indexByKey;
1396
- if (shouldMVCP) {
1410
+ if (maintainVisibleContentPosition) {
1411
+ const indexByKey = state.indexByKey;
1397
1412
  if (scrollTarget !== void 0) {
1398
1413
  if (!IsNewArchitecture && (scrollingTo == null ? void 0 : scrollingTo.isInitialScroll)) {
1399
1414
  return void 0;
@@ -1409,44 +1424,44 @@ function prepareMVCP(ctx, state, dataChanged) {
1409
1424
  }
1410
1425
  }
1411
1426
  } else {
1412
- targetId = idsInView.find((id) => indexByKey.get(id) !== void 0);
1427
+ targetId = state.idsInView.find((id) => indexByKey.get(id) !== void 0);
1413
1428
  }
1414
1429
  }
1415
1430
  if (targetId !== void 0) {
1416
1431
  prevPosition = positions.get(targetId);
1417
1432
  }
1418
- return () => {
1419
- let positionDiff;
1420
- if (dataChanged && targetId === void 0 && maintainVisibleContentPosition) {
1421
- for (let i = 0; i < idsInViewWithPositions.length; i++) {
1422
- const { id, position } = idsInViewWithPositions[i];
1423
- const newPosition = positions.get(id);
1424
- if (newPosition !== void 0) {
1425
- positionDiff = newPosition - position;
1426
- break;
1427
- }
1433
+ }
1434
+ return () => {
1435
+ let positionDiff;
1436
+ if (dataChanged && targetId === void 0) {
1437
+ for (let i = 0; i < idsInViewWithPositions.length; i++) {
1438
+ const { id, position } = idsInViewWithPositions[i];
1439
+ const newPosition = positions.get(id);
1440
+ if (newPosition !== void 0) {
1441
+ positionDiff = newPosition - position;
1442
+ break;
1428
1443
  }
1429
1444
  }
1430
- if (targetId !== void 0 && prevPosition !== void 0) {
1431
- const newPosition = positions.get(targetId);
1432
- if (newPosition !== void 0) {
1433
- const totalSize = getContentSize(ctx);
1434
- let diff = newPosition - prevPosition;
1435
- if (diff !== 0 && state.scroll + state.scrollLength > totalSize) {
1436
- if (diff > 0) {
1437
- diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
1438
- } else {
1439
- diff = 0;
1440
- }
1445
+ }
1446
+ if (targetId !== void 0 && prevPosition !== void 0) {
1447
+ const newPosition = positions.get(targetId);
1448
+ if (newPosition !== void 0) {
1449
+ const totalSize = getContentSize(ctx);
1450
+ let diff = newPosition - prevPosition;
1451
+ if (diff !== 0 && state.scroll + state.scrollLength > totalSize) {
1452
+ if (diff > 0) {
1453
+ diff = Math.max(0, totalSize - state.scroll - state.scrollLength);
1454
+ } else {
1455
+ diff = 0;
1441
1456
  }
1442
- positionDiff = diff;
1443
1457
  }
1458
+ positionDiff = diff;
1444
1459
  }
1445
- if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
1446
- requestAdjust(ctx, state, positionDiff, dataChanged && maintainVisibleContentPosition);
1447
- }
1448
- };
1449
- }
1460
+ }
1461
+ if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
1462
+ requestAdjust(ctx, state, positionDiff, dataChanged);
1463
+ }
1464
+ };
1450
1465
  }
1451
1466
 
1452
1467
  // src/core/prepareColumnStartState.ts
@@ -1588,8 +1603,7 @@ function updateSnapToOffsets(ctx, state) {
1588
1603
  }
1589
1604
 
1590
1605
  // src/core/updateItemPositions.ts
1591
- function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false, doMVCP } = {
1592
- doMVCP: false,
1606
+ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottomBuffered, forceFullUpdate = false } = {
1593
1607
  forceFullUpdate: false,
1594
1608
  scrollBottomBuffered: -1,
1595
1609
  startIndex: 0
@@ -1601,7 +1615,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1601
1615
  positions,
1602
1616
  idCache,
1603
1617
  sizesKnown,
1604
- props: { getEstimatedItemSize, snapToIndices, enableAverages }
1618
+ props: { getEstimatedItemSize, snapToIndices, enableAverages, maintainVisibleContentPosition }
1605
1619
  } = state;
1606
1620
  const data = state.props.data;
1607
1621
  const dataLength = data.length;
@@ -1612,7 +1626,7 @@ function updateItemPositions(ctx, state, dataChanged, { startIndex, scrollBottom
1612
1626
  const shouldOptimize = !forceFullUpdate && !dataChanged && Math.abs(getScrollVelocity(state)) > 0;
1613
1627
  const maxVisibleArea = scrollBottomBuffered + 1e3;
1614
1628
  const useAverageSize = enableAverages && !getEstimatedItemSize;
1615
- const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0;
1629
+ const preferCachedSize = maintainVisibleContentPosition && (dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_a3 = peek$(ctx, "scrollAdjustPending")) != null ? _a3 : 0) !== 0);
1616
1630
  let currentRowTop = 0;
1617
1631
  let column = 1;
1618
1632
  let maxSizeInRow = 0;
@@ -2078,14 +2092,14 @@ function findCurrentStickyIndex(stickyArray, scroll, state) {
2078
2092
  }
2079
2093
  return -1;
2080
2094
  }
2081
- function getActiveStickyIndices(ctx, state, stickyHeaderIndices) {
2095
+ function getActiveStickyIndices(ctx, state, stickyIndices) {
2082
2096
  return new Set(
2083
- 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))
2097
+ 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))
2084
2098
  );
2085
2099
  }
2086
- function handleStickyActivation(ctx, state, stickyHeaderIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
2100
+ function handleStickyActivation(ctx, state, stickyIndices, stickyArray, currentStickyIdx, needNewContainers, startBuffered, endBuffered) {
2087
2101
  var _a3;
2088
- const activeIndices = getActiveStickyIndices(ctx, state, stickyHeaderIndices);
2102
+ const activeIndices = getActiveStickyIndices(ctx, state, stickyIndices);
2089
2103
  state.activeStickyIndex = currentStickyIdx >= 0 ? stickyArray[currentStickyIdx] : void 0;
2090
2104
  for (let offset = 0; offset <= 1; offset++) {
2091
2105
  const idx = currentStickyIdx - offset;
@@ -2221,7 +2235,6 @@ function calculateItemsInView(ctx, state, params = {}) {
2221
2235
  }
2222
2236
  const startIndex = dataChanged ? 0 : (_b = minIndexSizeChanged != null ? minIndexSizeChanged : state.startBuffered) != null ? _b : 0;
2223
2237
  updateItemPositions(ctx, state, dataChanged, {
2224
- doMVCP,
2225
2238
  forceFullUpdate: !!forceFullItemPositions,
2226
2239
  scrollBottomBuffered,
2227
2240
  startIndex
@@ -2516,7 +2529,6 @@ function doMaintainScrollAtEnd(ctx, state, animated) {
2516
2529
  });
2517
2530
  return true;
2518
2531
  }
2519
- return false;
2520
2532
  }
2521
2533
 
2522
2534
  // src/utils/updateAveragesOnDataChange.ts
@@ -2685,25 +2697,6 @@ function handleLayout(ctx, state, layout, setCanRender) {
2685
2697
  setCanRender(true);
2686
2698
  }
2687
2699
 
2688
- // src/core/onScroll.ts
2689
- function onScroll(ctx, state, event) {
2690
- var _a3, _b, _c;
2691
- const {
2692
- scrollProcessingEnabled,
2693
- props: { onScroll: onScrollProp }
2694
- } = state;
2695
- if (scrollProcessingEnabled === false) {
2696
- return;
2697
- }
2698
- 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) {
2699
- return;
2700
- }
2701
- const newScroll = event.nativeEvent.contentOffset[state.props.horizontal ? "x" : "y"];
2702
- state.scrollPending = newScroll;
2703
- updateScroll(ctx, state, newScroll);
2704
- onScrollProp == null ? void 0 : onScrollProp(event);
2705
- }
2706
-
2707
2700
  // src/core/ScrollAdjustHandler.ts
2708
2701
  var ScrollAdjustHandler = class {
2709
2702
  constructor(ctx) {
@@ -2739,7 +2732,12 @@ var ScrollAdjustHandler = class {
2739
2732
  set$(this.context, "scrollAdjustPending", this.pendingAdjust);
2740
2733
  } else {
2741
2734
  this.appliedAdjust += add;
2742
- set$(this.context, "scrollAdjust", this.appliedAdjust);
2735
+ const setter = () => set$(this.context, "scrollAdjust", this.appliedAdjust);
2736
+ if (this.mounted) {
2737
+ setter();
2738
+ } else {
2739
+ requestAnimationFrame(setter);
2740
+ }
2743
2741
  }
2744
2742
  }
2745
2743
  setMounted() {
@@ -2901,9 +2899,9 @@ function getWindowSize() {
2901
2899
  };
2902
2900
  }
2903
2901
  var StyleSheet = reactNative.StyleSheet;
2904
- function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2) {
2902
+ function useStickyScrollHandler(stickyIndices, horizontal, ctx, onScroll2) {
2905
2903
  return React2.useMemo(() => {
2906
- if (stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.length) {
2904
+ if (stickyIndices == null ? void 0 : stickyIndices.length) {
2907
2905
  const { animatedScrollY } = ctx;
2908
2906
  return reactNative.Animated.event(
2909
2907
  [
@@ -2920,7 +2918,7 @@ function useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, onScroll2)
2920
2918
  );
2921
2919
  }
2922
2920
  return onScroll2;
2923
- }, [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(","), horizontal]);
2921
+ }, [stickyIndices == null ? void 0 : stickyIndices.join(","), horizontal]);
2924
2922
  }
2925
2923
 
2926
2924
  // src/utils/createColumnWrapperStyle.ts
@@ -3142,7 +3140,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3142
3140
  ListHeaderComponent,
3143
3141
  maintainScrollAtEnd = false,
3144
3142
  maintainScrollAtEndThreshold = 0.1,
3145
- maintainVisibleContentPosition = false,
3143
+ maintainVisibleContentPosition = true,
3146
3144
  numColumns: numColumnsProp = 1,
3147
3145
  onEndReached,
3148
3146
  onEndReachedThreshold = 0.5,
@@ -3164,8 +3162,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3164
3162
  renderItem,
3165
3163
  scrollEventThrottle,
3166
3164
  snapToIndices,
3167
- stickyHeaderIndices: stickyHeaderIndicesProp,
3168
- stickyIndices: stickyIndicesDeprecated,
3165
+ stickyIndices,
3169
3166
  style: styleProp,
3170
3167
  suggestEstimatedItemSize,
3171
3168
  viewabilityConfig,
@@ -3187,13 +3184,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3187
3184
  const estimatedItemSize = estimatedItemSizeProp != null ? estimatedItemSizeProp : DEFAULT_ITEM_SIZE;
3188
3185
  const scrollBuffer = (drawDistance != null ? drawDistance : DEFAULT_DRAW_DISTANCE) || 1;
3189
3186
  const keyExtractor = keyExtractorProp != null ? keyExtractorProp : (_item, index) => index.toString();
3190
- const stickyHeaderIndices = stickyHeaderIndicesProp != null ? stickyHeaderIndicesProp : stickyIndicesDeprecated;
3191
- if (IS_DEV && stickyIndicesDeprecated && !stickyHeaderIndicesProp) {
3192
- warnDevOnce(
3193
- "stickyIndices",
3194
- "stickyIndices has been renamed to stickyHeaderIndices. Please update your props to use stickyHeaderIndices."
3195
- );
3196
- }
3197
3187
  const refState = React2.useRef();
3198
3188
  if (!refState.current) {
3199
3189
  if (!ctx.internalState) {
@@ -3305,8 +3295,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3305
3295
  renderItem,
3306
3296
  scrollBuffer,
3307
3297
  snapToIndices,
3308
- stickyIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],
3309
- stickyIndicesSet: React2.useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),
3298
+ stickyIndicesArr: stickyIndices != null ? stickyIndices : [],
3299
+ stickyIndicesSet: React2.useMemo(() => new Set(stickyIndices != null ? stickyIndices : []), [stickyIndices == null ? void 0 : stickyIndices.join(",")]),
3310
3300
  stylePaddingBottom: stylePaddingBottomState,
3311
3301
  stylePaddingTop: stylePaddingTopState,
3312
3302
  suggestEstimatedItemSize: !!suggestEstimatedItemSize
@@ -3326,7 +3316,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3326
3316
  setPaddingTop(ctx, state, { stylePaddingTop: stylePaddingTopState });
3327
3317
  refState.current.props.stylePaddingBottom = stylePaddingBottomState;
3328
3318
  let paddingDiff = stylePaddingTopState - prevPaddingTop;
3329
- if (paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
3319
+ if (maintainVisibleContentPosition && paddingDiff && prevPaddingTop !== void 0 && Platform2.OS === "ios") {
3330
3320
  if (state.scroll < 0) {
3331
3321
  paddingDiff += state.scroll;
3332
3322
  }
@@ -3374,7 +3364,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3374
3364
  state.initialScroll = updatedInitialScroll;
3375
3365
  refState.current.isStartReached = clampedOffset < refState.current.scrollLength * onStartReachedThreshold;
3376
3366
  return clampedOffset;
3377
- }, [renderNum]);
3367
+ }, [renderNum, state.initialScroll]);
3378
3368
  if (isFirstLocal || didDataChangeLocal || numColumnsProp !== peek$(ctx, "numColumns")) {
3379
3369
  refState.current.lastBatchingAction = Date.now();
3380
3370
  if (!keyExtractorProp && !isFirstLocal && didDataChangeLocal) {
@@ -3414,7 +3404,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3414
3404
  precomputedWithViewOffset: true
3415
3405
  });
3416
3406
  }
3417
- }, [initialContentOffset]);
3407
+ }, [initialContentOffset, state.initialScroll]);
3418
3408
  const onLayoutChange = React2.useCallback((layout) => {
3419
3409
  doInitialScroll();
3420
3410
  handleLayout(ctx, state, layout, setCanRender);
@@ -3481,7 +3471,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3481
3471
  }),
3482
3472
  []
3483
3473
  );
3484
- const onScrollHandler = useStickyScrollHandler(stickyHeaderIndices, horizontal, ctx, fns.onScroll);
3474
+ const onScrollHandler = useStickyScrollHandler(stickyIndices, horizontal, ctx, fns.onScroll);
3485
3475
  return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, /* @__PURE__ */ React2__namespace.createElement(
3486
3476
  ListComponent,
3487
3477
  {
@@ -3527,7 +3517,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
3527
3517
  scrollAdjustHandler: (_b = refState.current) == null ? void 0 : _b.scrollAdjustHandler,
3528
3518
  scrollEventThrottle: Platform2.OS === "web" ? 16 : void 0,
3529
3519
  snapToIndices,
3530
- stickyHeaderIndices,
3520
+ stickyIndices,
3531
3521
  style,
3532
3522
  updateItemSize: fns.updateItemSize,
3533
3523
  waitForInitialLayout