@legendapp/list 3.0.0-beta.43 → 3.0.0-beta.45

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
@@ -26,18 +26,28 @@ interface ScrollViewMethods {
26
26
  }): void;
27
27
  }
28
28
 
29
- type AnimatedValue = number;
29
+ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
30
+ data: boolean;
31
+ size: boolean;
32
+ shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
33
+ }
30
34
 
31
- type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
32
- type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
35
+ type ListenerType = "activeStickyIndex" | "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" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
36
+ type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
33
37
  type ListenerTypeValueMap = {
34
38
  activeStickyIndex: number;
39
+ anchoredEndSpaceSize: number;
35
40
  animatedScrollY: any;
36
41
  debugComputedScroll: number;
37
42
  debugRawScroll: number;
38
43
  extraData: any;
39
44
  footerSize: number;
40
45
  headerSize: number;
46
+ isAtEnd: boolean;
47
+ isAtStart: boolean;
48
+ isNearEnd: boolean;
49
+ isNearStart: boolean;
50
+ isWithinMaintainScrollAtEndThreshold: boolean;
41
51
  lastItemKeys: string[];
42
52
  lastPositionUpdate: number;
43
53
  maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
@@ -69,44 +79,6 @@ type ListenerTypeValueMap = {
69
79
  } & {
70
80
  [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
71
81
  };
72
- interface StateContext {
73
- animatedScrollY: AnimatedValue;
74
- columnWrapperStyle: ColumnWrapperStyle | undefined;
75
- contextNum: number;
76
- listeners: Map<ListenerType, Set<(value: any) => void>>;
77
- mapViewabilityCallbacks: Map<string, ViewabilityCallback>;
78
- mapViewabilityValues: Map<string, ViewToken>;
79
- mapViewabilityAmountCallbacks: Map<number, ViewabilityAmountCallback>;
80
- mapViewabilityAmountValues: Map<number, ViewAmountToken>;
81
- mapViewabilityConfigStates: Map<string, {
82
- viewableItems: ViewToken[];
83
- start: number;
84
- end: number;
85
- previousStart: number;
86
- previousEnd: number;
87
- }>;
88
- positionListeners: Map<string, Set<(value: any) => void>>;
89
- state: InternalState;
90
- values: Map<ListenerType, any>;
91
- viewRefs: Map<number, React.RefObject<LooseView | null>>;
92
- }
93
-
94
- declare class ScrollAdjustHandler {
95
- private appliedAdjust;
96
- private pendingAdjust;
97
- private ctx;
98
- constructor(ctx: StateContext);
99
- requestAdjust(add: number): void;
100
- getAdjust(): number;
101
- commitPendingAdjust(scrollTarget: ScrollTarget): void;
102
- }
103
-
104
- type BaseSharedValue<T = number> = {
105
- get: () => T;
106
- };
107
- type StylesAsSharedValue<Style> = {
108
- [key in keyof Style]: Style[key] | BaseSharedValue<Style[key]>;
109
- };
110
82
 
111
83
  interface Insets {
112
84
  top: number;
@@ -141,29 +113,6 @@ interface NativeSyntheticEvent<T> {
141
113
  }
142
114
  type ViewStyle = Record<string, unknown>;
143
115
  type StyleProp<T> = T | T[] | null | undefined | false;
144
- interface ScrollEventTargetLike {
145
- addEventListener(type: string, listener: (...args: any[]) => void): void;
146
- removeEventListener(type: string, listener: (...args: any[]) => void): void;
147
- }
148
- interface ScrollableNodeLike {
149
- scrollLeft?: number;
150
- scrollTop?: number;
151
- }
152
- interface LegendListScrollerRef {
153
- flashScrollIndicators(): void;
154
- getCurrentScrollOffset?(): number;
155
- getScrollEventTarget(): ScrollEventTargetLike | null;
156
- getScrollableNode(): ScrollableNodeLike | null;
157
- getScrollResponder(): unknown;
158
- scrollTo(options: {
159
- animated?: boolean;
160
- x?: number;
161
- y?: number;
162
- }): void;
163
- scrollToEnd(options?: {
164
- animated?: boolean;
165
- }): void;
166
- }
167
116
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
168
117
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
169
118
  /**
@@ -206,6 +155,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
206
155
  * Style applied to each column's wrapper view.
207
156
  */
208
157
  columnWrapperStyle?: ColumnWrapperStyle;
158
+ /**
159
+ * Version token that forces the list to treat data as updated even when the array reference is stable.
160
+ * Increment or change this when mutating the data array in place.
161
+ */
162
+ dataVersion?: Key;
209
163
  /**
210
164
  * Distance in pixels to pre-render items ahead of the visible area.
211
165
  * @default 250
@@ -229,33 +183,35 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
229
183
  * Extra data to trigger re-rendering when changed.
230
184
  */
231
185
  extraData?: any;
232
- /**
233
- * Version token that forces the list to treat data as updated even when the array reference is stable.
234
- * Increment or change this when mutating the data array in place.
235
- */
236
- dataVersion?: Key;
237
186
  /**
238
187
  * In case you have distinct item sizes, you can provide a function to get the size of an item.
239
- * Use instead of FlatList's getItemLayout or FlashList overrideItemLayout if you want to have accurate initialScrollOffset, you should provide this function
240
188
  */
241
189
  getEstimatedItemSize?: (item: ItemT, index: number, type: TItemType) => number;
242
190
  /**
243
- * Customize layout for multi-column lists, such as allowing items to span multiple columns.
244
- * Similar to FlashList's overrideItemLayout.
191
+ * In case items always have a fixed size, you can provide a function to return it.
245
192
  */
246
- overrideItemLayout?: (layout: {
247
- span?: number;
248
- }, item: ItemT, index: number, maxColumns: number, extraData?: any) => void;
193
+ getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
194
+ /**
195
+ * Returns a stable item type used for pooling and size estimation.
196
+ */
197
+ getItemType?: (item: ItemT, index: number) => TItemType;
198
+ /**
199
+ * Component to render between items, receiving the leading item as prop.
200
+ */
201
+ ItemSeparatorComponent?: React.ComponentType<{
202
+ leadingItem: ItemT;
203
+ }>;
249
204
  /**
250
205
  * Ratio of initial container pool size to data length (e.g., 0.5 for half).
251
206
  * @default 2
252
207
  */
253
208
  initialContainerPoolRatio?: number | undefined;
254
209
  /**
255
- * Initial scroll position in pixels.
256
- * @default 0
210
+ * When true, the list initializes scrolled to the last item.
211
+ * Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
212
+ * @default false
257
213
  */
258
- initialScrollOffset?: number;
214
+ initialScrollAtEnd?: boolean;
259
215
  /**
260
216
  * Index to scroll to initially.
261
217
  * @default 0
@@ -266,17 +222,14 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
266
222
  viewPosition?: number | undefined;
267
223
  };
268
224
  /**
269
- * When true, the list initializes scrolled to the last item.
270
- * Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
271
- * @default false
225
+ * Initial scroll position in pixels.
226
+ * @default 0
272
227
  */
273
- initialScrollAtEnd?: boolean;
228
+ initialScrollOffset?: number;
274
229
  /**
275
- * Component to render between items, receiving the leading item as prop.
230
+ * Custom equality function to detect semantically unchanged items.
276
231
  */
277
- ItemSeparatorComponent?: React.ComponentType<{
278
- leadingItem: ItemT;
279
- }>;
232
+ itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
280
233
  /**
281
234
  * Function to extract a unique key for each item.
282
235
  */
@@ -322,10 +275,9 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
322
275
  */
323
276
  maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
324
277
  /**
325
- * Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
326
- * @default false
278
+ * Keeps an item visually anchored to the start by adding trailing space when the content below it underflows.
327
279
  */
328
- useWindowScroll?: boolean;
280
+ anchoredEndSpace?: AnchoredEndSpaceConfig$1;
329
281
  /**
330
282
  * Number of columns to render items in.
331
283
  * @default 1
@@ -352,6 +304,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
352
304
  itemKey: string;
353
305
  itemData: ItemT;
354
306
  }) => void;
307
+ /**
308
+ * Called after the initial render work completes.
309
+ */
310
+ onLoad?: (info: {
311
+ elapsedTimeInMs: number;
312
+ }) => void;
355
313
  /**
356
314
  * Called when list layout metrics change.
357
315
  */
@@ -360,6 +318,9 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
360
318
  * Function to call when the user pulls to refresh.
361
319
  */
362
320
  onRefresh?: () => void;
321
+ /**
322
+ * Called when the list scrolls.
323
+ */
363
324
  onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
364
325
  /**
365
326
  * Called when scrolling reaches the start within onStartReachedThreshold.
@@ -383,6 +344,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
383
344
  * Called when the viewability of items changes.
384
345
  */
385
346
  onViewableItemsChanged?: OnViewableItemsChanged<ItemT> | undefined;
347
+ /**
348
+ * Customize layout for multi-column lists, such as allowing items to span multiple columns.
349
+ */
350
+ overrideItemLayout?: (layout: {
351
+ span?: number;
352
+ }, item: ItemT, index: number, maxColumns: number, extraData?: any) => void;
386
353
  /**
387
354
  * Offset in pixels for the refresh indicator.
388
355
  * @default 0
@@ -408,6 +375,10 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
408
375
  * @default (props) => <ScrollView {...props} />
409
376
  */
410
377
  renderScrollComponent?: (props: any) => React.ReactElement | null;
378
+ /**
379
+ * Array of item indices to use as snap points.
380
+ */
381
+ snapToIndices?: number[];
411
382
  /**
412
383
  * This will log a suggested estimatedItemSize.
413
384
  * @required
@@ -422,15 +393,6 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
422
393
  * Pairs of viewability configs and their callbacks for tracking visibility.
423
394
  */
424
395
  viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs<ItemT> | undefined;
425
- /**
426
- * If true, delays rendering until initial layout is complete.
427
- * @default false
428
- */
429
- waitForInitialLayout?: boolean;
430
- onLoad?: (info: {
431
- elapsedTimeInMs: number;
432
- }) => void;
433
- snapToIndices?: number[];
434
396
  /**
435
397
  * Array of child indices determining which children get docked to the top of the screen when scrolling.
436
398
  * For example, passing stickyHeaderIndices={[0]} will cause the first child to be fixed to the top of the scroll view.
@@ -447,21 +409,24 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
447
409
  * @default undefined
448
410
  */
449
411
  stickyHeaderConfig?: StickyHeaderConfig;
450
- getItemType?: (item: ItemT, index: number) => TItemType;
451
- getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
452
- itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
412
+ /**
413
+ * Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
414
+ * @default false
415
+ */
416
+ useWindowScroll?: boolean;
453
417
  }
454
418
  type LegendListPropsBase<ItemT, TScrollViewProps = Record<string, any>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollViewProps> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
455
- type LegendListPropsInternal = LegendListSpecificProps<any, string | undefined> & DataModeProps<any, string | undefined>;
456
419
  interface MaintainVisibleContentPositionConfig<ItemT = any> {
457
420
  data?: boolean;
458
421
  size?: boolean;
459
422
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
460
423
  }
461
- interface MaintainVisibleContentPositionNormalized<ItemT = any> {
462
- data: boolean;
463
- size: boolean;
464
- shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
424
+ interface AnchoredEndSpaceConfig$1 {
425
+ anchorIndex: number;
426
+ anchorOffset?: number;
427
+ anchorMaxSize?: number;
428
+ includeInEndInset?: boolean;
429
+ onSizeChanged?: (size: number) => void;
465
430
  }
466
431
  interface StickyHeaderConfig {
467
432
  /**
@@ -508,197 +473,6 @@ interface LegendListMetrics {
508
473
  headerSize: number;
509
474
  footerSize: number;
510
475
  }
511
- interface ThresholdSnapshot {
512
- scrollPosition: number;
513
- contentSize?: number;
514
- dataLength?: number;
515
- atThreshold: boolean;
516
- }
517
- interface ScrollTarget {
518
- animated?: boolean;
519
- index?: number;
520
- isInitialScroll?: boolean;
521
- itemSize?: number;
522
- offset: number;
523
- precomputedWithViewOffset?: boolean;
524
- targetOffset?: number;
525
- viewOffset?: number;
526
- viewPosition?: number;
527
- }
528
- interface InternalState {
529
- activeStickyIndex: number | undefined;
530
- adjustingFromInitialMount?: number;
531
- animFrameCheckFinishedScroll?: any;
532
- averageSizes: Record<string, {
533
- num: number;
534
- avg: number;
535
- }>;
536
- columns: Array<number | undefined>;
537
- columnSpans: Array<number | undefined>;
538
- containerItemKeys: Map<string, number>;
539
- containerItemTypes: Map<number, string>;
540
- dataChangeEpoch: number;
541
- dataChangeNeedsScrollUpdate: boolean;
542
- didColumnsChange?: boolean;
543
- didDataChange?: boolean;
544
- didFinishInitialScroll?: boolean;
545
- didContainersLayout?: boolean;
546
- enableScrollForNextCalculateItemsInView: boolean;
547
- endBuffered: number;
548
- endNoBuffer: number;
549
- endReachedSnapshot: ThresholdSnapshot | undefined;
550
- firstFullyOnScreenIndex: number;
551
- hasScrolled?: boolean;
552
- idCache: string[];
553
- idsInView: string[];
554
- ignoreScrollFromMVCP?: {
555
- lt?: number;
556
- gt?: number;
557
- };
558
- ignoreScrollFromMVCPIgnored?: boolean;
559
- ignoreScrollFromMVCPTimeout?: any;
560
- indexByKey: Map<string, number>;
561
- initialAnchor?: InitialScrollAnchor;
562
- initialNativeScrollWatchdog?: {
563
- startScroll: number;
564
- targetOffset: number;
565
- };
566
- initialScrollLastDidFinish: boolean;
567
- initialScrollLastTarget: ScrollIndexWithOffsetAndContentOffset | undefined;
568
- initialScrollLastTargetUsesOffset: boolean;
569
- initialScrollPreviousDataLength: number;
570
- initialScrollRetryLastLength: number | undefined;
571
- initialScrollRetryWindowUntil: number;
572
- initialScroll: ScrollIndexWithOffsetAndContentOffset | undefined;
573
- initialScrollUsesOffset: boolean;
574
- isAtEnd: boolean;
575
- isAtStart: boolean;
576
- isEndReached: boolean | null;
577
- isFirst?: boolean;
578
- isStartReached: boolean | null;
579
- lastBatchingAction: number;
580
- lastLayout: LayoutRectangle | undefined;
581
- lastScrollAdjustForHistory?: number;
582
- lastScrollDelta: number;
583
- loadStartTime: number;
584
- maintainingScrollAtEnd?: boolean;
585
- minIndexSizeChanged: number | undefined;
586
- mvcpAnchorLock?: {
587
- id: string;
588
- position: number;
589
- quietPasses: number;
590
- expiresAt: number;
591
- };
592
- contentInsetOverride?: Partial<Insets> | null;
593
- nativeContentInset?: Insets;
594
- nativeMarginTop: number;
595
- needsOtherAxisSize?: boolean;
596
- otherAxisSize?: number;
597
- pendingNativeMVCPAdjust?: {
598
- amount: number;
599
- furthestProgressTowardAmount: number;
600
- manualApplied: number;
601
- startScroll: number;
602
- };
603
- pendingMaintainScrollAtEnd?: boolean;
604
- pendingTotalSize?: number;
605
- pendingScrollResolve?: (() => void) | undefined;
606
- positions: Array<number | undefined>;
607
- previousData?: readonly unknown[];
608
- queuedCalculateItemsInView: number | undefined;
609
- queuedMVCPRecalculate?: number;
610
- queuedInitialLayout?: boolean | undefined;
611
- refScroller: React.RefObject<LegendListScrollerRef | null>;
612
- scroll: number;
613
- scrollAdjustHandler: ScrollAdjustHandler;
614
- scrollForNextCalculateItemsInView: {
615
- top: number | null;
616
- bottom: number | null;
617
- } | undefined;
618
- scrollHistory: Array<{
619
- scroll: number;
620
- time: number;
621
- }>;
622
- scrollingTo?: ScrollTarget | undefined;
623
- scrollLastCalculate?: number;
624
- scrollLength: number;
625
- scrollPending: number;
626
- scrollPrev: number;
627
- scrollPrevTime: number;
628
- scrollProcessingEnabled: boolean;
629
- scrollTime: number;
630
- sizes: Map<string, number>;
631
- sizesKnown: Map<string, number>;
632
- startBuffered: number;
633
- startBufferedId?: string;
634
- startNoBuffer: number;
635
- startReachedSnapshotDataChangeEpoch: number | undefined;
636
- startReachedSnapshot: ThresholdSnapshot | undefined;
637
- stickyContainerPool: Set<number>;
638
- stickyContainers: Map<number, number>;
639
- timeouts: Set<number>;
640
- timeoutSetPaddingTop?: any;
641
- timeoutSizeMessage: any;
642
- timeoutCheckFinishedScrollFallback?: any;
643
- totalSize: number;
644
- triggerCalculateItemsInView?: (params?: {
645
- doMVCP?: boolean;
646
- dataChanged?: boolean;
647
- forceFullItemPositions?: boolean;
648
- }) => void;
649
- viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs<any> | undefined;
650
- props: {
651
- alignItemsAtEnd: boolean;
652
- animatedProps: StylesAsSharedValue<Record<string, any>>;
653
- alwaysRender: AlwaysRenderConfig | undefined;
654
- alwaysRenderIndicesArr: number[];
655
- alwaysRenderIndicesSet: Set<number>;
656
- contentInset: Insets | undefined;
657
- data: readonly any[];
658
- dataVersion: Key | undefined;
659
- drawDistance: number;
660
- estimatedItemSize: number | undefined;
661
- getEstimatedItemSize: LegendListPropsInternal["getEstimatedItemSize"];
662
- getFixedItemSize: LegendListPropsInternal["getFixedItemSize"];
663
- getItemType: LegendListPropsInternal["getItemType"];
664
- horizontal: boolean;
665
- initialContainerPoolRatio: number;
666
- itemsAreEqual: LegendListPropsInternal["itemsAreEqual"];
667
- keyExtractor: LegendListPropsInternal["keyExtractor"];
668
- maintainScrollAtEnd: MaintainScrollAtEndNormalized | undefined;
669
- maintainScrollAtEndThreshold: number | undefined;
670
- maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
671
- numColumns: number;
672
- onEndReached: LegendListPropsInternal["onEndReached"];
673
- onEndReachedThreshold: number | null | undefined;
674
- onItemSizeChanged: LegendListPropsInternal["onItemSizeChanged"];
675
- onLoad: LegendListPropsInternal["onLoad"];
676
- onScroll: LegendListPropsInternal["onScroll"];
677
- onStartReached: LegendListPropsInternal["onStartReached"];
678
- onStartReachedThreshold: number | null | undefined;
679
- onStickyHeaderChange: LegendListPropsInternal["onStickyHeaderChange"];
680
- overrideItemLayout: LegendListPropsInternal["overrideItemLayout"];
681
- recycleItems: boolean;
682
- renderItem: LegendListPropsInternal["renderItem"];
683
- scrollBuffer?: number;
684
- snapToIndices: number[] | undefined;
685
- positionComponentInternal: React.ComponentType<any> | undefined;
686
- stickyPositionComponentInternal: React.ComponentType<any> | undefined;
687
- stickyIndicesArr: number[];
688
- stickyIndicesSet: Set<number>;
689
- stylePaddingBottom: number | undefined;
690
- stylePaddingTop: number | undefined;
691
- suggestEstimatedItemSize: boolean;
692
- useWindowScroll: boolean;
693
- };
694
- }
695
- interface ViewableRange<T> {
696
- end: number;
697
- endBuffered: number;
698
- items: T[];
699
- start: number;
700
- startBuffered: number;
701
- }
702
476
  interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
703
477
  data: readonly ItemT[];
704
478
  extraData: any;
@@ -715,8 +489,11 @@ type LegendListState$1 = {
715
489
  endBuffered: number;
716
490
  isAtEnd: boolean;
717
491
  isAtStart: boolean;
492
+ isNearEnd: boolean;
493
+ isNearStart: boolean;
718
494
  isEndReached: boolean;
719
495
  isStartReached: boolean;
496
+ isWithinMaintainScrollAtEndThreshold: boolean;
720
497
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
721
498
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
722
499
  positionAtIndex: (index: number) => number;
@@ -862,10 +639,15 @@ interface ViewabilityConfigCallbackPair<ItemT = any> {
862
639
  viewabilityConfig: ViewabilityConfig;
863
640
  }
864
641
  type ViewabilityConfigCallbackPairs<ItemT> = ViewabilityConfigCallbackPair<ItemT>[];
865
- type OnViewableItemsChanged<ItemT> = ((info: {
866
- viewableItems: Array<ViewToken<ItemT>>;
642
+ interface OnViewableItemsChangedInfo<ItemT> {
867
643
  changed: Array<ViewToken<ItemT>>;
868
- }) => void) | null;
644
+ end: number;
645
+ endBuffered: number;
646
+ start: number;
647
+ startBuffered: number;
648
+ viewableItems: Array<ViewToken<ItemT>>;
649
+ }
650
+ type OnViewableItemsChanged<ItemT> = ((info: OnViewableItemsChangedInfo<ItemT>) => void) | null;
869
651
  interface ViewabilityConfig {
870
652
  /**
871
653
  * A unique ID to identify this viewability config
@@ -903,12 +685,6 @@ interface LegendListRecyclingState<T> {
903
685
  prevIndex: number | undefined;
904
686
  prevItem: T | undefined;
905
687
  }
906
- type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactElement | null) => (props: P & React.RefAttributes<T>) => React.ReactElement | null;
907
- declare const typedForwardRef: TypedForwardRef;
908
- type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<React.ComponentProps<T>>, nextProps: Readonly<React.ComponentProps<T>>) => boolean) => T & {
909
- displayName?: string;
910
- };
911
- declare const typedMemo: TypedMemo;
912
688
  interface ScrollIndexWithOffset {
913
689
  index: number;
914
690
  viewOffset?: number;
@@ -920,28 +696,20 @@ interface ScrollIndexWithOffsetPosition extends ScrollIndexWithOffset {
920
696
  interface ScrollIndexWithOffsetAndContentOffset extends ScrollIndexWithOffsetPosition {
921
697
  contentOffset?: number;
922
698
  }
699
+ /** @deprecated Kept for backwards compatibility. Use `ScrollIndexWithOffsetPosition`. */
923
700
  interface InitialScrollAnchor extends ScrollIndexWithOffsetPosition {
924
701
  attempts?: number;
925
702
  lastDelta?: number;
926
703
  settledTicks?: number;
927
704
  }
928
- type GetRenderedItemResult<ItemT> = {
929
- index: number;
930
- item: ItemT;
931
- renderedItem: React.ReactNode;
932
- };
933
- type GetRenderedItem = (key: string) => GetRenderedItemResult<any> | null;
934
705
 
935
706
  type LooseLayoutChangeEvent = {
936
707
  nativeEvent: {
937
708
  layout: LayoutRectangle;
938
709
  };
939
710
  };
940
- type LooseMeasureCallback = (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void;
941
- interface LooseView {
942
- measure?: (callback: LooseMeasureCallback) => void;
943
- }
944
711
  interface LooseScrollViewProps {
712
+ contentContainerClassName?: string;
945
713
  contentContainerStyle?: StyleProp<ViewStyle>;
946
714
  contentInset?: Insets;
947
715
  contentOffset?: {
@@ -966,13 +734,17 @@ interface LooseScrollViewProps {
966
734
  style?: StyleProp<ViewStyle>;
967
735
  }
968
736
 
969
- type ScrollViewPropsWeb = Omit<LooseScrollViewProps, "style" | "contentContainerStyle" | "onScroll" | "onLayout" | "pagingEnabled" | "snapToInterval"> & Omit<HTMLAttributes<HTMLDivElement>, "onScroll" | "onLayout" | "style"> & {
737
+ interface AnchoredEndSpaceConfig extends Omit<AnchoredEndSpaceConfig$1, "includeInEndInset"> {
738
+ }
739
+ type ScrollViewPropsWeb = Omit<LooseScrollViewProps, "style" | "contentContainerStyle" | "onScroll" | "onLayout" | "onMomentumScrollBegin" | "onMomentumScrollEnd" | "pagingEnabled" | "snapToInterval"> & Omit<HTMLAttributes<HTMLDivElement>, "onScroll" | "onLayout" | "style"> & {
970
740
  style?: CSSProperties;
741
+ contentContainerClassName?: string;
971
742
  contentContainerStyle?: CSSProperties;
972
743
  onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
973
744
  onLayout?: (event: LooseLayoutChangeEvent) => void;
974
745
  };
975
- type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewPropsWeb, TItemType>, "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
746
+ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewPropsWeb, TItemType>, "anchoredEndSpace" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle" | "onRefresh" | "progressViewOffset" | "refreshing"> & {
747
+ anchoredEndSpace?: AnchoredEndSpaceConfig;
976
748
  refScrollView?: Ref<HTMLElement | ScrollViewMethods>;
977
749
  ListHeaderComponentStyle?: CSSProperties | undefined;
978
750
  ListFooterComponentStyle?: CSSProperties | undefined;
@@ -1001,4 +773,4 @@ declare function useSyncLayout(): () => void;
1001
773
 
1002
774
  declare const LegendList: LegendListComponent;
1003
775
 
1004
- export { type AlwaysRenderConfig, type BaseScrollViewProps, type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InitialScrollAnchor, type Insets, type InternalState, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListScrollerRef, type LegendListState, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type MaintainVisibleContentPositionNormalized, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type ScrollEventTargetLike, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type ScrollTarget, type ScrollableNodeLike, type StickyHeaderConfig, type StyleProp, type ThresholdSnapshot, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
776
+ export { type AlwaysRenderConfig, type AnchoredEndSpaceConfig, type ColumnWrapperStyle, type InitialScrollAnchor, type Insets, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type MaintainScrollAtEndOnOptions, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type OnViewableItemsChangedInfo, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type StickyHeaderConfig, type StyleProp, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };