@legendapp/list 1.1.3 → 2.0.0-next.0

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,6 @@
1
+ ## 1.1.4
2
+ - Feat: Add sizes to getState()
3
+
1
4
  ## 1.1.3
2
5
  - Fix: scrollToEnd was not always setting `viewPosition: 1` correctly
3
6
 
package/index.d.mts CHANGED
@@ -1,26 +1,29 @@
1
1
  import * as React$1 from 'react';
2
2
  import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import * as react_native from 'react-native';
4
- import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
4
+ import { View, ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
5
  import Animated from 'react-native-reanimated';
6
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';
7
+
8
+ type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "scrollSize";
9
+ interface StateContext {
10
+ listeners: Map<ListenerType, Set<(value: any) => void>>;
11
+ values: Map<ListenerType, any>;
12
+ mapViewabilityCallbacks: Map<string, ViewabilityCallback>;
13
+ mapViewabilityValues: Map<string, ViewToken>;
14
+ mapViewabilityAmountCallbacks: Map<number, ViewabilityAmountCallback>;
15
+ mapViewabilityAmountValues: Map<number, ViewAmountToken>;
16
+ columnWrapperStyle: ColumnWrapperStyle | undefined;
17
+ viewRefs: Map<number, React$1.RefObject<View>>;
18
+ }
9
19
 
10
20
  declare class ScrollAdjustHandler {
11
- private ctx;
12
21
  private appliedAdjust;
13
- private busy;
14
22
  private context;
15
- private isPaused;
16
- private isDisabled;
17
- constructor(ctx: any);
18
- private doAjdust;
19
- requestAdjust(adjust: number, onAdjusted: (diff: number) => void): void;
20
- getAppliedAdjust(): number;
21
- pauseAdjust(): void;
22
- setDisableAdjust(disable: boolean): void;
23
- unPauseAdjust(): boolean;
23
+ private mounted;
24
+ constructor(ctx: StateContext);
25
+ requestAdjust(add: number): void;
26
+ setMounted(): void;
24
27
  }
25
28
 
26
29
  type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
@@ -235,23 +238,13 @@ interface ColumnWrapperStyle {
235
238
  gap?: number;
236
239
  columnGap?: number;
237
240
  }
238
- type AnchoredPosition = {
239
- type: "top" | "bottom";
240
- relativeCoordinate: number;
241
- top: number;
242
- };
243
241
  type LegendListProps<ItemT> = LegendListPropsBase<ItemT, Omit<ComponentProps<typeof ScrollView>, "scrollEventThrottle">>;
244
242
  interface InternalState {
245
- anchorElement?: {
246
- id: string;
247
- coordinate: number;
248
- };
249
- belowAnchorElementPositions?: Map<string, number>;
250
- rowHeights: Map<number, number>;
251
243
  positions: Map<string, number>;
252
244
  columns: Map<string, number>;
253
245
  sizes: Map<string, number>;
254
246
  sizesKnown: Map<string, number>;
247
+ containerItemKeys: Set<string>;
255
248
  pendingAdjust: number;
256
249
  isStartReached: boolean;
257
250
  isEndReached: boolean;
@@ -265,28 +258,28 @@ interface InternalState {
265
258
  startNoBuffer: number;
266
259
  endBuffered: number;
267
260
  endNoBuffer: number;
261
+ firstFullyOnScreenIndex: number;
262
+ idsInView: string[];
268
263
  scrollPending: number;
269
264
  scroll: number;
270
265
  scrollTime: number;
271
266
  scrollPrev: number;
272
267
  scrollPrevTime: number;
273
- scrollVelocity: number;
274
268
  scrollAdjustHandler: ScrollAdjustHandler;
275
269
  maintainingScrollAtEnd?: boolean;
276
270
  totalSize: number;
277
- totalSizeBelowAnchor: number;
278
271
  otherAxisSize?: number;
279
272
  timeouts: Set<number>;
280
273
  timeoutSizeMessage: any;
281
274
  nativeMarginTop: number;
282
275
  indexByKey: Map<string, number>;
276
+ idCache: Map<number, string>;
283
277
  viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs | undefined;
284
278
  renderItem: ((props: LegendListRenderItemProps<any>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<any>>;
285
279
  scrollHistory: Array<{
286
280
  scroll: number;
287
281
  time: number;
288
282
  }>;
289
- scrollTimer: Timer | undefined;
290
283
  startReachedBlockedByTimer: boolean;
291
284
  endReachedBlockedByTimer: boolean;
292
285
  scrollForNextCalculateItemsInView: {
@@ -298,8 +291,11 @@ interface InternalState {
298
291
  queuedInitialLayout?: boolean | undefined;
299
292
  queuedCalculateItemsInView: number | undefined;
300
293
  lastBatchingAction: number;
301
- ignoreScrollFromCalcTotal?: boolean;
302
- disableScrollJumpsFrom?: number;
294
+ ignoreScrollFromMVCP?: {
295
+ lt?: number;
296
+ gt?: number;
297
+ };
298
+ ignoreScrollFromMVCPTimeout?: any;
303
299
  scrollingTo?: {
304
300
  offset: number;
305
301
  index?: number;
@@ -307,7 +303,6 @@ interface InternalState {
307
303
  viewPosition?: number;
308
304
  animated?: boolean;
309
305
  } | undefined;
310
- previousTotalSize?: number;
311
306
  needsOtherAxisSize?: boolean;
312
307
  averageSizes: Record<string, {
313
308
  num: number;
@@ -338,6 +333,8 @@ type ScrollState = {
338
333
  scrollLength: number;
339
334
  start: number;
340
335
  startBuffered: number;
336
+ sizes: Map<string, number>;
337
+ sizeAtIndex: (index: number) => number;
341
338
  };
342
339
  type LegendListRef = {
343
340
  /**
@@ -426,6 +423,12 @@ type LegendListRef = {
426
423
  offset: number;
427
424
  animated?: boolean | undefined;
428
425
  }): void;
426
+ /**
427
+ * Sets or adds to the offset of the visible content anchor.
428
+ * @param value - The offset to set or add.
429
+ * @param animated - If true, uses Animated to animate the change.
430
+ */
431
+ setVisibleContentAnchorOffset(value: number | ((value: number) => number)): void;
429
432
  };
430
433
  interface ViewToken<ItemT = any> {
431
434
  item: ItemT;
@@ -498,6 +501,12 @@ type ScrollIndexWithOffsetPosition = {
498
501
  viewOffset?: number;
499
502
  viewPosition?: number;
500
503
  };
504
+ type GetRenderedItemResult<ItemT> = {
505
+ index: number;
506
+ item: ItemT;
507
+ renderedItem: React.ReactNode;
508
+ };
509
+ type GetRenderedItem = (key: string) => GetRenderedItemResult<any> | null;
501
510
 
502
511
  declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
503
512
  alignItemsAtEnd?: boolean;
@@ -563,13 +572,13 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
563
572
  }) => void;
564
573
  } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
565
574
 
566
- interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps$1<ItemT>, "data" | "keyExtractor" | "renderItem"> {
575
+ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps<ItemT>, "data" | "keyExtractor" | "renderItem"> {
567
576
  children?: React$1.ReactNode | undefined;
568
577
  LegendList?: ListT;
569
578
  }
570
579
  declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
571
580
  alignItemsAtEnd?: boolean;
572
- columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
581
+ columnWrapperStyle?: ColumnWrapperStyle;
573
582
  data: readonly T[];
574
583
  drawDistance?: number;
575
584
  estimatedItemSize?: number;
@@ -615,23 +624,23 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
615
624
  distanceFromStart: number;
616
625
  }) => void) | null | undefined;
617
626
  onStartReachedThreshold?: number | null | undefined;
618
- onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
627
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
619
628
  progressViewOffset?: number;
620
629
  recycleItems?: boolean;
621
630
  refScrollView?: React$1.Ref<react_native.ScrollView>;
622
631
  refreshing?: boolean;
623
- renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
632
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
624
633
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
625
634
  suggestEstimatedItemSize?: boolean;
626
- viewabilityConfig?: _legendapp_list.ViewabilityConfig;
627
- viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
635
+ viewabilityConfig?: ViewabilityConfig;
636
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
628
637
  waitForInitialLayout?: boolean;
629
638
  onLoad?: (info: {
630
639
  elapsedTimeInMs: number;
631
640
  }) => void;
632
- } & 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"> & {
641
+ } & 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"> & {
633
642
  alignItemsAtEnd?: boolean;
634
- columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
643
+ columnWrapperStyle?: ColumnWrapperStyle;
635
644
  data: readonly T[];
636
645
  drawDistance?: number;
637
646
  estimatedItemSize?: number;
@@ -677,25 +686,25 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
677
686
  distanceFromStart: number;
678
687
  }) => void) | null | undefined;
