@legendapp/list 2.1.0-beta.1 → 2.1.0-beta.3

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.
Files changed (5) hide show
  1. package/index.d.mts +14 -13
  2. package/index.d.ts +14 -13
  3. package/index.js +302 -252
  4. package/index.mjs +302 -252
  5. package/package.json +1 -1
package/index.d.mts CHANGED
@@ -5,7 +5,7 @@ import Animated$1 from 'react-native-reanimated';
5
5
 
6
6
  type AnimatedValue = number;
7
7
 
8
- type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "lastPositionUpdate" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize";
8
+ type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "lastPositionUpdate" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "scrollAdjustPending" | "scrollingTo" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize" | "activeStickyIndex";
9
9
  interface StateContext {
10
10
  internalState: InternalState | undefined;
11
11
  listeners: Map<ListenerType, Set<(value: any) => void>>;
@@ -28,6 +28,7 @@ interface StateContext {
28
28
 
29
29
  declare class ScrollAdjustHandler {
30
30
  private appliedAdjust;
31
+ private pendingAdjust;
31
32
  private context;
32
33
  private mounted;
33
34
  constructor(ctx: StateContext);
@@ -36,7 +37,7 @@ declare class ScrollAdjustHandler {
36
37
  getAdjust(): number;
37
38
  }
38
39
 
39
- type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
40
+ type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
40
41
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
41
42
  /**
42
43
  * Array of items to render in the list.
@@ -213,7 +214,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
213
214
  onStartReachedThreshold?: number | null | undefined;
214
215
  /**
215
216
  * Called when the sticky header changes.
216
- */
217
+ */
217
218
  onStickyHeaderChange?: (info: {
218
219
  index: number;
219
220
  item: any;
@@ -298,6 +299,14 @@ interface ThresholdSnapshot {
298
299
  dataLength?: number;
299
300
  atThreshold: boolean;
300
301
  }
302
+ interface ScrollTarget {
303
+ offset: number;
304
+ index?: number;
305
+ viewOffset?: number;
306
+ viewPosition?: number;
307
+ animated?: boolean;
308
+ isInitialScroll?: boolean;
309
+ }
301
310
  interface InternalState {
302
311
  positions: Map<string, number>;
303
312
  columns: Map<string, number>;
@@ -354,15 +363,8 @@ interface InternalState {
354
363
  lt?: number;
355
364
  gt?: number;
356
365
  };
366
+ ignoreScrollFromMVCPIgnored?: boolean;
357
367
  ignoreScrollFromMVCPTimeout?: any;
358
- scrollingTo?: {
359
- offset: number;
360
- index?: number;
361
- viewOffset?: number;
362
- viewPosition?: number;
363
- animated?: boolean;
364
- isInitialScroll?: boolean;
365
- } | undefined;
366
368
  needsOtherAxisSize?: boolean;
367
369
  averageSizes: Record<string, {
368
370
  num: number;
@@ -401,7 +403,6 @@ interface InternalState {
401
403
  suggestEstimatedItemSize: boolean;
402
404
  stylePaddingBottom: number | undefined;
403
405
  renderItem: LegendListProps["renderItem"];
404
- initialScroll: ScrollIndexWithOffset | undefined;
405
406
  scrollBuffer: number;
406
407
  numColumns: number;
407
408
  initialContainerPoolRatio: number;
@@ -640,4 +641,4 @@ declare function useListScrollSize(): {
640
641
  };
641
642
  declare function useSyncLayout(): () => void;
642
643
 
643
- export { type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type MaintainScrollAtEndOptions, type OnViewableItemsChanged, type ScrollIndexWithOffset, type ScrollIndexWithOffsetPosition, type ScrollState, type ThresholdSnapshot, 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, useSyncLayout, useViewability, useViewabilityAmount };
644
+ export { type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type MaintainScrollAtEndOptions, type OnViewableItemsChanged, type ScrollIndexWithOffset, type ScrollIndexWithOffsetPosition, type ScrollState, type ScrollTarget, type ThresholdSnapshot, 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, useSyncLayout, useViewability, useViewabilityAmount };
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import Animated$1 from 'react-native-reanimated';
5
5
 
6
6
  type AnimatedValue = number;
7
7
 
8
- type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "lastPositionUpdate" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize";
8
+ type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "lastPositionUpdate" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "scrollAdjustPending" | "scrollingTo" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize" | "activeStickyIndex";
9
9
  interface StateContext {
10
10
  internalState: InternalState | undefined;
11
11
  listeners: Map<ListenerType, Set<(value: any) => void>>;
@@ -28,6 +28,7 @@ interface StateContext {
28
28
 
29
29
  declare class ScrollAdjustHandler {
30
30
  private appliedAdjust;
31
+ private pendingAdjust;
31
32
  private context;
32
33
  private mounted;
33
34
  constructor(ctx: StateContext);
@@ -36,7 +37,7 @@ declare class ScrollAdjustHandler {
36
37
  getAdjust(): number;
37
38
  }
38
39
 
39
- type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
40
+ type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
40
41
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
41
42
  /**
42
43
  * Array of items to render in the list.
@@ -213,7 +214,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
213
214
  onStartReachedThreshold?: number | null | undefined;
214
215
  /**
215
216
  * Called when the sticky header changes.
216
- */
217
+ */
217
218
  onStickyHeaderChange?: (info: {
218
219
  index: number;
219
220
  item: any;
@@ -298,6 +299,14 @@ interface ThresholdSnapshot {
298
299
  dataLength?: number;
299
300
  atThreshold: boolean;
300
301
  }
302
+ interface ScrollTarget {
303
+ offset: number;
304
+ index?: number;
305
+ viewOffset?: number;
306
+ viewPosition?: number;
307
+ animated?: boolean;
308
+ isInitialScroll?: boolean;
309
+ }
301
310
  interface InternalState {
302
311
  positions: Map<string, number>;
303
312
  columns: Map<string, number>;
@@ -354,15 +363,8 @@ interface InternalState {
354
363
  lt?: number;
355
364
  gt?: number;
356
365
  };
366
+ ignoreScrollFromMVCPIgnored?: boolean;
357
367
  ignoreScrollFromMVCPTimeout?: any;
358
- scrollingTo?: {
359
- offset: number;
360
- index?: number;
361
- viewOffset?: number;
362
- viewPosition?: number;
363
- animated?: boolean;
364
- isInitialScroll?: boolean;
365
- } | undefined;
366
368
  needsOtherAxisSize?: boolean;
367
369
  averageSizes: Record<string, {
368
370
  num: number;
@@ -401,7 +403,6 @@ interface InternalState {
401
403
  suggestEstimatedItemSize: boolean;
402
404
  stylePaddingBottom: number | undefined;
403
405
  renderItem: LegendListProps["renderItem"];
404
- initialScroll: ScrollIndexWithOffset | undefined;
405
406
  scrollBuffer: number;
406
407
  numColumns: number;
407
408
  initialContainerPoolRatio: number;
@@ -640,4 +641,4 @@ declare function useListScrollSize(): {
640
641
  };
641
642
  declare function useSyncLayout(): () => void;
642
643
 
643
- export { type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type MaintainScrollAtEndOptions, type OnViewableItemsChanged, type ScrollIndexWithOffset, type ScrollIndexWithOffsetPosition, type ScrollState, type ThresholdSnapshot, 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, useSyncLayout, useViewability, useViewabilityAmount };
644
+ export { type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type MaintainScrollAtEndOptions, type OnViewableItemsChanged, type ScrollIndexWithOffset, type ScrollIndexWithOffsetPosition, type ScrollState, type ScrollTarget, type ThresholdSnapshot, 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, useSyncLayout, useViewability, useViewabilityAmount };