@legendapp/list 1.0.0-beta.25 → 1.0.0-beta.26

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/animated.d.mts CHANGED
@@ -3,7 +3,7 @@ import * as _legendapp_list from '@legendapp/list';
3
3
  import * as react_native from 'react-native';
4
4
  import { Animated } from 'react-native';
5
5
 
6
- declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
7
7
  data: readonly T[];
8
8
  initialScrollOffset?: number;
9
9
  initialScrollIndex?: number;
package/animated.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as _legendapp_list from '@legendapp/list';
3
3
  import * as react_native from 'react-native';
4
4
  import { Animated } from 'react-native';
5
5
 
6
- declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
7
7
  data: readonly T[];
8
8
  initialScrollOffset?: number;
9
9
  initialScrollIndex?: number;
package/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import { ComponentProps, ReactNode } from 'react';
3
3
  import * as react_native from 'react-native';
4
- import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
4
+ import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
5
  import Animated from 'react-native-reanimated';
6
6
 
7
7
  declare class ScrollAdjustHandler {
@@ -139,6 +139,7 @@ interface InternalState {
139
139
  queuedCalculateItemsInView: number | undefined;
140
140
  lastBatchingAction: number;
141
141
  ignoreScrollFromCalcTotal?: boolean;
142
+ onScroll: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
142
143
  }
143
144
  interface ViewableRange<T> {
144
145
  startBuffered: number;
@@ -258,7 +259,7 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
258
259
  };
259
260
  declare const typedMemo: TypedMemo;
260
261
 
261
- declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
262
+ declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
262
263
  data: readonly T[];
263
264
  initialScrollOffset?: number;
264
265
  initialScrollIndex?: number;
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React$1 from 'react';
2
2
  import { ComponentProps, ReactNode } from 'react';
3
3
  import * as react_native from 'react-native';
4
- import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
4
+ import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
5
  import Animated from 'react-native-reanimated';
6
6
 
7
7
  declare class ScrollAdjustHandler {
@@ -139,6 +139,7 @@ interface InternalState {
139
139
  queuedCalculateItemsInView: number | undefined;
140
140
  lastBatchingAction: number;
141
141
  ignoreScrollFromCalcTotal?: boolean;
142
+ onScroll: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
142
143
  }
143
144
  interface ViewableRange<T> {
144
145
  startBuffered: number;
@@ -258,7 +259,7 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
258
259
  };
259
260
  declare const typedMemo: TypedMemo;
260
261
 
261
- declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
262
+ declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "maintainVisibleContentPosition" | "stickyHeaderIndices" | "contentInset" | "contentOffset"> & {
262
263
  data: readonly T[];
263
264
  initialScrollOffset?: number;
264
265
  initialScrollIndex?: number;
package/index.js CHANGED
@@ -924,7 +924,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
924
924
  minIndexSizeChanged: 0,
925
925
  numPendingInitialLayout: 0,
926
926
  queuedCalculateItemsInView: 0,
927
- lastBatchingAction: Date.now()
927
+ lastBatchingAction: Date.now(),
928
+ onScroll: onScrollProp
928
929
  };
929
930
  if (maintainVisibleContentPosition) {
930
931
  if (initialScrollIndex) {
@@ -947,6 +948,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
947
948
  }
948
949
  const didDataChange = refState.current.data !== dataProp;
949
950
  refState.current.data = dataProp;
951
+ refState.current.onScroll = onScrollProp;
950
952
  const getAnchorElementIndex = () => {
951
953
  const state = refState.current;
952
954
  if (state.anchorElement) {
@@ -996,7 +998,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
996
998
  }, []);
997
999
  const getRowHeight = (n) => {
998
1000
  const { rowHeights, data } = refState.current;
999
- if (numColumnsProp === 1) {
1001
+ const numColumns = peek$(ctx, "numColumns");
1002
+ if (numColumns === 1) {
1000
1003
  const id = getId(n);
1001
1004
  return getItemSize(id, n, data[n]);
1002
1005
  }
@@ -1004,8 +1007,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1004
1007
  return rowHeights.get(n) || 0;
1005
1008
  }
1006
1009
  let rowHeight = 0;
1007
- const startEl = n * numColumnsProp;
1008
- for (let i = startEl; i < startEl + numColumnsProp && i < data.length; i++) {
1010
+ const startEl = n * numColumns;
1011
+ for (let i = startEl; i < startEl + numColumns && i < data.length; i++) {
1009
1012
  const id = getId(i);
1010
1013
  const size = getItemSize(id, i, data[i]);
1011
1014
  rowHeight = Math.max(rowHeight, size);
@@ -1024,10 +1027,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1024
1027
  return /* @__PURE__ */ new Map();
1025
1028
  }
1026
1029
  const map = state.belowAnchorElementPositions || /* @__PURE__ */ new Map();
1030
+ const numColumns = peek$(ctx, "numColumns");
1027
1031
  for (let i = anchorIndex - 1; i >= 0; i--) {
1028
1032
  const id = getId(i);
1029
- const rowNumber = Math.floor(i / numColumnsProp);
1030
- if (i % numColumnsProp === 0) {
1033
+ const rowNumber = Math.floor(i / numColumns);
1034
+ if (i % numColumns === 0) {
1031
1035
  top -= getRowHeight(rowNumber);
1032
1036
  }
1033
1037
  map.set(id, top);
@@ -1064,6 +1068,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1064
1068
  return;
1065
1069
  }
1066
1070
  const topPad = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
1071
+ const numColumns = peek$(ctx, "numColumns");
1067
1072
  const previousScrollAdjust = scrollAdjustHandler.getAppliedAdjust();
1068
1073
  const scrollExtra = Math.max(-16, Math.min(16, speed)) * 16;
1069
1074
  const scroll = scrollState - previousScrollAdjust - topPad;
@@ -1119,7 +1124,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1119
1124
  }
1120
1125
  }
1121
1126
  }
1122
- const numColumns = peek$(ctx, "numColumns");
1123
1127
  const loopStartMod = loopStart % numColumns;
1124
1128
  if (loopStartMod > 0) {
1125
1129
  loopStart -= loopStartMod;
@@ -1276,7 +1280,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1276
1280
  };
1277
1281
  const column2 = columns.get(id) || 1;
1278
1282
  if (maintainVisibleContentPosition && itemIndex < anchorElementIndex) {
1279
- const currentRow = Math.floor(itemIndex / numColumnsProp);
1283
+ const currentRow = Math.floor(itemIndex / numColumns);
1280
1284
  const rowHeight = getRowHeight(currentRow);
1281
1285
  const elementHeight = getItemSize(id, itemIndex, data[i]);
1282
1286
  const diff = rowHeight - elementHeight;
@@ -1434,13 +1438,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1434
1438
  }
1435
1439
  };
1436
1440
  const calcTotalSizesAndPositions = ({ forgetPositions = false }) => {
1437
- var _a2, _b2, _c2;
1441
+ var _a2, _b2, _c2, _d2;
1438
1442
  let totalSize = 0;
1439
1443
  let totalSizeBelowIndex = 0;
1440
1444
  const indexByKey = /* @__PURE__ */ new Map();
1441
1445
  const newPositions = /* @__PURE__ */ new Map();
1442
1446
  let column = 1;
1443
1447
  let maxSizeInRow = 0;
1448
+ const numColumns = (_a2 = peek$(ctx, "numColumns")) != null ? _a2 : numColumnsProp;
1444
1449
  if (!refState.current) {
1445
1450
  return;
1446
1451
  }
@@ -1469,8 +1474,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1469
1474
  id: getId(0)
1470
1475
  };
1471
1476
  refState.current.anchorElement = newAnchorElement;
1472
- (_a2 = refState.current.belowAnchorElementPositions) == null ? void 0 : _a2.clear();
1473
- (_b2 = refScroller.current) == null ? void 0 : _b2.scrollTo({ x: 0, y: 0, animated: false });
1477
+ (_b2 = refState.current.belowAnchorElementPositions) == null ? void 0 : _b2.clear();
1478
+ (_c2 = refScroller.current) == null ? void 0 : _c2.scrollTo({ x: 0, y: 0, animated: false });
1474
1479
  setTimeout(() => {
1475
1480
  calculateItemsInView();
1476
1481
  }, 0);
@@ -1485,7 +1490,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1485
1490
  } else {
1486
1491
  refState.current.startBufferedId = void 0;
1487
1492
  }
1488
- (_c2 = refScroller.current) == null ? void 0 : _c2.scrollTo({ x: 0, y: 0, animated: false });
1493
+ (_d2 = refScroller.current) == null ? void 0 : _d2.scrollTo({ x: 0, y: 0, animated: false });
1489
1494
  setTimeout(() => {
1490
1495
  calculateItemsInView();
1491
1496
  }, 0);
@@ -1498,7 +1503,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1498
1503
  const size = getItemSize(key, i, dataProp[i]);
1499
1504
  maxSizeInRow = Math.max(maxSizeInRow, size);
1500
1505
  column++;
1501
- if (column > numColumnsProp) {
1506
+ if (column > numColumns) {
1502
1507
  if (maintainVisibleContentPosition && anchorElementIndex !== void 0 && i < anchorElementIndex) {
1503
1508
  totalSizeBelowIndex += maxSizeInRow;
1504
1509
  }
@@ -1625,14 +1630,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1625
1630
  state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, index) : index;
1626
1631
  const prevSize = getItemSize(itemKey, index, data);
1627
1632
  let needsCalculate = false;
1633
+ let needsUpdateContainersDidLayout = false;
1628
1634
  if (state.numPendingInitialLayout > 0) {
1629
1635
  state.numPendingInitialLayout--;
1630
1636
  if (state.numPendingInitialLayout === 0) {
1631
1637
  needsCalculate = true;
1632
1638
  state.numPendingInitialLayout = -1;
1633
- queueMicrotask(() => {
1634
- set$(ctx, "containersDidLayout", true);
1635
- });
1639
+ needsUpdateContainersDidLayout = true;
1636
1640
  }
1637
1641
  }
1638
1642
  if (!prevSize || Math.abs(prevSize - size) > 0.5) {
@@ -1688,9 +1692,17 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1688
1692
  state.queuedCalculateItemsInView = requestAnimationFrame(() => {
1689
1693
  state.queuedCalculateItemsInView = void 0;
1690
1694
  calculateItemsInView();
1695
+ if (needsUpdateContainersDidLayout) {
1696
+ set$(ctx, "containersDidLayout", true);
1697
+ }
1691
1698
  });
1692
1699
  } else {
1693
1700
  calculateItemsInView();
1701
+ if (needsUpdateContainersDidLayout) {
1702
+ queueMicrotask(() => {
1703
+ set$(ctx, "containersDidLayout", true);
1704
+ });
1705
+ }
1694
1706
  }
1695
1707
  }
1696
1708
  }
