@legendapp/list 2.0.0-next.13 → 2.0.0-next.15

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/.DS_Store ADDED
Binary file
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<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
7
7
  alignItemsAtEnd?: boolean;
8
8
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
9
9
  data: readonly T[];
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<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
7
7
  alignItemsAtEnd?: boolean;
8
8
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
9
9
  data: readonly T[];
package/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
+ import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
1
2
  import * as React$1 from 'react';
2
3
  import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
3
4
  import * as react_native from 'react-native';
4
5
  import { View, Animated, ScrollView, StyleProp, ViewStyle, ScrollViewProps, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
6
  import Animated$1 from 'react-native-reanimated';
6
- import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
7
7
 
8
8
  type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize";
9
9
  interface StateContext {
@@ -583,9 +583,7 @@ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps<ItemT>,
583
583
  children?: React$1.ReactNode | undefined;
584
584
  LegendList?: ListT;
585
585
  }
586
- declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
587
- ref?: React$1.Ref<LegendListRef>;
588
- }) => React$1.ReactElement | null) | (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
586
+ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
589
587
  alignItemsAtEnd?: boolean;
590
588
  columnWrapperStyle?: ColumnWrapperStyle;
591
589
  data: readonly T[];
@@ -651,7 +649,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
651
649
  stickyIndices?: number[];
652
650
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
653
651
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
654
- } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
652
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
655
653
  alignItemsAtEnd?: boolean;
656
654
  columnWrapperStyle?: ColumnWrapperStyle;
657
655
  data: readonly T[];
@@ -717,7 +715,9 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
717
715
  stickyIndices?: number[];
718
716
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
719
717
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
720
- } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
718
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
719
+ ref?: React$1.Ref<LegendListRef>;
720
+ }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
721
721
  alignItemsAtEnd?: boolean;
722
722
  columnWrapperStyle?: ColumnWrapperStyle;
723
723
  data: readonly T[];
@@ -785,7 +785,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
785
785
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
786
786
  } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
787
787
 
788
- declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
788
+ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
789
789
  alignItemsAtEnd?: boolean;
790
790
  columnWrapperStyle?: ColumnWrapperStyle;
791
791
  data: readonly T[];
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
+ import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
1
2
  import * as React$1 from 'react';
2
3
  import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
3
4
  import * as react_native from 'react-native';
4
5
  import { View, Animated, ScrollView, StyleProp, ViewStyle, ScrollViewProps, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
6
  import Animated$1 from 'react-native-reanimated';
6
- import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
7
7
 
8
8
  type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize";
9
9
  interface StateContext {
@@ -583,9 +583,7 @@ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps<ItemT>,
583
583
  children?: React$1.ReactNode | undefined;
584
584
  LegendList?: ListT;
585
585
  }
586
- declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
587
- ref?: React$1.Ref<LegendListRef>;
588
- }) => React$1.ReactElement | null) | (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
586
+ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
589
587
  alignItemsAtEnd?: boolean;
590
588
  columnWrapperStyle?: ColumnWrapperStyle;
591
589
  data: readonly T[];
@@ -651,7 +649,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
651
649
  stickyIndices?: number[];
652
650
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
653
651
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
654
- } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
652
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
655
653
  alignItemsAtEnd?: boolean;
656
654
  columnWrapperStyle?: ColumnWrapperStyle;
657
655
  data: readonly T[];
@@ -717,7 +715,9 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
717
715
  stickyIndices?: number[];
718
716
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
719
717
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
720
- } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
718
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
719
+ ref?: React$1.Ref<LegendListRef>;
720
+ }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
721
721
  alignItemsAtEnd?: boolean;
722
722
  columnWrapperStyle?: ColumnWrapperStyle;
723
723
  data: readonly T[];
@@ -785,7 +785,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
785
785
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
786
786
  } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
787
787
 
788
- declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
788
+ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
789
789
  alignItemsAtEnd?: boolean;
790
790
  columnWrapperStyle?: ColumnWrapperStyle;
791
791
  data: readonly T[];
package/index.js CHANGED
@@ -1193,7 +1193,7 @@ function updateAllPositions(ctx, state, dataChanged) {
1193
1193
  idCache.clear();
1194
1194
  positions.clear();
1195
1195
  }
1196
- const useAverageSize = !getEstimatedItemSize;
1196
+ const useAverageSize = false;
1197
1197
  const itemType = "";
1198
1198
  let averageSize = (_a = averageSizes[itemType]) == null ? void 0 : _a.avg;