679
688
  onStartReachedThreshold?: number | null | undefined;
680
- onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
689
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
681
690
  progressViewOffset?: number;
682
691
  recycleItems?: boolean;
683
692
  refScrollView?: React$1.Ref<react_native.ScrollView>;
684
693
  refreshing?: boolean;
685
- renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
694
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
686
695
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
687
696
  suggestEstimatedItemSize?: boolean;
688
- viewabilityConfig?: _legendapp_list.ViewabilityConfig;
689
- viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
697
+ viewabilityConfig?: ViewabilityConfig;
698
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
690
699
  waitForInitialLayout?: boolean;
691
700
  onLoad?: (info: {
692
701
  elapsedTimeInMs: number;
693
702
  }) => void;
694
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
695
- ref?: React$1.Ref<LegendListRef$1>;
703
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
704
+ ref?: React$1.Ref<LegendListRef>;
696
705
  }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
697
706
  alignItemsAtEnd?: boolean;
698
- columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
707
+ columnWrapperStyle?: ColumnWrapperStyle;
699
708
  data: readonly T[];
700
709
  drawDistance?: number;
701
710
  estimatedItemSize?: number;
@@ -741,21 +750,21 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
741
750
  distanceFromStart: number;
742
751
  }) => void) | null | undefined;
