@legendapp/list 1.1.2 → 1.1.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.1.4
2
+ - Feat: Add sizes to getState()
3
+
4
+ ## 1.1.3
5
+ - Fix: scrollToEnd was not always setting `viewPosition: 1` correctly
6
+
1
7
  ## 1.1.2
2
8
  - Fix: Adding items in a list with item separators had a small layout jump as the previously last item re-rendered with a separator
3
9
 
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[];
@@ -56,7 +56,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
56
56
  recycleItems?: boolean;
57
57
  refScrollView?: React.Ref<react_native.ScrollView>;
58
58
  refreshing?: boolean;
59
- renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
59
+ renderItem?: React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
60
60
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
61
61
  suggestEstimatedItemSize?: boolean;
62
62
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
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[];
@@ -56,7 +56,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
56
56
  recycleItems?: boolean;
57
57
  refScrollView?: React.Ref<react_native.ScrollView>;
58
58
  refreshing?: boolean;
59
- renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
59
+ renderItem?: React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
60
60
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
61
61
  suggestEstimatedItemSize?: boolean;
62
62
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
package/index.d.mts CHANGED
@@ -3,9 +3,9 @@ import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import * as react_native from 'react-native';
4
4
  import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
5
  import Animated from 'react-native-reanimated';
6
- import * as _legendapp_list from '@legendapp/list';
7
- import { LegendListProps as LegendListProps$1, LegendListRef as LegendListRef$1, LegendListRenderItemProps as LegendListRenderItemProps$1 } from '@legendapp/list';
8
6
  import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
7
+ import * as _legendapp_list from '@legendapp/list';
8
+ import { LegendListProps as LegendListProps$1, LegendListRenderItemProps as LegendListRenderItemProps$1, LegendListRef as LegendListRef$1 } from '@legendapp/list';
9
9
 