1199
1199
  if (averageSize !== void 0) {
@@ -2345,7 +2345,13 @@ function updateItemSize(ctx, state, itemKey, sizeObj) {
2345
2345
  } = state;
2346
2346
  if (getFixedItemSize) {
2347
2347
  const index = state.indexByKey.get(itemKey);
2348
+ if (index === void 0) {
2349
+ return;
2350
+ }
2348
2351
  const itemData = state.props.data[index];
2352
+ if (itemData === void 0) {
2353
+ return;
2354
+ }
2349
2355
  const type = getItemType ? (_a = getItemType(itemData, index)) != null ? _a : "" : "";
2350
2356
  const size = getFixedItemSize(index, itemData, type);
2351
2357
  if (size !== void 0 && size === sizesKnown.get(itemKey)) {
@@ -2374,14 +2380,14 @@ function updateOneItemSize(state, itemKey, sizeObj) {
2374
2380
  indexByKey,
2375
2381
  sizesKnown,
2376
2382
  averageSizes,
2377
- props: { data, horizontal, getEstimatedItemSize, getItemType }
2383
+ props: { data, horizontal, getEstimatedItemSize, getItemType, getFixedItemSize }
2378
2384
  } = state;
2379
2385
  if (!data) return 0;
2380
2386
  const index = indexByKey.get(itemKey);
2381
2387
  const prevSize = getItemSize(state, itemKey, index, data);
2382
2388
  const size = Math.floor((horizontal ? sizeObj.width : sizeObj.height) * 8) / 8;
2383
2389
  sizesKnown.set(itemKey, size);
2384
- if (!getEstimatedItemSize) {
2390
+ if (!getEstimatedItemSize && !getFixedItemSize) {
2385
2391
  const itemType = getItemType ? (_a = getItemType(data[index], index)) != null ? _a : "" : "";
2386
2392
  let averages = averageSizes[itemType];
2387
2393
  if (!averages) {
@@ -2692,9 +2698,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2692
2698
  }
2693
2699
  }
2694
2700
  }
2695
- if (!isFirst) {
2696
- calculateItemsInView(ctx, state, { doMVCP: true });
2697
- }
2698
2701
  }, [dataProp]);
2699
2702
  const onLayoutHeader = React3.useCallback((rect, fromLayoutEffect) => {
2700
2703
  const size = rect[horizontal ? "width" : "height"];
package/index.mjs CHANGED
@@ -1172,7 +1172,7 @@ function updateAllPositions(ctx, state, dataChanged) {
1172
1172
  idCache.clear();
1173
1173
  positions.clear();
1174
1174
  }
1175
- const useAverageSize = !getEstimatedItemSize;
1175
+ const useAverageSize = false;
1176
1176
  const itemType = "";
1177
1177
  let averageSize = (_a = averageSizes[itemType]) == null ? void 0 : _a.avg;
1178
1178
  if (averageSize !== void 0) {
@@ -2324,7 +2324,13 @@ function updateItemSize(ctx, state, itemKey, sizeObj) {
2324
2324
  } = state;
2325
2325
  if (getFixedItemSize) {
2326
2326
  const index = state.indexByKey.get(itemKey);
2327
+ if (index === void 0) {
2328
+ return;
2329
+ }
2327
2330
  const itemData = state.props.data[index];
2331
+ if (itemData === void 0) {
2332
+ return;
2333
+ }
2328
2334
  const type = getItemType ? (_a = getItemType(itemData, index)) != null ? _a : "" : "";
2329
2335
  const size = getFixedItemSize(index, itemData, type);
2330
2336
  if (size !== void 0 && size === sizesKnown.get(itemKey)) {
@@ -2353,14 +2359,14 @@ function updateOneItemSize(state, itemKey, sizeObj) {
2353
2359
  indexByKey,
2354
2360
  sizesKnown,
2355
2361
  averageSizes,
2356
- props: { data, horizontal, getEstimatedItemSize, getItemType }
2362
+ props: { data, horizontal, getEstimatedItemSize, getItemType, getFixedItemSize }
2357
2363
  } = state;
2358
2364
  if (!data) return 0;
2359
2365
  const index = indexByKey.get(itemKey);
2360
2366
  const prevSize = getItemSize(state, itemKey, index, data);
2361
2367
  const size = Math.floor((horizontal ? sizeObj.width : sizeObj.height) * 8) / 8;
2362
2368
  sizesKnown.set(itemKey, size);
2363
- if (!getEstimatedItemSize) {
2369
+ if (!getEstimatedItemSize && !getFixedItemSize) {
2364
2370
  const itemType = getItemType ? (_a = getItemType(data[index], index)) != null ? _a : "" : "";
2365
2371
  let averages = averageSizes[itemType];
2366
2372
  if (!averages) {
@@ -2671,9 +2677,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2671
2677
  }
2672
2678
  }
2673
2679
  }
2674
- if (!isFirst) {
2675
- calculateItemsInView(ctx, state, { doMVCP: true });
2676
- }
2677
2680
  }, [dataProp]);
2678
2681
  const onLayoutHeader = useCallback((rect, fromLayoutEffect) => {
2679
2682
  const size = rect[horizontal ? "width" : "height"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "2.0.0-next.13",
3
+ "version": "2.0.0-next.15",
4
4
  "description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
5
5
  "sideEffects": false,
6
6
  "private": false,