743
752
  onStartReachedThreshold?: number | null | undefined;
744
- onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
753
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
745
754
  progressViewOffset?: number;
746
755
  recycleItems?: boolean;
747
756
  refScrollView?: React$1.Ref<react_native.ScrollView>;
748
757
  refreshing?: boolean;
749
- renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
758
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
750
759
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
751
760
  suggestEstimatedItemSize?: boolean;
752
- viewabilityConfig?: _legendapp_list.ViewabilityConfig;
753
- viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
761
+ viewabilityConfig?: ViewabilityConfig;
762
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
754
763
  waitForInitialLayout?: boolean;
755
764
  onLoad?: (info: {
756
765
  elapsedTimeInMs: number;
757
766
  }) => void;
758
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode;
767
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
759
768
 
760
769
  declare function useViewability(callback: ViewabilityCallback, configId?: string): void;
761
770
  declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
@@ -767,4 +776,4 @@ declare function useListScrollSize(): {
767
776
  height: number;
768
777
  };
769
778
 
770
- export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LazyLegendList, type LazyLegendListProps, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollIndexWithOffsetPosition, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
779
+ export { type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InternalState, LazyLegendList, type LazyLegendListProps, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollIndexWithOffsetPosition, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
package/index.d.ts CHANGED
@@ -1,26 +1,29 @@
1
1
  import * as React$1 from 'react';
2
2
  import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
3
3
  import * as react_native from 'react-native';
4
- import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
4
+ import { View, ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
5
5
  import Animated from 'react-native-reanimated';
6
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';
7
+
8
+ type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "scrollSize";
9
+ interface StateContext {
10
+ listeners: Map<ListenerType, Set<(value: any) => void>>;
11
+ values: Map<ListenerType, any>;
12
+ mapViewabilityCallbacks: Map<string, ViewabilityCallback>;
13
+ mapViewabilityValues: Map<string, ViewToken>;
14
+ mapViewabilityAmountCallbacks: Map<number, ViewabilityAmountCallback>;
15
+ mapViewabilityAmountValues: Map<number, ViewAmountToken>;
16
+ columnWrapperStyle: ColumnWrapperStyle | undefined;
17
+ viewRefs: Map<number, React$1.RefObject<View>>;
18
+ }
9
19
 
10
20
  declare class ScrollAdjustHandler {
11
- private ctx;
12
21
  private appliedAdjust;
13
- private busy;
14
22
  private context;
15
- private isPaused;
16
- private isDisabled;
17
- constructor(ctx: any);
18
- private doAjdust;
19
- requestAdjust(adjust: number, onAdjusted: (diff: number) => void): void;
20
- getAppliedAdjust(): number;
21
- pauseAdjust(): void;
22
- setDisableAdjust(disable: boolean): void;
23
- unPauseAdjust(): boolean;
23
+ private mounted;
24
+ constructor(ctx: StateContext);
25
+ requestAdjust(add: number): void;
26
+ setMounted(): void;
24
27
  }
25
28
 
26
29
  type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
@@ -235,23 +238,13 @@ interface ColumnWrapperStyle {
235
238
  gap?: number;
236
239
  columnGap?: number;
237
240
  }
238
- type AnchoredPosition = {
239
- type: "top" | "bottom";
240
- relativeCoordinate: number;
241
- top: number;
242
- };
243
241
  type LegendListProps<ItemT> = LegendListPropsBase<ItemT, Omit<ComponentProps<typeof ScrollView>, "scrollEventThrottle">>;
244
242
  interface InternalState {
245
- anchorElement?: {
246
- id: string;
247
- coordinate: number;
248
- };
249
- belowAnchorElementPositions?: Map<string, number>;
250
- rowHeights: Map<number, number>;
251
243
  positions: Map<string, number>;
252
244
  columns: Map<string, number>;
253
245
  sizes: Map<string, number>;
254
246
  sizesKnown: Map<string, number>;
247
+ containerItemKeys: Set<string>;
255
248
  pendingAdjust: number;
256
249
  isStartReached: boolean;
257
250
  isEndReached: boolean;
@@ -265,28 +258,28 @@ interface InternalState {
265
258
  startNoBuffer: number;
266
259
  endBuffered: number;
267
260
  endNoBuffer: number;
261
+ firstFullyOnScreenIndex: number;
262
+ idsInView: string[];
268
263
  scrollPending: number;
269
264
  scroll: number;
270
265
  scrollTime: number;
271
266
  scrollPrev: number;
272
267
  scrollPrevTime: number;
273
- scrollVelocity: number;
274
268
  scrollAdjustHandler: ScrollAdjustHandler;
275
269
  maintainingScrollAtEnd?: boolean;
276
270
  totalSize: number;
277
- totalSizeBelowAnchor: number;
278
271
  otherAxisSize?: number;
279
272
  timeouts: Set<number>;
280
273
  timeoutSizeMessage: any;
281
274
  nativeMarginTop: number;
282
275
  indexByKey: Map<string, number>;
276
+ idCache: Map<number, string>;
283
277
  viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs | undefined;
284
278
  renderItem: ((props: LegendListRenderItemProps<any>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<any>>;
285
279
  scrollHistory: Array<{
286
280
  scroll: number;
287
281
  time: number;
288
282
  }>;
289
- scrollTimer: Timer | undefined;
290
283
  startReachedBlockedByTimer: boolean;
291
284
  endReachedBlockedByTimer: boolean;
292
285
  scrollForNextCalculateItemsInView: {
@@ -298,8 +291,11 @@ interface InternalState {
298
291
  queuedInitialLayout?: boolean | undefined;
299
292
  queuedCalculateItemsInView: number | undefined;
300
293
  lastBatchingAction: number;
301
- ignoreScrollFromCalcTotal?: boolean;
302
- disableScrollJumpsFrom?: number;
294
+ ignoreScrollFromMVCP?: {
295
+ lt?: number;
296
+ gt?: number;
297
+ };
298
+ ignoreScrollFromMVCPTimeout?: any;
303
299
  scrollingTo?: {
304
300
  offset: number;
305
301
  index?: number;
@@ -307,7 +303,6 @@ interface InternalState {
307
303
  viewPosition?: number;
308
304
  animated?: boolean;
309
305
  } | undefined;
310
- previousTotalSize?: number;
311
306
  needsOtherAxisSize?: boolean;
312
307
  averageSizes: Record<string, {
313
308
  num: number;
@@ -338,6 +333,8 @@ type ScrollState = {
338
333
  scrollLength: number;
339
334
  start: number;
340
335
  startBuffered: number;
336
+ sizes: Map<string, number>;
337
+ sizeAtIndex: (index: number) => number;
341
338
  };
342
339
  type LegendListRef = {
343
340
  /**
@@ -426,6 +423,12 @@ type LegendListRef = {
426
423
  offset: number;
427
424
  animated?: boolean | undefined;
428
425
  }): void;
426
+ /**
427
+ * Sets or adds to the offset of the visible content anchor.
428
+ * @param value - The offset to set or add.
429
+ * @param animated - If true, uses Animated to animate the change.
430
+ */
431
+ setVisibleContentAnchorOffset(value: number | ((value: number) => number)): void;
429
432
  };
430
433
  interface ViewToken<ItemT = any> {
431
434
  item: ItemT;
@@ -498,6 +501,12 @@ type ScrollIndexWithOffsetPosition = {
498
501
  viewOffset?: number;
499
502
  viewPosition?: number;
500
503
  };
504
+ type GetRenderedItemResult<ItemT> = {
505
+ index: number;
506
+ item: ItemT;
507
+ renderedItem: React.ReactNode;
508
+ };
509
+ type GetRenderedItem = (key: string) => GetRenderedItemResult<any> | null;
501
510
 
502
511
  declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
503
512
  alignItemsAtEnd?: boolean;
@@ -563,13 +572,13 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
563
572
  }) => void;
564
573
  } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
565
574
 
566
- interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps$1<ItemT>, "data" | "keyExtractor" | "renderItem"> {
575
+ interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps<ItemT>, "data" | "keyExtractor" | "renderItem"> {
567
576
  children?: React$1.ReactNode | undefined;
568
577
  LegendList?: ListT;
569
578
  }
570
579
  declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
571
580
  alignItemsAtEnd?: boolean;
572
- columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
581
+ columnWrapperStyle?: ColumnWrapperStyle;
573
582
  data: readonly T[];
574
583
  drawDistance?: number;
575
584
  estimatedItemSize?: number;
@@ -615,23 +624,23 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
615
624
  distanceFromStart: number;
616
625
  }) => void) | null | undefined;
617
626
  onStartReachedThreshold?: number | null | undefined;
618
- onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
627
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
619
628
  progressViewOffset?: number;
620
629
  recycleItems?: boolean;
621
630
  refScrollView?: React$1.Ref<react_native.ScrollView>;
622
631
  refreshing?: boolean;
623
- renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
632
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
624
633
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
625
634
  suggestEstimatedItemSize?: boolean;
626
- viewabilityConfig?: _legendapp_list.ViewabilityConfig;
627
- viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
635
+ viewabilityConfig?: ViewabilityConfig;
636
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
628
637
  waitForInitialLayout?: boolean;
629
638
  onLoad?: (info: {
630
639
  elapsedTimeInMs: number;
631
640
  }) => void;
632
- } & 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"> & {
641
+ } & 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"> & {
633
642
  alignItemsAtEnd?: boolean;
634
- columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
643
+ columnWrapperStyle?: ColumnWrapperStyle;
635
644
  data: readonly T[];
636
645
  drawDistance?: number;
637
646
  estimatedItemSize?: number;
@@ -677,25 +686,25 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
677
686
  distanceFromStart: number;
678
687
  }) => void) | null | undefined;
679
688
  onStartReachedThreshold?: number | null | undefined;
680
- onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
689
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
681
690
  progressViewOffset?: number;
682
691
  recycleItems?: boolean;
683
692
  refScrollView?: React$1.Ref<react_native.ScrollView>;
684
693
  refreshing?: boolean;
685
- renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
694
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
686
695
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
687
696
  suggestEstimatedItemSize?: boolean;
688
- viewabilityConfig?: _legendapp_list.ViewabilityConfig;
689
- viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
697
+ viewabilityConfig?: ViewabilityConfig;
698
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
690
699
  waitForInitialLayout?: boolean;
691
700
  onLoad?: (info: {
692
701
  elapsedTimeInMs: number;
693
702
  }) => void;
694
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
695
- ref?: React$1.Ref<LegendListRef$1>;
703
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
704
+ ref?: React$1.Ref<LegendListRef>;
696
705
  }) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