10
10
  declare class ScrollAdjustHandler {
11
11
  private ctx;
@@ -338,6 +338,8 @@ type ScrollState = {
338
338
  scrollLength: number;
339
339
  start: number;
340
340
  startBuffered: number;
341
+ sizes: Map<string, number>;
342
+ sizeAtIndex: (index: number) => number;
341
343
  };
342
344
  type LegendListRef = {
343
345
  /**
@@ -499,7 +501,7 @@ type ScrollIndexWithOffsetPosition = {
499
501
  viewPosition?: number;
500
502
  };
501
503
 
502
- declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
504
+ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
503
505
  alignItemsAtEnd?: boolean;
504
506
  columnWrapperStyle?: ColumnWrapperStyle;
505
507
  data: readonly T[];
@@ -552,7 +554,7 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
552
554
  recycleItems?: boolean;
553
555
  refScrollView?: React$1.Ref<ScrollView>;
554
556
  refreshing?: boolean;
555
- renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps<T>> | undefined;
557
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
556
558
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
557
559
  suggestEstimatedItemSize?: boolean;
558
560
  viewabilityConfig?: ViewabilityConfig;
@@ -567,9 +569,7 @@ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps$1<ItemT
567
569
  children?: React$1.ReactNode | undefined;
568
570
  LegendList?: ListT;
569
571
  }
570
- declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
571
- ref?: React$1.Ref<LegendListRef$1>;
572
- }) => React$1.ReactElement | null) | (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
572
+ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
573
573
  alignItemsAtEnd?: boolean;
574
574
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
575
575
  data: readonly T[];
@@ -622,7 +622,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
622
622
  recycleItems?: boolean;
623
623
  refScrollView?: React$1.Ref<react_native.ScrollView>;
624
624
  refreshing?: boolean;
625
- renderItem?: ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps$1<T>> | undefined;
625
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
626
626
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
627
627
  suggestEstimatedItemSize?: boolean;
628
628
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
@@ -631,7 +631,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
631
631
  onLoad?: (info: {
632
632
  elapsedTimeInMs: number;
633
633
  }) => void;
634
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
634
+ } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
635
635
  alignItemsAtEnd?: boolean;
636
636
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
637
637
  data: readonly T[];
@@ -684,7 +684,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
684
684
  recycleItems?: boolean;
685
685
  refScrollView?: React$1.Ref<react_native.ScrollView>;
686
686
  refreshing?: boolean;
687
- renderItem?: ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps$1<T>> | undefined;
687
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
688
688
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
689
689
  suggestEstimatedItemSize?: boolean;
690
690
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
@@ -693,7 +693,9 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
693
693
  onLoad?: (info: {
694
694
  elapsedTimeInMs: number;
695
695
  }) => void;
696
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
696
+ } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
697
+ ref?: React$1.Ref<LegendListRef$1>;
698
+ }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
697
699
  alignItemsAtEnd?: boolean;
698
700
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
699
701
  data: readonly T[];
@@ -746,7 +748,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
746
748
  recycleItems?: boolean;
747
749
  refScrollView?: React$1.Ref<react_native.ScrollView>;
748
750
  refreshing?: boolean;
749
- renderItem?: ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps$1<T>> | undefined;
751
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
750
752
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
751
753
  suggestEstimatedItemSize?: boolean;
752
754
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
package/index.d.ts CHANGED
@@ -3,9 +3,9 @@ import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import * as react_native from 'react-native';
4
4
  import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
5
  import Animated from 'react-native-reanimated';
6
- import * as _legendapp_list from '@legendapp/list';
7
- import { LegendListProps as LegendListProps$1, LegendListRef as LegendListRef$1, LegendListRenderItemProps as LegendListRenderItemProps$1 } from '@legendapp/list';
8
6
  import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
7
+ import * as _legendapp_list from '@legendapp/list';
8
+ import { LegendListProps as LegendListProps$1, LegendListRenderItemProps as LegendListRenderItemProps$1, LegendListRef as LegendListRef$1 } from '@legendapp/list';
9
9
 
10
10
  declare class ScrollAdjustHandler {
11
11
  private ctx;
@@ -338,6 +338,8 @@ type ScrollState = {
338
338
  scrollLength: number;
339
339
  start: number;
340
340
  startBuffered: number;
341
+ sizes: Map<string, number>;
342
+ sizeAtIndex: (index: number) => number;
341
343
  };
342
344
  type LegendListRef = {
343
345
  /**
@@ -499,7 +501,7 @@ type ScrollIndexWithOffsetPosition = {
499
501
  viewPosition?: number;
500
502
  };
501
503
 
502
- declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
504
+ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
503
505
  alignItemsAtEnd?: boolean;
504
506
  columnWrapperStyle?: ColumnWrapperStyle;
505
507
  data: readonly T[];
@@ -552,7 +554,7 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
552
554
  recycleItems?: boolean;
553
555
  refScrollView?: React$1.Ref<ScrollView>;
554
556
  refreshing?: boolean;
555
- renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps<T>> | undefined;
557
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
556
558
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
557
559
  suggestEstimatedItemSize?: boolean;
558
560
  viewabilityConfig?: ViewabilityConfig;
@@ -567,9 +569,7 @@ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps$1<ItemT
567
569
  children?: React$1.ReactNode | undefined;
568
570
  LegendList?: ListT;
569
571
  }
570
- declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
571
- ref?: React$1.Ref<LegendListRef$1>;
572
- }) => React$1.ReactElement | null) | (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
572
+ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
573
573
  alignItemsAtEnd?: boolean;
574
574
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
575
575
  data: readonly T[];
@@ -622,7 +622,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
622
622
  recycleItems?: boolean;
623
623
  refScrollView?: React$1.Ref<react_native.ScrollView>;
624
624
  refreshing?: boolean;
625
- renderItem?: ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps$1<T>> | undefined;
625
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
626
626
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
627
627
  suggestEstimatedItemSize?: boolean;
628
628
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
@@ -631,7 +631,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
631
631
  onLoad?: (info: {
632
632
  elapsedTimeInMs: number;
633
633
  }) => void;
634
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
634
+ } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
635
635
  alignItemsAtEnd?: boolean;
636
636
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
637
637
  data: readonly T[];
@@ -684,7 +684,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
684
684
  recycleItems?: boolean;
685
685
  refScrollView?: React$1.Ref<react_native.ScrollView>;
686
686
  refreshing?: boolean;
687
- renderItem?: ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps$1<T>> | undefined;
687
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
688
688
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
689
689
  suggestEstimatedItemSize?: boolean;
690
690
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
@@ -693,7 +693,9 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
693
693
  onLoad?: (info: {
694
694
  elapsedTimeInMs: number;
695
695
  }) => void;
696
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "removeClippedSubviews" | "stickyHeaderIndices" | "children" | "contentInset" | "contentOffset" | "maintainVisibleContentPosition"> & {
696
+ } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
697
+ ref?: React$1.Ref<LegendListRef$1>;
698
+ }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
697
699
  alignItemsAtEnd?: boolean;
698
700
  columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
699
701
  data: readonly T[];
@@ -746,7 +748,7 @@ declare const LazyLegendList: <ItemT, ListT extends (<ItemT_1>(props: _legendapp
746
748
  recycleItems?: boolean;
747
749
  refScrollView?: React$1.Ref<react_native.ScrollView>;
748
750
  refreshing?: boolean;
749
- renderItem?: ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | React$1.ComponentType<LegendListRenderItemProps$1<T>> | undefined;
751
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
750
752
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
751
753
  suggestEstimatedItemSize?: boolean;
752
754
  viewabilityConfig?: _legendapp_list.ViewabilityConfig;
package/index.js CHANGED
@@ -1227,7 +1227,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1227
1227
  index,
1228
1228
  viewOffset = 0,
1229
1229
  animated = true,
1230
- viewPosition = 0
1230
+ viewPosition
1231
1231
  }) => {
1232
1232
  var _a;
1233
1233
  const state = refState.current;
@@ -1256,7 +1256,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1256
1256
  state.minIndexSizeChanged = index;
1257
1257
  firstIndexScrollPostion = firstIndexOffset - viewOffset + state.scrollAdjustHandler.getAppliedAdjust();
1258
1258
  }
1259
- scrollTo({ offset: firstIndexScrollPostion, animated, index, viewPosition, viewOffset });
1259
+ scrollTo({ offset: firstIndexScrollPostion, animated, index, viewPosition: viewPosition != null ? viewPosition : 0, viewOffset });
1260
1260
  };
1261
1261
  const setDidLayout = () => {
1262
1262
  refState.current.queuedInitialLayout = true;
@@ -2268,7 +2268,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2268
2268
  const num = sizesKnown.size;
2269
2269
  const avg = state.averageSizes[""].avg;
2270
2270
  console.warn(
2271
- `[legend-list] estimatedItemSize or getEstimatedItemSize are not defined. Based on the ${num} items rendered so far, the optimal estimated size is ${avg}.`
2271
+ `[legend-list] Based on the ${num} items rendered so far, the optimal estimated size is ${avg}.`
2272
2272
  );
2273
2273
  }, 1e3);
2274
2274
  }
@@ -2486,7 +2486,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2486
2486
  scroll: state.scroll,
2487
2487
  scrollLength: state.scrollLength,
2488
2488
  start: state.startNoBuffer,
2489
- startBuffered: state.startBuffered
2489
+ startBuffered: state.startBuffered,
2490
+ sizes: state.sizesKnown,
2491
+ sizeAtIndex: (index) => state.sizesKnown.get(getId(index))
2490
2492
  } : {};
2491
2493
  },
2492
2494
  scrollIndexIntoView,
@@ -2512,7 +2514,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2512
2514
  if (index !== -1) {
2513
2515
  const paddingBottom = stylePaddingBottom || 0;
2514
2516
  const footerSize = peek$(ctx, "footerSize") || 0;
2515
- scrollToIndex({ index, viewOffset: -paddingBottom - footerSize, ...options });
2517
+ scrollToIndex({ index, viewPosition: 1, viewOffset: -paddingBottom - footerSize, ...options });
2516
2518
  }
2517
2519
  }
2518
2520
  };
package/index.mjs CHANGED
@@ -1206,7 +1206,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1206
1206
  index,
1207
1207
  viewOffset = 0,
1208
1208
  animated = true,
1209
- viewPosition = 0
1209
+ viewPosition
1210
1210
  }) => {
1211
1211
  var _a;
1212
1212
  const state = refState.current;
@@ -1235,7 +1235,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1235
1235
  state.minIndexSizeChanged = index;
1236
1236
  firstIndexScrollPostion = firstIndexOffset - viewOffset + state.scrollAdjustHandler.getAppliedAdjust();
1237
1237
  }
1238
- scrollTo({ offset: firstIndexScrollPostion, animated, index, viewPosition, viewOffset });
1238
+ scrollTo({ offset: firstIndexScrollPostion, animated, index, viewPosition: viewPosition != null ? viewPosition : 0, viewOffset });
1239
1239
  };
1240
1240
  const setDidLayout = () => {
1241
1241
  refState.current.queuedInitialLayout = true;
@@ -2247,7 +2247,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2247
2247
  const num = sizesKnown.size;
2248
2248
  const avg = state.averageSizes[""].avg;
2249
2249
  console.warn(
2250
- `[legend-list] estimatedItemSize or getEstimatedItemSize are not defined. Based on the ${num} items rendered so far, the optimal estimated size is ${avg}.`
2250
+ `[legend-list] Based on the ${num} items rendered so far, the optimal estimated size is ${avg}.`
2251
2251
  );
2252
2252
  }, 1e3);
2253
2253
  }
@@ -2465,7 +2465,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2465
2465
  scroll: state.scroll,
2466
2466
  scrollLength: state.scrollLength,
2467
2467
  start: state.startNoBuffer,
2468
- startBuffered: state.startBuffered
2468
+ startBuffered: state.startBuffered,
2469
+ sizes: state.sizesKnown,
2470
+ sizeAtIndex: (index) => state.sizesKnown.get(getId(index))
2469
2471
  } : {};
2470
2472
  },
2471
2473
  scrollIndexIntoView,
@@ -2491,7 +2493,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
2491
2493
  if (index !== -1) {
2492
2494
  const paddingBottom = stylePaddingBottom || 0;
2493
2495
  const footerSize = peek$(ctx, "footerSize") || 0;
2494
- scrollToIndex({ index, viewOffset: -paddingBottom - footerSize, ...options });
2496
+ scrollToIndex({ index, viewPosition: 1, viewOffset: -paddingBottom - footerSize, ...options });
2495
2497
  }
2496
2498
  }
2497
2499
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
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