@@ -1724,18 +1736,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1724
1736
  }, []);
1725
1737
  const handleScroll = React6.useCallback(
1726
1738
  (event, fromSelf) => {
1727
- var _a2, _b2, _c2;
1739
+ var _a2, _b2, _c2, _d2;
1728
1740
  if (((_b2 = (_a2 = event.nativeEvent) == null ? void 0 : _a2.contentSize) == null ? void 0 : _b2.height) === 0 && ((_c2 = event.nativeEvent.contentSize) == null ? void 0 : _c2.width) === 0) {
1729
1741
  return;
1730
1742
  }
1731
1743
  const state = refState.current;
1732
- if (state.ignoreScrollFromCalcTotal) {
1744
+ const newScroll = event.nativeEvent.contentOffset[horizontal ? "x" : "y"];
1745
+ if (state.ignoreScrollFromCalcTotal && newScroll !== 0) {
1733
1746
  return;
1734
1747
  }
1735
1748
  state.hasScrolled = true;
1736
1749
  state.lastBatchingAction = Date.now();
1737
1750
  const currentTime = performance.now();
1738
- const newScroll = event.nativeEvent.contentOffset[horizontal ? "x" : "y"];
1739
1751
  if (!(state.scrollHistory.length === 0 && newScroll === initialContentOffset)) {
1740
1752
  state.scrollHistory.push({ scroll: newScroll, time: currentTime });
1741
1753
  }
@@ -1765,7 +1777,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1765
1777
  checkAtBottom();
1766
1778
  checkAtTop();
1767
1779
  if (!fromSelf) {
1768
- onScrollProp == null ? void 0 : onScrollProp(event);
1780
+ (_d2 = state.onScroll) == null ? void 0 : _d2.call(state, event);
1769
1781
  }
1770
1782
  },
1771
1783
  []
package/index.mjs CHANGED
@@ -903,7 +903,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
903
903
  minIndexSizeChanged: 0,
904
904
  numPendingInitialLayout: 0,
905
905
  queuedCalculateItemsInView: 0,
906
- lastBatchingAction: Date.now()
906
+ lastBatchingAction: Date.now(),
907
+ onScroll: onScrollProp
907
908
  };
908
909
  if (maintainVisibleContentPosition) {
909
910
  if (initialScrollIndex) {
@@ -926,6 +927,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
926
927
  }
927
928
  const didDataChange = refState.current.data !== dataProp;
928
929
  refState.current.data = dataProp;
930
+ refState.current.onScroll = onScrollProp;
929
931
  const getAnchorElementIndex = () => {
930
932
  const state = refState.current;
931
933
  if (state.anchorElement) {
@@ -975,7 +977,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
975
977
  }, []);
976
978
  const getRowHeight = (n) => {
977
979
  const { rowHeights, data } = refState.current;
978
- if (numColumnsProp === 1) {
980
+ const numColumns = peek$(ctx, "numColumns");
981
+ if (numColumns === 1) {
979
982
  const id = getId(n);
980
983
  return getItemSize(id, n, data[n]);
981
984
  }
@@ -983,8 +986,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
983
986
  return rowHeights.get(n) || 0;
984
987
  }
985
988
  let rowHeight = 0;
986
- const startEl = n * numColumnsProp;
987
- for (let i = startEl; i < startEl + numColumnsProp && i < data.length; i++) {
989
+ const startEl = n * numColumns;
990
+ for (let i = startEl; i < startEl + numColumns && i < data.length; i++) {
988
991
  const id = getId(i);
989
992
  const size = getItemSize(id, i, data[i]);
990
993
  rowHeight = Math.max(rowHeight, size);
@@ -1003,10 +1006,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1003
1006
  return /* @__PURE__ */ new Map();
1004
1007
  }
1005
1008
  const map = state.belowAnchorElementPositions || /* @__PURE__ */ new Map();
1009
+ const numColumns = peek$(ctx, "numColumns");
1006
1010
  for (let i = anchorIndex - 1; i >= 0; i--) {
1007
1011
  const id = getId(i);
1008
- const rowNumber = Math.floor(i / numColumnsProp);
1009
- if (i % numColumnsProp === 0) {
1012
+ const rowNumber = Math.floor(i / numColumns);
1013
+ if (i % numColumns === 0) {
1010
1014
  top -= getRowHeight(rowNumber);
1011
1015
  }
1012
1016
  map.set(id, top);
@@ -1043,6 +1047,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1043
1047
  return;
1044
1048
  }
1045
1049
  const topPad = (peek$(ctx, "stylePaddingTop") || 0) + (peek$(ctx, "headerSize") || 0);
1050
+ const numColumns = peek$(ctx, "numColumns");
1046
1051
  const previousScrollAdjust = scrollAdjustHandler.getAppliedAdjust();
1047
1052
  const scrollExtra = Math.max(-16, Math.min(16, speed)) * 16;
1048
1053
  const scroll = scrollState - previousScrollAdjust - topPad;
@@ -1098,7 +1103,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1098
1103
  }
1099
1104
  }
1100
1105
  }
1101
- const numColumns = peek$(ctx, "numColumns");
1102
1106
  const loopStartMod = loopStart % numColumns;
1103
1107
  if (loopStartMod > 0) {
1104
1108
  loopStart -= loopStartMod;
@@ -1255,7 +1259,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1255
1259
  };
1256
1260
  const column2 = columns.get(id) || 1;
1257
1261
  if (maintainVisibleContentPosition && itemIndex < anchorElementIndex) {
1258
- const currentRow = Math.floor(itemIndex / numColumnsProp);
1262
+ const currentRow = Math.floor(itemIndex / numColumns);
1259
1263
  const rowHeight = getRowHeight(currentRow);
1260
1264
  const elementHeight = getItemSize(id, itemIndex, data[i]);
1261
1265
  const diff = rowHeight - elementHeight;
@@ -1413,13 +1417,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1413
1417
  }
1414
1418
  };
1415
1419
  const calcTotalSizesAndPositions = ({ forgetPositions = false }) => {
1416
- var _a2, _b2, _c2;
1420
+ var _a2, _b2, _c2, _d2;
1417
1421
  let totalSize = 0;
1418
1422
  let totalSizeBelowIndex = 0;
1419
1423
  const indexByKey = /* @__PURE__ */ new Map();
1420
1424
  const newPositions = /* @__PURE__ */ new Map();
1421
1425
  let column = 1;
1422
1426
  let maxSizeInRow = 0;
1427
+ const numColumns = (_a2 = peek$(ctx, "numColumns")) != null ? _a2 : numColumnsProp;
1423
1428
  if (!refState.current) {
1424
1429
  return;
1425
1430
  }
@@ -1448,8 +1453,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1448
1453
  id: getId(0)
1449
1454
  };
1450
1455
  refState.current.anchorElement = newAnchorElement;
1451
- (_a2 = refState.current.belowAnchorElementPositions) == null ? void 0 : _a2.clear();
1452
- (_b2 = refScroller.current) == null ? void 0 : _b2.scrollTo({ x: 0, y: 0, animated: false });
1456
+ (_b2 = refState.current.belowAnchorElementPositions) == null ? void 0 : _b2.clear();
1457
+ (_c2 = refScroller.current) == null ? void 0 : _c2.scrollTo({ x: 0, y: 0, animated: false });
1453
1458
  setTimeout(() => {
1454
1459
  calculateItemsInView();
1455
1460
  }, 0);
@@ -1464,7 +1469,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1464
1469
  } else {
1465
1470
  refState.current.startBufferedId = void 0;
1466
1471
  }
1467
- (_c2 = refScroller.current) == null ? void 0 : _c2.scrollTo({ x: 0, y: 0, animated: false });
1472
+ (_d2 = refScroller.current) == null ? void 0 : _d2.scrollTo({ x: 0, y: 0, animated: false });
1468
1473
  setTimeout(() => {
1469
1474
  calculateItemsInView();
1470
1475
  }, 0);
@@ -1477,7 +1482,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1477
1482
  const size = getItemSize(key, i, dataProp[i]);
1478
1483
  maxSizeInRow = Math.max(maxSizeInRow, size);
1479
1484
  column++;
1480
- if (column > numColumnsProp) {
1485
+ if (column > numColumns) {
1481
1486
  if (maintainVisibleContentPosition && anchorElementIndex !== void 0 && i < anchorElementIndex) {
1482
1487
  totalSizeBelowIndex += maxSizeInRow;
1483
1488
  }
@@ -1604,14 +1609,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1604
1609
  state.minIndexSizeChanged = state.minIndexSizeChanged !== void 0 ? Math.min(state.minIndexSizeChanged, index) : index;
1605
1610
  const prevSize = getItemSize(itemKey, index, data);
1606
1611
  let needsCalculate = false;
1612
+ let needsUpdateContainersDidLayout = false;
1607
1613
  if (state.numPendingInitialLayout > 0) {
1608
1614
  state.numPendingInitialLayout--;
1609
1615
  if (state.numPendingInitialLayout === 0) {
1610
1616
  needsCalculate = true;
1611
1617
  state.numPendingInitialLayout = -1;
1612
- queueMicrotask(() => {
1613
- set$(ctx, "containersDidLayout", true);
1614
- });
1618
+ needsUpdateContainersDidLayout = true;
1615
1619
  }
1616
1620
  }
1617
1621
  if (!prevSize || Math.abs(prevSize - size) > 0.5) {
@@ -1667,9 +1671,17 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1667
1671
  state.queuedCalculateItemsInView = requestAnimationFrame(() => {
1668
1672
  state.queuedCalculateItemsInView = void 0;
1669
1673
  calculateItemsInView();
1674
+ if (needsUpdateContainersDidLayout) {
1675
+ set$(ctx, "containersDidLayout", true);
1676
+ }
1670
1677
  });
1671
1678
  } else {
1672
1679
  calculateItemsInView();
1680
+ if (needsUpdateContainersDidLayout) {
1681
+ queueMicrotask(() => {
1682
+ set$(ctx, "containersDidLayout", true);
1683
+ });
1684
+ }
1673
1685
  }
1674
1686
  }
1675
1687
  }