697
706
  alignItemsAtEnd?: boolean;
698
- columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
707
+ columnWrapperStyle?: ColumnWrapperStyle;
699
708
  data: readonly T[];
700
709
  drawDistance?: number;
701
710
  estimatedItemSize?: number;
@@ -741,21 +750,21 @@ declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_
741
750
  distanceFromStart: number;
742
751
  }) => void) | null | undefined;
743
752
  onStartReachedThreshold?: number | null | undefined;
744
- onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
753
+ onViewableItemsChanged?: OnViewableItemsChanged | undefined;
745
754
  progressViewOffset?: number;
746
755
  recycleItems?: boolean;
747
756
  refScrollView?: React$1.Ref<react_native.ScrollView>;
748
757
  refreshing?: boolean;
749
- renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
758
+ renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
750
759
  renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
751
760
  suggestEstimatedItemSize?: boolean;
752
- viewabilityConfig?: _legendapp_list.ViewabilityConfig;
753
- viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
761
+ viewabilityConfig?: ViewabilityConfig;
762
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
754
763
  waitForInitialLayout?: boolean;
755
764
  onLoad?: (info: {
756
765
  elapsedTimeInMs: number;
757
766
  }) => void;
758
- } & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode;
767
+ } & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
759
768
 
760
769
  declare function useViewability(callback: ViewabilityCallback, configId?: string): void;
761
770
  declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
@@ -767,4 +776,4 @@ declare function useListScrollSize(): {
767
776
  height: number;
768
777
  };
769
778
 
770
- export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LazyLegendList, type LazyLegendListProps, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollIndexWithOffsetPosition, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
779
+ export { type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InternalState, LazyLegendList, type LazyLegendListProps, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollIndexWithOffsetPosition, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };