@legendapp/list 1.0.0-beta.31 → 1.0.0-beta.32

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.d.mts CHANGED
@@ -272,6 +272,7 @@ interface InternalState {
272
272
  queuedCalculateItemsInView: number | undefined;
273
273
  lastBatchingAction: number;
274
274
  ignoreScrollFromCalcTotal?: boolean;
275
+ scrollingToOffset?: number | undefined;
275
276
  onScroll: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
276
277
  }
277
278
  interface ViewableRange<T> {
package/index.d.ts CHANGED
@@ -272,6 +272,7 @@ interface InternalState {
272
272
  queuedCalculateItemsInView: number | undefined;
273
273
  lastBatchingAction: number;
274
274
  ignoreScrollFromCalcTotal?: boolean;
275
+ scrollingToOffset?: number | undefined;
275
276
  onScroll: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
276
277
  }
277
278
  interface ViewableRange<T> {
package/index.js CHANGED
@@ -1575,6 +1575,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1575
1575
  (_, i) => getId(dataProp.length - 1 - i)
1576
1576
  );
1577
1577
  }, [dataProp, numColumnsProp]);
1578
+ const stylePaddingTop = (_d = (_c = (_a = reactNative.StyleSheet.flatten(style)) == null ? void 0 : _a.paddingTop) != null ? _c : (_b = reactNative.StyleSheet.flatten(contentContainerStyle)) == null ? void 0 : _b.paddingTop) != null ? _d : 0;
1578
1579
  const initalizeStateVars = () => {
1579
1580
  set$(ctx, "lastItemKeys", memoizedLastItemKeys);
1580
1581
  set$(ctx, "numColumns", numColumnsProp);
@@ -1604,7 +1605,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1604
1605
  set$(ctx, "extraData", extraData);
1605
1606
  }, [extraData]);
1606
1607
  refState.current.renderItem = renderItem;
1607
- const stylePaddingTop = (_d = (_c = (_a = reactNative.StyleSheet.flatten(style)) == null ? void 0 : _a.paddingTop) != null ? _c : (_b = reactNative.StyleSheet.flatten(contentContainerStyle)) == null ? void 0 : _b.paddingTop) != null ? _d : 0;
1608
1608
  React6.useEffect(initalizeStateVars, [memoizedLastItemKeys.join(","), numColumnsProp, stylePaddingTop]);
1609
1609
  const getRenderedItem = React6.useCallback((key) => {
1610
1610
  var _a2, _b2;
@@ -1858,28 +1858,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1858
1858
  state.minIndexSizeChanged = index;
1859
1859
  firstIndexScrollPostion = firstIndexOffset - viewOffset + state.scrollAdjustHandler.getAppliedAdjust();
1860
1860
  }
1861
- state.scrollAdjustHandler.setDisableAdjust(true);
1862
- setTimeout(
1863
- () => {
1864
- state.scrollAdjustHandler.setDisableAdjust(false);
1865
- calculateItemsInView();
1866
- },
1867
- animated ? 150 : 50
1868
- );
1869
1861
  if (viewPosition) {
1870
1862
  firstIndexScrollPostion -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
1871
1863
  }
1864
+ state.scrollAdjustHandler.setDisableAdjust(true);
1865
+ state.scrollingToOffset = firstIndexScrollPostion;
1872
1866
  scrollTo(firstIndexScrollPostion, animated);
1873
- const totalSizeWithScrollAdjust = peek$(ctx, "totalSizeWithScrollAdjust");
1874
- if (maintainVisibleContentPosition && totalSizeWithScrollAdjust - firstIndexScrollPostion < state.scrollLength) {
1875
- const doScrollTo = () => {
1876
- scrollTo(firstIndexScrollPostion, animated);
1877
- };
1878
- setTimeout(doScrollTo, animated ? 150 : 50);
1879
- if (animated) {
1880
- setTimeout(doScrollTo, 350);
1881
- }
1882
- }
1883
1867
  };
1884
1868
  const scrollIndexIntoView = (options) => {
1885
1869
  if (refState.current) {
@@ -1962,6 +1946,17 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1962
1946
  updateItemSize,
1963
1947
  handleScroll,
1964
1948
  onMomentumScrollEnd: (event) => {
1949
+ var _a2;
1950
+ const scrollingToOffset = (_a2 = refState.current) == null ? void 0 : _a2.scrollingToOffset;
1951
+ if (scrollingToOffset !== void 0) {
1952
+ requestAnimationFrame(() => {
1953
+ scrollTo(scrollingToOffset, false);
1954
+ refState.current.scrollingToOffset = void 0;
1955
+ requestAnimationFrame(() => {
1956
+ refState.current.scrollAdjustHandler.setDisableAdjust(false);
1957
+ });
1958
+ });
1959
+ }
1965
1960
  const wasPaused = refState.current.scrollAdjustHandler.unPauseAdjust();
1966
1961
  if (wasPaused) {
1967
1962
  refState.current.scrollVelocity = 0;
package/index.mjs CHANGED
@@ -1554,6 +1554,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1554
1554
  (_, i) => getId(dataProp.length - 1 - i)
1555
1555
  );
1556
1556
  }, [dataProp, numColumnsProp]);
1557
+ const stylePaddingTop = (_d = (_c = (_a = StyleSheet.flatten(style)) == null ? void 0 : _a.paddingTop) != null ? _c : (_b = StyleSheet.flatten(contentContainerStyle)) == null ? void 0 : _b.paddingTop) != null ? _d : 0;
1557
1558
  const initalizeStateVars = () => {
1558
1559
  set$(ctx, "lastItemKeys", memoizedLastItemKeys);
1559
1560
  set$(ctx, "numColumns", numColumnsProp);
@@ -1583,7 +1584,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1583
1584
  set$(ctx, "extraData", extraData);
1584
1585
  }, [extraData]);
1585
1586
  refState.current.renderItem = renderItem;
1586
- const stylePaddingTop = (_d = (_c = (_a = StyleSheet.flatten(style)) == null ? void 0 : _a.paddingTop) != null ? _c : (_b = StyleSheet.flatten(contentContainerStyle)) == null ? void 0 : _b.paddingTop) != null ? _d : 0;
1587
1587
  useEffect(initalizeStateVars, [memoizedLastItemKeys.join(","), numColumnsProp, stylePaddingTop]);
1588
1588
  const getRenderedItem = useCallback((key) => {
1589
1589
  var _a2, _b2;
@@ -1837,28 +1837,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1837
1837
  state.minIndexSizeChanged = index;
1838
1838
  firstIndexScrollPostion = firstIndexOffset - viewOffset + state.scrollAdjustHandler.getAppliedAdjust();
1839
1839
  }
1840
- state.scrollAdjustHandler.setDisableAdjust(true);
1841
- setTimeout(
1842
- () => {
1843
- state.scrollAdjustHandler.setDisableAdjust(false);
1844
- calculateItemsInView();
1845
- },
1846
- animated ? 150 : 50
1847
- );
1848
1840
  if (viewPosition) {
1849
1841
  firstIndexScrollPostion -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
1850
1842
  }
1843
+ state.scrollAdjustHandler.setDisableAdjust(true);
1844
+ state.scrollingToOffset = firstIndexScrollPostion;
1851
1845
  scrollTo(firstIndexScrollPostion, animated);
1852
- const totalSizeWithScrollAdjust = peek$(ctx, "totalSizeWithScrollAdjust");
1853
- if (maintainVisibleContentPosition && totalSizeWithScrollAdjust - firstIndexScrollPostion < state.scrollLength) {
1854
- const doScrollTo = () => {
1855
- scrollTo(firstIndexScrollPostion, animated);
1856
- };
1857
- setTimeout(doScrollTo, animated ? 150 : 50);
1858
- if (animated) {
1859
- setTimeout(doScrollTo, 350);
1860
- }
1861
- }
1862
1846
  };
1863
1847
  const scrollIndexIntoView = (options) => {
1864
1848
  if (refState.current) {
@@ -1941,6 +1925,17 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1941
1925
  updateItemSize,
1942
1926
  handleScroll,
1943
1927
  onMomentumScrollEnd: (event) => {
1928
+ var _a2;
1929
+ const scrollingToOffset = (_a2 = refState.current) == null ? void 0 : _a2.scrollingToOffset;
1930
+ if (scrollingToOffset !== void 0) {
1931
+ requestAnimationFrame(() => {
1932
+ scrollTo(scrollingToOffset, false);
1933
+ refState.current.scrollingToOffset = void 0;
1934
+ requestAnimationFrame(() => {
1935
+ refState.current.scrollAdjustHandler.setDisableAdjust(false);
1936
+ });
1937
+ });
1938
+ }
1944
1939
  const wasPaused = refState.current.scrollAdjustHandler.unPauseAdjust();
1945
1940
  if (wasPaused) {
1946
1941
  refState.current.scrollVelocity = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "1.0.0-beta.31",
3
+ "version": "1.0.0-beta.32",
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,