@legendapp/list 3.3.2 → 3.3.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/react.d.ts CHANGED
@@ -31,12 +31,13 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
31
31
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
32
32
  }
33
33
 
34
- type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemInfo${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
34
+ type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
35
35
  type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
36
36
  type ListenerTypeValueMap = {
37
37
  activeStickyIndex: number;
38
38
  alignItemsAtEndPadding: number;
39
39
  anchoredEndSpaceSize: number;
40
+ containerLayoutEpoch: number;
40
41
  animatedScrollY: any;
41
42
  debugComputedScroll: number;
42
43
  debugRawScroll: number;
@@ -72,7 +73,7 @@ type ListenerTypeValueMap = {
72
73
  } & {
73
74
  [K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
74
75
  } & {
75
- [K in ListenerType as K extends `containerItemInfo${number}` ? K : never]: ContainerItemInfo;
76
+ [K in ListenerType as K extends `containerItemIndex${number}` ? K : never]: number;
76
77
  } & {
77
78
  [K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
78
79
  } & {
@@ -82,11 +83,6 @@ type ListenerTypeValueMap = {
82
83
  } & {
83
84
  [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
84
85
  };
85
- interface ContainerItemInfo {
86
- index: number;
87
- itemKey: string;
88
- value: any;
89
- }
90
86
 
91
87
  interface Insets {
92
88
  top: number;
@@ -314,7 +310,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
314
310
  /**
315
311
  * Keeps an item visually anchored to the start by adding trailing space when the content below it underflows.
316
312
  */
317
- anchoredEndSpace?: AnchoredEndSpaceConfig$1;
313
+ anchoredEndSpace?: AnchoredEndSpaceConfig;
318
314
  /**
319
315
  * Adjusts the effective end content inset for web lists without replacing the base contentInset.
320
316
  * The adjustment is also rendered as real content padding so the browser scroll range includes it.
@@ -481,12 +477,16 @@ interface ScrollToEndOptions {
481
477
  animated?: boolean;
482
478
  viewOffset?: number;
483
479
  }
484
- interface AnchoredEndSpaceConfig$1 {
480
+ interface AnchoredEndSpaceConfig {
481
+ /** Index of the item whose row should remain anchored when trailing space is added. */
485
482
  anchorIndex: number;
483
+ /** Desired distance from the viewport's start edge to the anchored row. */
486
484
  anchorOffset?: number;
485
+ /** Optional cap for the anchor item's contribution to its row size. */
487
486
  anchorMaxSize?: number;
488
- includeInEndInset?: boolean;
487
+ /** Called whenever the resolved trailing space changes. */
489
488
  onSizeChanged?: (size: number) => void;
489
+ /** Called once the anchor and every row after it have authoritative sizes. */
490
490
  onReady?: (info: AnchoredEndSpaceReadyInfo) => void;
491
491
  }
492
492
  interface StickyHeaderConfig {
@@ -561,6 +561,7 @@ type LegendListState$1 = {
561
561
  isStartReached: boolean;
562
562
  isWithinMaintainScrollAtEndThreshold: boolean;
563
563
  getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
564
+ indexByKey: (key: string) => number | undefined;
564
565
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
565
566
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
566
567
  positionAtIndex: (index: number) => number;
@@ -590,6 +591,10 @@ type LegendListRef$1 = {
590
591
  * Returns the native ScrollView component reference.
591
592
  */
592
593
  getNativeScrollRef(): any;
594
+ /**
595
+ * Returns the underlying animatable scroll component reference.
596
+ */
597
+ getAnimatableRef(): any;
593
598
  /**
594
599
  * Returns the scroll responder instance for handling scroll events.
595
600
  */
@@ -789,6 +794,7 @@ interface LooseScrollViewProps {
789
794
  onMomentumScrollBegin?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
790
795
  onMomentumScrollEnd?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
791
796
  onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
797
+ onScrollBeginDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
792
798
  refreshControl?: ReactElement | null;
793
799
  removeClippedSubviews?: boolean;
794
800
  scrollEventThrottle?: number;
@@ -798,9 +804,7 @@ interface LooseScrollViewProps {
798
804
  style?: StyleProp<ViewStyle>;
799
805
  }
800
806
 
801
- interface AnchoredEndSpaceConfig extends Omit<AnchoredEndSpaceConfig$1, "includeInEndInset"> {
802
- }
803
- type ScrollViewPropsWeb = Omit<LooseScrollViewProps, "style" | "contentContainerStyle" | "onScroll" | "onLayout" | "onMomentumScrollBegin" | "onMomentumScrollEnd" | "pagingEnabled" | "snapToInterval"> & Omit<HTMLAttributes<HTMLDivElement>, "onScroll" | "onLayout" | "style"> & {
807
+ type ScrollViewPropsWeb = Omit<LooseScrollViewProps, "style" | "contentContainerStyle" | "onScroll" | "onLayout" | "onMomentumScrollBegin" | "onMomentumScrollEnd" | "onScrollBeginDrag" | "pagingEnabled" | "snapToInterval"> & Omit<HTMLAttributes<HTMLDivElement>, "onScroll" | "onLayout" | "style"> & {
804
808
  style?: CSSProperties;
805
809
  contentContainerClassName?: string;
806
810
  contentContainerStyle?: CSSProperties;
@@ -814,7 +818,8 @@ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omi
814
818
  ListFooterComponentStyle?: CSSProperties | undefined;
815
819
  };
816
820
  type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
817
- type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollableNode" | "getScrollResponder"> & {
821
+ type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollableNode" | "getScrollResponder"> & {
822
+ getAnimatableRef(): HTMLElement | ScrollViewMethods;
818
823
  getNativeScrollRef(): HTMLElement | ScrollViewMethods;
819
824
  getScrollableNode(): HTMLElement;
820
825
  getScrollResponder(): HTMLElement | null;