@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-native.d.ts CHANGED
@@ -2,23 +2,28 @@ import * as React from 'react';
2
2
  import { Key, Dispatch, SetStateAction } from 'react';
3
3
  import { ScrollViewProps, NativeSyntheticEvent as NativeSyntheticEvent$1, NativeScrollEvent as NativeScrollEvent$1, ScrollView, StyleProp as StyleProp$1, ViewStyle as ViewStyle$1, ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, View } from 'react-native';
4
4
 
5
- type AnimatedValue = number;
6
-
7
- type LooseMeasureCallback = (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void;
8
- interface LooseView {
9
- measure?: (callback: LooseMeasureCallback) => void;
5
+ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
6
+ data: boolean;
7
+ size: boolean;
8
+ shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
10
9
  }
11
10
 
12
- 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}`;
13
- type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
11
+ 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}`;
12
+ type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
14
13
  type ListenerTypeValueMap = {
15
14
  activeStickyIndex: number;
15
+ anchoredEndSpaceSize: number;
16
16
  animatedScrollY: any;
17
17
  debugComputedScroll: number;
18
18
  debugRawScroll: number;
19
19
  extraData: any;
20
20
  footerSize: number;
21
21
  headerSize: number;
22
+ isAtEnd: boolean;
23
+ isAtStart: boolean;
24
+ isNearEnd: boolean;
25
+ isNearStart: boolean;
26
+ isWithinMaintainScrollAtEndThreshold: boolean;
22
27
  lastItemKeys: string[];
23
28
  lastPositionUpdate: number;
24
29
  maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
@@ -50,44 +55,6 @@ type ListenerTypeValueMap = {
50
55
  } & {
51
56
  [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
52
57
  };
53
- interface StateContext {
54
- animatedScrollY: AnimatedValue;
55
- columnWrapperStyle: ColumnWrapperStyle | undefined;
56
- contextNum: number;
57
- listeners: Map<ListenerType, Set<(value: any) => void>>;
58
- mapViewabilityCallbacks: Map<string, ViewabilityCallback>;
59
- mapViewabilityValues: Map<string, ViewToken>;
60
- mapViewabilityAmountCallbacks: Map<number, ViewabilityAmountCallback>;
61
- mapViewabilityAmountValues: Map<number, ViewAmountToken>;
62
- mapViewabilityConfigStates: Map<string, {
63
- viewableItems: ViewToken[];
64
- start: number;
65
- end: number;
66
- previousStart: number;
67
- previousEnd: number;
68
- }>;
69
- positionListeners: Map<string, Set<(value: any) => void>>;
70
- state: InternalState;
71
- values: Map<ListenerType, any>;
72
- viewRefs: Map<number, React.RefObject<LooseView | null>>;
73
- }
74
-
75
- declare class ScrollAdjustHandler {
76
- private appliedAdjust;
77
- private pendingAdjust;
78
- private ctx;
79
- constructor(ctx: StateContext);
80
- requestAdjust(add: number): void;
81
- getAdjust(): number;
82
- commitPendingAdjust(scrollTarget: ScrollTarget): void;
83
- }
84
-
85
- type BaseSharedValue<T = number> = {
86
- get: () => T;
87
- };
88
- type StylesAsSharedValue<Style> = {
89
- [key in keyof Style]: Style[key] | BaseSharedValue<Style[key]>;
90
- };
91
58
 
92
59
  interface Insets {
93
60
  top: number;
@@ -122,29 +89,6 @@ interface NativeSyntheticEvent<T> {
122
89
  }
123
90
  type ViewStyle = Record<string, unknown>;
124
91
  type StyleProp<T> = T | T[] | null | undefined | false;
125
- interface ScrollEventTargetLike {
126
- addEventListener(type: string, listener: (...args: any[]) => void): void;
127
- removeEventListener(type: string, listener: (...args: any[]) => void): void;
128
- }
129
- interface ScrollableNodeLike {
130
- scrollLeft?: number;
131
- scrollTop?: number;
132
- }
133
- interface LegendListScrollerRef {
134
- flashScrollIndicators(): void;
135
- getCurrentScrollOffset?(): number;
136
- getScrollEventTarget(): ScrollEventTargetLike | null;
137
- getScrollableNode(): ScrollableNodeLike | null;
138
- getScrollResponder(): unknown;
139
- scrollTo(options: {
140
- animated?: boolean;
141
- x?: number;
142
- y?: number;
143
- }): void;
144
- scrollToEnd(options?: {
145
- animated?: boolean;
146
- }): void;
147
- }
148
92
  type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
149
93
  interface DataModeProps<ItemT, TItemType extends string | undefined> {
150
94
  /**
@@ -187,6 +131,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
187
131
  * Style applied to each column's wrapper view.
188
132
  */
189
133
  columnWrapperStyle?: ColumnWrapperStyle;
134
+ /**
135
+ * Version token that forces the list to treat data as updated even when the array reference is stable.
136
+ * Increment or change this when mutating the data array in place.
137
+ */
138
+ dataVersion?: Key;
190
139
  /**
191
140
  * Distance in pixels to pre-render items ahead of the visible area.
192
141
  * @default 250
@@ -210,33 +159,35 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
210
159
  * Extra data to trigger re-rendering when changed.
211
160
  */
212
161
  extraData?: any;
213
- /**
214
- * Version token that forces the list to treat data as updated even when the array reference is stable.
215
- * Increment or change this when mutating the data array in place.
216
- */
217
- dataVersion?: Key;
218
162
  /**
219
163
  * In case you have distinct item sizes, you can provide a function to get the size of an item.
220
- * Use instead of FlatList's getItemLayout or FlashList overrideItemLayout if you want to have accurate initialScrollOffset, you should provide this function
221
164
  */
222
165
  getEstimatedItemSize?: (item: ItemT, index: number, type: TItemType) => number;
223
166
  /**
224
- * Customize layout for multi-column lists, such as allowing items to span multiple columns.
225
- * Similar to FlashList's overrideItemLayout.
167
+ * In case items always have a fixed size, you can provide a function to return it.
226
168
  */
227
- overrideItemLayout?: (layout: {
228
- span?: number;
229
- }, item: ItemT, index: number, maxColumns: number, extraData?: any) => void;
169
+ getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
170
+ /**
171
+ * Returns a stable item type used for pooling and size estimation.
172
+ */
173
+ getItemType?: (item: ItemT, index: number) => TItemType;
174
+ /**
175
+ * Component to render between items, receiving the leading item as prop.
176
+ */
177
+ ItemSeparatorComponent?: React.ComponentType<{
178
+ leadingItem: ItemT;
179
+ }>;
230
180
  /**
231
181
  * Ratio of initial container pool size to data length (e.g., 0.5 for half).
232
182
  * @default 2
233
183
  */
234
184
  initialContainerPoolRatio?: number | undefined;
235
185
  /**
236
- * Initial scroll position in pixels.
237
- * @default 0
186
+ * When true, the list initializes scrolled to the last item.
187
+ * Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
188
+ * @default false
238
189
  */
239
- initialScrollOffset?: number;
190
+ initialScrollAtEnd?: boolean;
240
191
  /**
241
192
  * Index to scroll to initially.
242
193
  * @default 0
@@ -247,17 +198,14 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
247
198
  viewPosition?: number | undefined;
248
199
  };
249
200
  /**
250
- * When true, the list initializes scrolled to the last item.
251
- * Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
252
- * @default false
201
+ * Initial scroll position in pixels.
202
+ * @default 0
253
203
  */
254
- initialScrollAtEnd?: boolean;
204
+ initialScrollOffset?: number;
255
205
  /**
256
- * Component to render between items, receiving the leading item as prop.
206
+ * Custom equality function to detect semantically unchanged items.
257
207
  */
258
- ItemSeparatorComponent?: React.ComponentType<{
259
- leadingItem: ItemT;
260
- }>;
208
+ itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
261
209
  /**
262
210
  * Function to extract a unique key for each item.
263
211
  */
@@ -303,10 +251,9 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
303
251
  */
304
252
  maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
305
253
  /**
306
- * Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
307
- * @default false
254
+ * Keeps an item visually anchored to the start by adding trailing space when the content below it underflows.
308
255
  */
309
- useWindowScroll?: boolean;
256
+ anchoredEndSpace?: AnchoredEndSpaceConfig;
310
257
  /**
311
258
  * Number of columns to render items in.
312
259
  * @default 1
@@ -333,6 +280,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
333
280
  itemKey: string;
334
281
  itemData: ItemT;
335
282
  }) => void;
283
+ /**
284
+ * Called after the initial render work completes.
285
+ */
286
+ onLoad?: (info: {
287
+ elapsedTimeInMs: number;
288
+ }) => void;
336
289
  /**
337
290
  * Called when list layout metrics change.
338
291
  */
@@ -341,6 +294,9 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
341
294
  * Function to call when the user pulls to refresh.
342
295
  */
343
296
  onRefresh?: () => void;
297
+ /**
298
+ * Called when the list scrolls.
299
+ */
344
300
  onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
345
301
  /**
346
302
  * Called when scrolling reaches the start within onStartReachedThreshold.
@@ -364,6 +320,12 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
364
320
  * Called when the viewability of items changes.
365
321
  */
366
322
  onViewableItemsChanged?: OnViewableItemsChanged<ItemT> | undefined;
323
+ /**
324
+ * Customize layout for multi-column lists, such as allowing items to span multiple columns.
325
+ */
326
+ overrideItemLayout?: (layout: {
327
+ span?: number;
328
+ }, item: ItemT, index: number, maxColumns: number, extraData?: any) => void;
367
329
  /**
368
330
  * Offset in pixels for the refresh indicator.
369
331
  * @default 0
@@ -389,6 +351,10 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
389
351
  * @default (props) => <ScrollView {...props} />
390
352
  */
391
353
  renderScrollComponent?: (props: any) => React.ReactElement | null;
354
+ /**
355
+ * Array of item indices to use as snap points.
356
+ */
357
+ snapToIndices?: number[];
392
358
  /**
393
359
  * This will log a suggested estimatedItemSize.
394
360
  * @required
@@ -403,15 +369,6 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
403
369
  * Pairs of viewability configs and their callbacks for tracking visibility.
404
370
  */
405
371
  viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs<ItemT> | undefined;
406
- /**
407
- * If true, delays rendering until initial layout is complete.
408
- * @default false
409
- */
410
- waitForInitialLayout?: boolean;
411
- onLoad?: (info: {
412
- elapsedTimeInMs: number;
413
- }) => void;
414
- snapToIndices?: number[];
415
372
  /**
416
373
  * Array of child indices determining which children get docked to the top of the screen when scrolling.
417
374
  * For example, passing stickyHeaderIndices={[0]} will cause the first child to be fixed to the top of the scroll view.
@@ -428,21 +385,24 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
428
385
  * @default undefined
429
386
  */
430
387
  stickyHeaderConfig?: StickyHeaderConfig;
431
- getItemType?: (item: ItemT, index: number) => TItemType;
432
- getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
433
- itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
388
+ /**
389
+ * Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
390
+ * @default false
391
+ */
392
+ useWindowScroll?: boolean;
434
393
  }
435
394
  type LegendListPropsBase<ItemT, TScrollViewProps = Record<string, any>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollViewProps> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
436
- type LegendListPropsInternal = LegendListSpecificProps<any, string | undefined> & DataModeProps<any, string | undefined>;
437
395
  interface MaintainVisibleContentPositionConfig<ItemT = any> {
438
396
  data?: boolean;
439
397
  size?: boolean;
440
398
  shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
441
399
  }
442
- interface MaintainVisibleContentPositionNormalized<ItemT = any> {
443
- data: boolean;
444
- size: boolean;
445
- shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
400
+ interface AnchoredEndSpaceConfig {
401
+ anchorIndex: number;
402
+ anchorOffset?: number;
403
+ anchorMaxSize?: number;
404
+ includeInEndInset?: boolean;
405
+ onSizeChanged?: (size: number) => void;
446
406
  }
447
407
  interface StickyHeaderConfig {
448
408
  /**
@@ -489,197 +449,6 @@ interface LegendListMetrics {
489
449
  headerSize: number;
490
450
  footerSize: number;
491
451
  }
492
- interface ThresholdSnapshot {
493
- scrollPosition: number;
494
- contentSize?: number;
495
- dataLength?: number;
496
- atThreshold: boolean;
497
- }
498
- interface ScrollTarget {
499
- animated?: boolean;
500
- index?: number;
501
- isInitialScroll?: boolean;
502
- itemSize?: number;
503
- offset: number;
504
- precomputedWithViewOffset?: boolean;
505
- targetOffset?: number;
506
- viewOffset?: number;
507
- viewPosition?: number;
508
- }
509
- interface InternalState {
510
- activeStickyIndex: number | undefined;
511
- adjustingFromInitialMount?: number;
512
- animFrameCheckFinishedScroll?: any;
513
- averageSizes: Record<string, {
514
- num: number;
515
- avg: number;
516
- }>;
517
- columns: Array<number | undefined>;
518
- columnSpans: Array<number | undefined>;
519
- containerItemKeys: Map<string, number>;
520
- containerItemTypes: Map<number, string>;
521
- dataChangeEpoch: number;
522
- dataChangeNeedsScrollUpdate: boolean;
523
- didColumnsChange?: boolean;
524
- didDataChange?: boolean;
525
- didFinishInitialScroll?: boolean;
526
- didContainersLayout?: boolean;
527
- enableScrollForNextCalculateItemsInView: boolean;
528
- endBuffered: number;
529
- endNoBuffer: number;
530
- endReachedSnapshot: ThresholdSnapshot | undefined;
531
- firstFullyOnScreenIndex: number;
532
- hasScrolled?: boolean;
533
- idCache: string[];
534
- idsInView: string[];
535
- ignoreScrollFromMVCP?: {
536
- lt?: number;
537
- gt?: number;
538
- };
539
- ignoreScrollFromMVCPIgnored?: boolean;
540
- ignoreScrollFromMVCPTimeout?: any;
541
- indexByKey: Map<string, number>;
542
- initialAnchor?: InitialScrollAnchor;
543
- initialNativeScrollWatchdog?: {
544
- startScroll: number;
545
- targetOffset: number;
546
- };
547
- initialScrollLastDidFinish: boolean;
548
- initialScrollLastTarget: ScrollIndexWithOffsetAndContentOffset | undefined;
549
- initialScrollLastTargetUsesOffset: boolean;
550
- initialScrollPreviousDataLength: number;
551
- initialScrollRetryLastLength: number | undefined;
552
- initialScrollRetryWindowUntil: number;
553
- initialScroll: ScrollIndexWithOffsetAndContentOffset | undefined;
554
- initialScrollUsesOffset: boolean;
555
- isAtEnd: boolean;
556
- isAtStart: boolean;
557
- isEndReached: boolean | null;
558
- isFirst?: boolean;
559
- isStartReached: boolean | null;
560
- lastBatchingAction: number;
561
- lastLayout: LayoutRectangle | undefined;
562
- lastScrollAdjustForHistory?: number;
563
- lastScrollDelta: number;
564
- loadStartTime: number;
565
- maintainingScrollAtEnd?: boolean;
566
- minIndexSizeChanged: number | undefined;
567
- mvcpAnchorLock?: {
568
- id: string;
569
- position: number;
570
- quietPasses: number;
571
- expiresAt: number;
572
- };
573
- contentInsetOverride?: Partial<Insets> | null;
574
- nativeContentInset?: Insets;
575
- nativeMarginTop: number;
576
- needsOtherAxisSize?: boolean;
577
- otherAxisSize?: number;
578
- pendingNativeMVCPAdjust?: {
579
- amount: number;
580
- furthestProgressTowardAmount: number;
581
- manualApplied: number;
582
- startScroll: number;
583
- };
584
- pendingMaintainScrollAtEnd?: boolean;
585
- pendingTotalSize?: number;
586
- pendingScrollResolve?: (() => void) | undefined;
587
- positions: Array<number | undefined>;
588
- previousData?: readonly unknown[];
589
- queuedCalculateItemsInView: number | undefined;
590
- queuedMVCPRecalculate?: number;
591
- queuedInitialLayout?: boolean | undefined;
592
- refScroller: React.RefObject<LegendListScrollerRef | null>;
593
- scroll: number;
594
- scrollAdjustHandler: ScrollAdjustHandler;
595
- scrollForNextCalculateItemsInView: {
596
- top: number | null;
597
- bottom: number | null;
598
- } | undefined;
599
- scrollHistory: Array<{
600
- scroll: number;
601
- time: number;
602
- }>;
603
- scrollingTo?: ScrollTarget | undefined;
604
- scrollLastCalculate?: number;
605
- scrollLength: number;
606
- scrollPending: number;
607
- scrollPrev: number;
608
- scrollPrevTime: number;
609
- scrollProcessingEnabled: boolean;
610
- scrollTime: number;
611
- sizes: Map<string, number>;
612
- sizesKnown: Map<string, number>;
613
- startBuffered: number;
614
- startBufferedId?: string;
615
- startNoBuffer: number;
616
- startReachedSnapshotDataChangeEpoch: number | undefined;
617
- startReachedSnapshot: ThresholdSnapshot | undefined;
618
- stickyContainerPool: Set<number>;
619
- stickyContainers: Map<number, number>;
620
- timeouts: Set<number>;
621
- timeoutSetPaddingTop?: any;
622
- timeoutSizeMessage: any;
623
- timeoutCheckFinishedScrollFallback?: any;
624
- totalSize: number;
625
- triggerCalculateItemsInView?: (params?: {
626
- doMVCP?: boolean;
627
- dataChanged?: boolean;
628
- forceFullItemPositions?: boolean;
629
- }) => void;
630
- viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs<any> | undefined;
631
- props: {
632
- alignItemsAtEnd: boolean;
633
- animatedProps: StylesAsSharedValue<Record<string, any>>;
634
- alwaysRender: AlwaysRenderConfig | undefined;
635
- alwaysRenderIndicesArr: number[];
636
- alwaysRenderIndicesSet: Set<number>;
637
- contentInset: Insets | undefined;
638
- data: readonly any[];
639
- dataVersion: Key | undefined;
640
- drawDistance: number;
641
- estimatedItemSize: number | undefined;
642
- getEstimatedItemSize: LegendListPropsInternal["getEstimatedItemSize"];
643
- getFixedItemSize: LegendListPropsInternal["getFixedItemSize"];
644
- getItemType: LegendListPropsInternal["getItemType"];
645
- horizontal: boolean;
646
- initialContainerPoolRatio: number;
647
- itemsAreEqual: LegendListPropsInternal["itemsAreEqual"];
648
- keyExtractor: LegendListPropsInternal["keyExtractor"];
649
- maintainScrollAtEnd: MaintainScrollAtEndNormalized | undefined;
650
- maintainScrollAtEndThreshold: number | undefined;
651
- maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
652
- numColumns: number;
653
- onEndReached: LegendListPropsInternal["onEndReached"];
654
- onEndReachedThreshold: number | null | undefined;
655
- onItemSizeChanged: LegendListPropsInternal["onItemSizeChanged"];
656
- onLoad: LegendListPropsInternal["onLoad"];
657
- onScroll: LegendListPropsInternal["onScroll"];
658
- onStartReached: LegendListPropsInternal["onStartReached"];
659
- onStartReachedThreshold: number | null | undefined;
660
- onStickyHeaderChange: LegendListPropsInternal["onStickyHeaderChange"];
661
- overrideItemLayout: LegendListPropsInternal["overrideItemLayout"];
662
- recycleItems: boolean;
663
- renderItem: LegendListPropsInternal["renderItem"];
664
- scrollBuffer?: number;
665
- snapToIndices: number[] | undefined;
666
- positionComponentInternal: React.ComponentType<any> | undefined;
667
- stickyPositionComponentInternal: React.ComponentType<any> | undefined;
668
- stickyIndicesArr: number[];
669
- stickyIndicesSet: Set<number>;
670
- stylePaddingBottom: number | undefined;
671
- stylePaddingTop: number | undefined;
672
- suggestEstimatedItemSize: boolean;
673
- useWindowScroll: boolean;
674
- };
675
- }
676
- interface ViewableRange<T> {
677
- end: number;
678
- endBuffered: number;
679
- items: T[];
680
- start: number;
681
- startBuffered: number;
682
- }
683
452
  interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
684
453
  data: readonly ItemT[];
685
454
  extraData: any;
@@ -696,8 +465,11 @@ type LegendListState$1 = {
696
465
  endBuffered: number;
697
466
  isAtEnd: boolean;
698
467
  isAtStart: boolean;
468
+ isNearEnd: boolean;
469
+ isNearStart: boolean;
699
470
  isEndReached: boolean;
700
471
  isStartReached: boolean;
472
+ isWithinMaintainScrollAtEndThreshold: boolean;
701
473
  listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
702
474
  listenToPosition: (key: string, callback: (value: number) => void) => () => void;
703
475
  positionAtIndex: (index: number) => number;
@@ -843,10 +615,15 @@ interface ViewabilityConfigCallbackPair<ItemT = any> {
843
615
  viewabilityConfig: ViewabilityConfig;
844
616
  }
845
617
  type ViewabilityConfigCallbackPairs<ItemT> = ViewabilityConfigCallbackPair<ItemT>[];
846
- type OnViewableItemsChanged<ItemT> = ((info: {
847
- viewableItems: Array<ViewToken<ItemT>>;
618
+ interface OnViewableItemsChangedInfo<ItemT> {
848
619
  changed: Array<ViewToken<ItemT>>;
849
- }) => void) | null;
620
+ end: number;
621
+ endBuffered: number;
622
+ start: number;
623
+ startBuffered: number;
624
+ viewableItems: Array<ViewToken<ItemT>>;
625
+ }
626
+ type OnViewableItemsChanged<ItemT> = ((info: OnViewableItemsChangedInfo<ItemT>) => void) | null;
850
627
  interface ViewabilityConfig {
851
628
  /**
852
629
  * A unique ID to identify this viewability config
@@ -884,12 +661,6 @@ interface LegendListRecyclingState<T> {
884
661
  prevIndex: number | undefined;
885
662
  prevItem: T | undefined;
886
663
  }
887
- type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactElement | null) => (props: P & React.RefAttributes<T>) => React.ReactElement | null;
888
- declare const typedForwardRef: TypedForwardRef;
889
- type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<React.ComponentProps<T>>, nextProps: Readonly<React.ComponentProps<T>>) => boolean) => T & {
890
- displayName?: string;
891
- };
892
- declare const typedMemo: TypedMemo;
893
664
  interface ScrollIndexWithOffset {
894
665
  index: number;
895
666
  viewOffset?: number;
@@ -901,19 +672,14 @@ interface ScrollIndexWithOffsetPosition extends ScrollIndexWithOffset {
901
672
  interface ScrollIndexWithOffsetAndContentOffset extends ScrollIndexWithOffsetPosition {
902
673
  contentOffset?: number;
903
674
  }
675
+ /** @deprecated Kept for backwards compatibility. Use `ScrollIndexWithOffsetPosition`. */
904
676
  interface InitialScrollAnchor extends ScrollIndexWithOffsetPosition {
905
677
  attempts?: number;
906
678
  lastDelta?: number;
907
679
  settledTicks?: number;
908
680
  }
909
- type GetRenderedItemResult<ItemT> = {
910
- index: number;
911
- item: ItemT;
912
- renderedItem: React.ReactNode;
913
- };
914
- type GetRenderedItem = (key: string) => GetRenderedItemResult<any> | null;
915
681
 
916
- type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
682
+ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "anchoredEndSpace" | "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
917
683
  onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
918
684
  refScrollView?: React.Ref<ScrollView>;
919
685
  renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
@@ -944,4 +710,4 @@ declare function useSyncLayout(): () => void;
944
710
 
945
711
  declare const LegendList: LegendListComponent;
946
712
 
947
- 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 };
713
+ export { type AlwaysRenderConfig, 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 };