@legendapp/list 2.0.0-next.12 → 2.0.0-next.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/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">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
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">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
6
+ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
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';
2
1
  import * as React$1 from 'react';
3
2
  import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
4
3
  import * as react_native from 'react-native';
5
4
  import { View, Animated, ScrollView, StyleProp, ViewStyle, ScrollViewProps, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
6
5
  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 {
@@ -391,17 +391,19 @@ interface LegendListRenderItemProps<ItemT, TItemType extends string | number | u
391
391
  }
392
392
  type ScrollState = {
393
393
  contentLength: number;
394
+ data: readonly any[];
394
395
  end: number;
395
396
  endBuffered: number;
396
397
  isAtEnd: boolean;
397
398
  isAtStart: boolean;
399
+ positionAtIndex: (index: number) => number;
398
400
  positions: Map<string, number>;
399
401
  scroll: number;
400
402
  scrollLength: number;
403
+ sizeAtIndex: (index: number) => number;
404
+ sizes: Map<string, number>;
401
405
  start: number;
402
406
  startBuffered: number;
403
- sizes: Map<string, number>;
404
- sizeAtIndex: (index: number) => number;
405
407
  };
406
408
  type LegendListRef = {
407
409
  /**
@@ -581,7 +583,9 @@ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps<ItemT>,
581
583
  children?: React$1.ReactNode | undefined;
582
584
  LegendList?: ListT;
583
585
  }
584
- declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
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"> & {
585
589
  alignItemsAtEnd?: boolean;
586
590
  columnWrapperStyle?: ColumnWrapperStyle;
587
591
  data: readonly T[];
@@ -647,7 +651,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
647
651
  stickyIndices?: number[];
648
652
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
649
653
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
650
- } & 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"> & {
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"> & {
651
655
  alignItemsAtEnd?: boolean;
652
656
  columnWrapperStyle?: ColumnWrapperStyle;
653
657
  data: readonly T[];
@@ -713,9 +717,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
713
717
  stickyIndices?: number[];
714
718
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
715
719
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
716
- } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
717
- ref?: React$1.Ref<LegendListRef>;
718
- }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
720
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
719
721
  alignItemsAtEnd?: boolean;
720
722
  columnWrapperStyle?: ColumnWrapperStyle;
721
723
  data: readonly T[];
@@ -783,7 +785,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
783
785
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
784
786
  } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
785
787
 
786
- declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
788
+ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
787
789
  alignItemsAtEnd?: boolean;
788
790
  columnWrapperStyle?: ColumnWrapperStyle;
789
791
  data: readonly T[];
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
2
1
  import * as React$1 from 'react';
3
2
  import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
4
3
  import * as react_native from 'react-native';
5
4
  import { View, Animated, ScrollView, StyleProp, ViewStyle, ScrollViewProps, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
6
5
  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 {
@@ -391,17 +391,19 @@ interface LegendListRenderItemProps<ItemT, TItemType extends string | number | u
391
391
  }
392
392
  type ScrollState = {
393
393
  contentLength: number;
394
+ data: readonly any[];
394
395
  end: number;
395
396
  endBuffered: number;
396
397
  isAtEnd: boolean;
397
398
  isAtStart: boolean;
399
+ positionAtIndex: (index: number) => number;
398
400
  positions: Map<string, number>;
399
401
  scroll: number;
400
402
  scrollLength: number;
403
+ sizeAtIndex: (index: number) => number;
404
+ sizes: Map<string, number>;
401
405
  start: number;
402
406
  startBuffered: number;
403
- sizes: Map<string, number>;
404
- sizeAtIndex: (index: number) => number;
405
407
  };
406
408
  type LegendListRef = {
407
409
  /**
@@ -581,7 +583,9 @@ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps<ItemT>,
581
583
  children?: React$1.ReactNode | undefined;
582
584
  LegendList?: ListT;
583
585
  }
584
- declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
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"> & {
585
589
  alignItemsAtEnd?: boolean;
586
590
  columnWrapperStyle?: ColumnWrapperStyle;
587
591
  data: readonly T[];
@@ -647,7 +651,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
647
651
  stickyIndices?: number[];
648
652
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
649
653
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
650
- } & 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"> & {
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"> & {
651
655
  alignItemsAtEnd?: boolean;
652
656
  columnWrapperStyle?: ColumnWrapperStyle;
653
657
  data: readonly T[];
@@ -713,9 +717,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
713
717
  stickyIndices?: number[];
714
718
  getItemType?: ((item: T, index: number) => string | undefined) | undefined;
715
719
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
716
- } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
717
- ref?: React$1.Ref<LegendListRef>;
718
- }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
720
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
719
721
  alignItemsAtEnd?: boolean;
720
722
  columnWrapperStyle?: ColumnWrapperStyle;
721
723
  data: readonly T[];
@@ -783,7 +785,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
783
785
  getFixedItemSize?: ((index: number, item: T, type: string | undefined) => number) | undefined;
784
786
  } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
785
787
 
786
- declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
788
+ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
787
789
  alignItemsAtEnd?: boolean;
788
790
  columnWrapperStyle?: ColumnWrapperStyle;
789
791
  data: readonly T[];
package/index.js CHANGED
@@ -1019,7 +1019,7 @@ function prepareMVCP(ctx, state, dataChanged) {
1019
1019
  }
1020
1020
  return () => {
1021
1021
  let positionDiff;
1022
- if (targetId === void 0) {
1022
+ if (dataChanged && targetId === void 0) {
1023
1023
  for (let i = 0; i < idsInViewWithPositions.length; i++) {
1024
1024
  const { id, position } = idsInViewWithPositions[i];
1025
1025
  const newPosition = positions.get(id);
@@ -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) {
@@ -2783,10 +2783,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2783
2783
  const state2 = refState.current;
2784
2784
  return state2 ? {
2785
2785
  contentLength: state2.totalSize,
2786
+ data: state2.props.data,
2786
2787
  end: state2.endNoBuffer,
2787
2788
  endBuffered: state2.endBuffered,
2788
2789
  isAtEnd: state2.isAtEnd,
2789
2790
  isAtStart: state2.isAtStart,
2791
+ positionAtIndex: (index) => state2.positions.get(getId(state2, index)),
2790
2792
  positions: state2.positions,
2791
2793
  scroll: state2.scroll,
2792
2794
  scrollLength: state2.scrollLength,
package/index.mjs CHANGED
@@ -998,7 +998,7 @@ function prepareMVCP(ctx, state, dataChanged) {
998
998
  }
999
999
  return () => {
1000
1000
  let positionDiff;
1001
- if (targetId === void 0) {
1001
+ if (dataChanged && targetId === void 0) {
1002
1002
  for (let i = 0; i < idsInViewWithPositions.length; i++) {
1003
1003
  const { id, position } = idsInViewWithPositions[i];
1004
1004
  const newPosition = positions.get(id);
@@ -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) {
@@ -2762,10 +2762,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2762
2762
  const state2 = refState.current;
2763
2763
  return state2 ? {
2764
2764
  contentLength: state2.totalSize,
2765
+ data: state2.props.data,
2765
2766
  end: state2.endNoBuffer,
2766
2767
  endBuffered: state2.endBuffered,
2767
2768
  isAtEnd: state2.isAtEnd,
2768
2769
  isAtStart: state2.isAtStart,
2770
+ positionAtIndex: (index) => state2.positions.get(getId(state2, index)),
2769
2771
  positions: state2.positions,
2770
2772
  scroll: state2.scroll,
2771
2773
  scrollLength: state2.scrollLength,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "2.0.0-next.12",
3
+ "version": "2.0.0-next.14",
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,
package/.DS_Store DELETED
Binary file