@@ -1703,18 +1715,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1703
1715
  }, []);
1704
1716
  const handleScroll = useCallback(
1705
1717
  (event, fromSelf) => {
1706
- var _a2, _b2, _c2;
1718
+ var _a2, _b2, _c2, _d2;
1707
1719
  if (((_b2 = (_a2 = event.nativeEvent) == null ? void 0 : _a2.contentSize) == null ? void 0 : _b2.height) === 0 && ((_c2 = event.nativeEvent.contentSize) == null ? void 0 : _c2.width) === 0) {
1708
1720
  return;
1709
1721
  }
1710
1722
  const state = refState.current;
1711
- if (state.ignoreScrollFromCalcTotal) {
1723
+ const newScroll = event.nativeEvent.contentOffset[horizontal ? "x" : "y"];
1724
+ if (state.ignoreScrollFromCalcTotal && newScroll !== 0) {
1712
1725
  return;
1713
1726
  }
1714
1727
  state.hasScrolled = true;
1715
1728
  state.lastBatchingAction = Date.now();
1716
1729
  const currentTime = performance.now();
1717
- const newScroll = event.nativeEvent.contentOffset[horizontal ? "x" : "y"];
1718
1730
  if (!(state.scrollHistory.length === 0 && newScroll === initialContentOffset)) {
1719
1731
  state.scrollHistory.push({ scroll: newScroll, time: currentTime });
1720
1732
  }
@@ -1744,7 +1756,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1744
1756
  checkAtBottom();
1745
1757
  checkAtTop();
1746
1758
  if (!fromSelf) {
1747
- onScrollProp == null ? void 0 : onScrollProp(event);
1759
+ (_d2 = state.onScroll) == null ? void 0 : _d2.call(state, event);
1748
1760
  }
1749
1761
  },
1750
1762
  []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "1.0.0-beta.25",
3
+ "version": "1.0.0-beta.26",
4
4
  "description": "Legend List aims to be a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,