@legendapp/list 2.1.0-next.0 → 3.0.0-beta.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.
@@ -0,0 +1,670 @@
1
+ import * as React$1 from 'react';
2
+ import { ComponentProps, Key, ReactNode } from 'react';
3
+ import { View, ScrollView, Animated, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin, StyleProp, ViewStyle, NativeSyntheticEvent, NativeScrollEvent, ScrollViewProps } from 'react-native';
4
+ import Animated$1 from 'react-native-reanimated';
5
+
6
+ type AnimatedValue = number;
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" | "scrollAdjustPending" | "scrollingTo" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize" | "activeStickyIndex";
9
+ interface StateContext {
10
+ internalState: InternalState | undefined;
11
+ listeners: Map<ListenerType, Set<(value: any) => void>>;
12
+ values: Map<ListenerType, any>;
13
+ mapViewabilityCallbacks: Map<string, ViewabilityCallback>;
14
+ mapViewabilityValues: Map<string, ViewToken>;
15
+ mapViewabilityAmountCallbacks: Map<number, ViewabilityAmountCallback>;
16
+ mapViewabilityAmountValues: Map<number, ViewAmountToken>;
17
+ mapViewabilityConfigStates: Map<string, {
18
+ viewableItems: ViewToken[];
19
+ start: number;
20
+ end: number;
21
+ previousStart: number;
22
+ previousEnd: number;
23
+ }>;
24
+ columnWrapperStyle: ColumnWrapperStyle | undefined;
25
+ viewRefs: Map<number, React$1.RefObject<View>>;
26
+ animatedScrollY: AnimatedValue;
27
+ }
28
+
29
+ declare class ScrollAdjustHandler {
30
+ private appliedAdjust;
31
+ private pendingAdjust;
32
+ private context;
33
+ private mounted;
34
+ constructor(ctx: StateContext);
35
+ requestAdjust(add: number): void;
36
+ setMounted(): void;
37
+ getAdjust(): number;
38
+ }
39
+
40
+ type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
41
+ interface DataModeProps<ItemT, TItemType extends string | undefined> {
42
+ /**
43
+ * Array of items to render in the list.
44
+ * @required when using data mode
45
+ */
46
+ data: ReadonlyArray<ItemT>;
47
+ /**
48
+ * Function or React component to render each item in the list.
49
+ * Can be either:
50
+ * - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
51
+ * - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
52
+ * @required when using data mode
53
+ */
54
+ renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
55
+ children?: never;
56
+ }
57
+ interface ChildrenModeProps {
58
+ /**
59
+ * React children elements to render as list items.
60
+ * Each child will be treated as an individual list item.
61
+ * @required when using children mode
62
+ */
63
+ children: ReactNode;
64
+ data?: never;
65
+ renderItem?: never;
66
+ }
67
+ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
68
+ /**
69
+ * If true, aligns items at the end of the list.
70
+ * @default false
71
+ */
72
+ alignItemsAtEnd?: boolean;
73
+ /**
74
+ * If true, enables using average sizes for performance optimization.
75
+ * @default true
76
+ */
77
+ enableAverages?: boolean;
78
+ /**
79
+ * Style applied to each column's wrapper view.
80
+ */
81
+ columnWrapperStyle?: ColumnWrapperStyle;
82
+ /**
83
+ * Distance in pixels to pre-render items ahead of the visible area.
84
+ * @default 250
85
+ */
86
+ drawDistance?: number;
87
+ /**
88
+ * Estimated size of each item in pixels, a hint for the first render. After some
89
+ * items are rendered, the average size of rendered items will be used instead.
90
+ * @default undefined
91
+ */
92
+ estimatedItemSize?: number;
93
+ /**
94
+ * Estimated size of the ScrollView in pixels, a hint for the first render to improve performance
95
+ * @default undefined
96
+ */
97
+ estimatedListSize?: {
98
+ height: number;
99
+ width: number;
100
+ };
101
+ /**
102
+ * Extra data to trigger re-rendering when changed.
103
+ */
104
+ extraData?: any;
105
+ /**
106
+ * Version token that forces the list to treat data as updated even when the array reference is stable.
107
+ * Increment or change this when mutating the data array in place.
108
+ */
109
+ dataVersion?: Key;
110
+ /**
111
+ * In case you have distinct item sizes, you can provide a function to get the size of an item.
112
+ * Use instead of FlatList's getItemLayout or FlashList overrideItemLayout if you want to have accurate initialScrollOffset, you should provide this function
113
+ */
114
+ getEstimatedItemSize?: (index: number, item: ItemT, type: TItemType) => number;
115
+ /**
116
+ * Ratio of initial container pool size to data length (e.g., 0.5 for half).
117
+ * @default 2
118
+ */
119
+ initialContainerPoolRatio?: number | undefined;
120
+ /**
121
+ * Initial scroll position in pixels.
122
+ * @default 0
123
+ */
124
+ initialScrollOffset?: number;
125
+ /**
126
+ * Index to scroll to initially.
127
+ * @default 0
128
+ */
129
+ initialScrollIndex?: number | {
130
+ index: number;
131
+ viewOffset?: number | undefined;
132
+ };
133
+ /**
134
+ * When true, the list initializes scrolled to the last item.
135
+ * Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
136
+ * @default false
137
+ */
138
+ initialScrollAtEnd?: boolean;
139
+ /**
140
+ * Component to render between items, receiving the leading item as prop.
141
+ */
142
+ ItemSeparatorComponent?: React.ComponentType<{
143
+ leadingItem: ItemT;
144
+ }>;
145
+ /**
146
+ * Function to extract a unique key for each item.
147
+ */
148
+ keyExtractor?: (item: ItemT, index: number) => string;
149
+ /**
150
+ * Component or element to render when the list is empty.
151
+ */
152
+ ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
153
+ /**
154
+ * Component or element to render below the list.
155
+ */
156
+ ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
157
+ /**
158
+ * Style for the footer component.
159
+ */
160
+ ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
161
+ /**
162
+ * Component or element to render above the list.
163
+ */
164
+ ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
165
+ /**
166
+ * Style for the header component.
167
+ */
168
+ ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
169
+ /**
170
+ * If true, auto-scrolls to end when new items are added.
171
+ * @default false
172
+ */
173
+ maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
174
+ /**
175
+ * Distance threshold in percentage of screen size to trigger maintainScrollAtEnd.
176
+ * @default 0.1
177
+ */
178
+ maintainScrollAtEndThreshold?: number;
179
+ /**
180
+ * If true, maintains visibility of content across data changes (filtering/resorting/insertions).
181
+ * Scroll-time stability for measurements is always enabled.
182
+ * @default false
183
+ */
184
+ maintainVisibleContentPosition?: boolean;
185
+ /**
186
+ * Number of columns to render items in.
187
+ * @default 1
188
+ */
189
+ numColumns?: number;
190
+ /**
191
+ * Called when scrolling reaches the end within onEndReachedThreshold.
192
+ */
193
+ onEndReached?: ((info: {
194
+ distanceFromEnd: number;
195
+ }) => void) | null | undefined;
196
+ /**
197
+ * How close to the end (in fractional units of visible length) to trigger onEndReached.
198
+ * @default 0.5
199
+ */
200
+ onEndReachedThreshold?: number | null | undefined;
201
+ /**
202
+ * Called when an item's size changes.
203
+ */
204
+ onItemSizeChanged?: (info: {
205
+ size: number;
206
+ previous: number;
207
+ index: number;
208
+ itemKey: string;
209
+ itemData: ItemT;
210
+ }) => void;
211
+ /**
212
+ * Function to call when the user pulls to refresh.
213
+ */
214
+ onRefresh?: () => void;
215
+ onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
216
+ /**
217
+ * Called when scrolling reaches the start within onStartReachedThreshold.
218
+ */
219
+ onStartReached?: ((info: {
220
+ distanceFromStart: number;
221
+ }) => void) | null | undefined;
222
+ /**
223
+ * How close to the start (in fractional units of visible length) to trigger onStartReached.
224
+ * @default 0.5
225
+ */
226
+ onStartReachedThreshold?: number | null | undefined;
227
+ /**
228
+ * Called when the sticky header changes.
229
+ */
230
+ onStickyHeaderChange?: (info: {
231
+ index: number;
232
+ item: any;
233
+ }) => void;
234
+ /**
235
+ * Called when the viewability of items changes.
236
+ */
237
+ onViewableItemsChanged?: OnViewableItemsChanged<ItemT> | undefined;
238
+ /**
239
+ * Offset in pixels for the refresh indicator.
240
+ * @default 0
241
+ */
242
+ progressViewOffset?: number;
243
+ /**
244
+ * If true, recycles item views for better performance.
245
+ * @default false
246
+ */
247
+ recycleItems?: boolean;
248
+ /**
249
+ * Ref to the underlying ScrollView component.
250
+ */
251
+ refScrollView?: React.Ref<ScrollView>;
252
+ /**
253
+ * If true, shows a refresh indicator.
254
+ * @default false
255
+ */
256
+ refreshing?: boolean;
257
+ /**
258
+ * Render custom ScrollView component.
259
+ * Note: When using `stickyHeaderIndices`, you must provide an Animated ScrollView component.
260
+ * @default (props) => <ScrollView {...props} />
261
+ */
262
+ renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
263
+ /**
264
+ * This will log a suggested estimatedItemSize.
265
+ * @required
266
+ * @default false
267
+ */
268
+ suggestEstimatedItemSize?: boolean;
269
+ /**
270
+ * Configuration for determining item viewability.
271
+ */
272
+ viewabilityConfig?: ViewabilityConfig;
273
+ /**
274
+ * Pairs of viewability configs and their callbacks for tracking visibility.
275
+ */
276
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs<ItemT> | undefined;
277
+ /**
278
+ * If true, delays rendering until initial layout is complete.
279
+ * @default false
280
+ */
281
+ waitForInitialLayout?: boolean;
282
+ onLoad?: (info: {
283
+ elapsedTimeInMs: number;
284
+ }) => void;
285
+ snapToIndices?: number[];
286
+ /**
287
+ * Array of child indices determining which children get docked to the top of the screen when scrolling.
288
+ * For example, passing stickyHeaderIndices={[0]} will cause the first child to be fixed to the top of the scroll view.
289
+ * Not supported in conjunction with horizontal={true}.
290
+ * @default undefined
291
+ */
292
+ stickyHeaderIndices?: number[];
293
+ /**
294
+ * @deprecated Use stickyHeaderIndices instead for parity with React Native.
295
+ */
296
+ stickyIndices?: number[];
297
+ getItemType?: (item: ItemT, index: number) => TItemType;
298
+ getFixedItemSize?: (index: number, item: ItemT, type: TItemType) => number | undefined;
299
+ itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
300
+ }
301
+ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView> | ComponentProps<typeof Animated$1.ScrollView>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollView> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
302
+ interface MaintainScrollAtEndOptions {
303
+ onLayout?: boolean;
304
+ onItemLayout?: boolean;
305
+ onDataChange?: boolean;
306
+ }
307
+ interface ColumnWrapperStyle {
308
+ rowGap?: number;
309
+ gap?: number;
310
+ columnGap?: number;
311
+ }
312
+ type LegendListProps<ItemT = any> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
313
+ interface ThresholdSnapshot {
314
+ scrollPosition: number;
315
+ contentSize?: number;
316
+ dataLength?: number;
317
+ atThreshold: boolean;
318
+ }
319
+ interface ScrollTarget {
320
+ offset: number;
321
+ index?: number;
322
+ viewOffset?: number;
323
+ viewPosition?: number;
324
+ animated?: boolean;
325
+ isInitialScroll?: boolean;
326
+ precomputedWithViewOffset?: boolean;
327
+ }
328
+ interface InternalState {
329
+ positions: Map<string, number>;
330
+ columns: Map<string, number>;
331
+ sizes: Map<string, number>;
332
+ sizesKnown: Map<string, number>;
333
+ containerItemKeys: Set<string>;
334
+ containerItemTypes: Map<number, string>;
335
+ isStartReached: boolean;
336
+ isEndReached: boolean;
337
+ isAtEnd: boolean;
338
+ isAtStart: boolean;
339
+ hasScrolled?: boolean;
340
+ scrollLength: number;
341
+ startBuffered: number;
342
+ startBufferedId?: string;
343
+ startNoBuffer: number;
344
+ endBuffered: number;
345
+ endNoBuffer: number;
346
+ firstFullyOnScreenIndex: number;
347
+ idsInView: string[];
348
+ scrollPending: number;
349
+ scroll: number;
350
+ scrollTime: number;
351
+ scrollPrev: number;
352
+ scrollPrevTime: number;
353
+ scrollAdjustHandler: ScrollAdjustHandler;
354
+ triggerCalculateItemsInView?: (params?: {
355
+ doMVCP?: boolean;
356
+ dataChanged?: boolean;
357
+ forceFullItemPositions?: boolean;
358
+ }) => void;
359
+ maintainingScrollAtEnd?: boolean;
360
+ totalSize: number;
361
+ otherAxisSize?: number;
362
+ timeouts: Set<number>;
363
+ timeoutSizeMessage: any;
364
+ nativeMarginTop: number;
365
+ indexByKey: Map<string, number>;
366
+ idCache: string[];
367
+ viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs<any> | undefined;
368
+ scrollHistory: Array<{
369
+ scroll: number;
370
+ time: number;
371
+ }>;
372
+ lastScrollAdjustForHistory?: number;
373
+ startReachedSnapshot: ThresholdSnapshot | undefined;
374
+ endReachedSnapshot: ThresholdSnapshot | undefined;
375
+ scrollForNextCalculateItemsInView: {
376
+ top: number;
377
+ bottom: number;
378
+ } | undefined;
379
+ enableScrollForNextCalculateItemsInView: boolean;
380
+ minIndexSizeChanged: number | undefined;
381
+ queuedInitialLayout?: boolean | undefined;
382
+ queuedCalculateItemsInView: number | undefined;
383
+ dataChangeNeedsScrollUpdate: boolean;
384
+ previousData?: readonly unknown[];
385
+ didColumnsChange?: boolean;
386
+ didDataChange?: boolean;
387
+ isFirst?: boolean;
388
+ lastBatchingAction: number;
389
+ ignoreScrollFromMVCP?: {
390
+ lt?: number;
391
+ gt?: number;
392
+ };
393
+ ignoreScrollFromMVCPIgnored?: boolean;
394
+ ignoreScrollFromMVCPTimeout?: any;
395
+ needsOtherAxisSize?: boolean;
396
+ averageSizes: Record<string, {
397
+ num: number;
398
+ avg: number;
399
+ }>;
400
+ refScroller: React.RefObject<ScrollView>;
401
+ loadStartTime: number;
402
+ initialScroll: ScrollIndexWithOffsetAndContentOffset | undefined;
403
+ initialAnchor?: InitialScrollAnchor;
404
+ lastLayout: LayoutRectangle | undefined;
405
+ timeoutSetPaddingTop?: any;
406
+ activeStickyIndex: number | undefined;
407
+ stickyContainers: Map<number, number>;
408
+ stickyContainerPool: Set<number>;
409
+ scrollProcessingEnabled: boolean;
410
+ pendingTotalSize?: number;
411
+ adjustingFromInitialMount?: number;
412
+ props: {
413
+ alignItemsAtEnd: boolean;
414
+ data: readonly any[];
415
+ dataVersion: Key | undefined;
416
+ estimatedItemSize: number | undefined;
417
+ getEstimatedItemSize: LegendListProps["getEstimatedItemSize"];
418
+ getFixedItemSize: LegendListProps["getFixedItemSize"];
419
+ getItemType: LegendListProps["getItemType"];
420
+ horizontal: boolean;
421
+ keyExtractor: LegendListProps["keyExtractor"];
422
+ maintainScrollAtEnd: boolean | MaintainScrollAtEndOptions;
423
+ maintainScrollAtEndThreshold: number | undefined;
424
+ maintainVisibleContentPosition: boolean;
425
+ onEndReached: LegendListProps["onEndReached"];
426
+ onEndReachedThreshold: number | null | undefined;
427
+ onItemSizeChanged: LegendListProps["onItemSizeChanged"];
428
+ onLoad: LegendListProps["onLoad"];
429
+ onScroll: LegendListProps["onScroll"];
430
+ onStartReached: LegendListProps["onStartReached"];
431
+ onStartReachedThreshold: number | null | undefined;
432
+ onStickyHeaderChange: LegendListProps["onStickyHeaderChange"];
433
+ recycleItems: boolean;
434
+ suggestEstimatedItemSize: boolean;
435
+ stylePaddingBottom: number | undefined;
436
+ renderItem: LegendListProps["renderItem"];
437
+ scrollBuffer: number;
438
+ numColumns: number;
439
+ initialContainerPoolRatio: number;
440
+ stylePaddingTop: number | undefined;
441
+ snapToIndices: number[] | undefined;
442
+ stickyIndicesSet: Set<number>;
443
+ stickyIndicesArr: number[];
444
+ itemsAreEqual: LegendListProps["itemsAreEqual"];
445
+ enableAverages: boolean;
446
+ };
447
+ }
448
+ interface ViewableRange<T> {
449
+ startBuffered: number;
450
+ start: number;
451
+ endBuffered: number;
452
+ end: number;
453
+ items: T[];
454
+ }
455
+ interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
456
+ item: ItemT;
457
+ type: TItemType;
458
+ index: number;
459
+ data: readonly ItemT[];
460
+ extraData: any;
461
+ }
462
+ type ScrollState = {
463
+ activeStickyIndex: number | undefined;
464
+ contentLength: number;
465
+ data: readonly any[];
466
+ elementAtIndex: (index: number) => View | null | undefined;
467
+ end: number;
468
+ endBuffered: number;
469
+ isAtEnd: boolean;
470
+ isAtStart: boolean;
471
+ positionAtIndex: (index: number) => number;
472
+ positions: Map<string, number>;
473
+ scroll: number;
474
+ scrollLength: number;
475
+ sizeAtIndex: (index: number) => number;
476
+ sizes: Map<string, number>;
477
+ start: number;
478
+ startBuffered: number;
479
+ };
480
+ type LegendListRef = {
481
+ /**
482
+ * Displays the scroll indicators momentarily.
483
+ */
484
+ flashScrollIndicators(): void;
485
+ /**
486
+ * Returns the native ScrollView component reference.
487
+ */
488
+ getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
489
+ /**
490
+ * Returns the scroll responder instance for handling scroll events.
491
+ */
492
+ getScrollableNode(): any;
493
+ /**
494
+ * Returns the ScrollResponderMixin for advanced scroll handling.
495
+ */
496
+ getScrollResponder(): ScrollResponderMixin;
497
+ /**
498
+ * Returns the internal state of the scroll virtualization.
499
+ */
500
+ getState(): ScrollState;
501
+ /**
502
+ * Scrolls a specific index into view.
503
+ * @param params - Parameters for scrolling.
504
+ * @param params.animated - If true, animates the scroll. Default: true.
505
+ * @param params.index - The index to scroll to.
506
+ */
507
+ scrollIndexIntoView(params: {
508
+ animated?: boolean | undefined;
509
+ index: number;
510
+ }): void;
511
+ /**
512
+ * Scrolls a specific index into view.
513
+ * @param params - Parameters for scrolling.
514
+ * @param params.animated - If true, animates the scroll. Default: true.
515
+ * @param params.item - The item to scroll to.
516
+ */
517
+ scrollItemIntoView(params: {
518
+ animated?: boolean | undefined;
519
+ item: any;
520
+ }): void;
521
+ /**
522
+ * Scrolls to the end of the list.
523
+ * @param options - Options for scrolling.
524
+ * @param options.animated - If true, animates the scroll. Default: true.
525
+ * @param options.viewOffset - Offset from the target position.
526
+ */
527
+ scrollToEnd(options?: {
528
+ animated?: boolean | undefined;
529
+ viewOffset?: number | undefined;
530
+ }): void;
531
+ /**
532
+ * Scrolls to a specific index in the list.
533
+ * @param params - Parameters for scrolling.
534
+ * @param params.animated - If true, animates the scroll. Default: true.
535
+ * @param params.index - The index to scroll to.
536
+ * @param params.viewOffset - Offset from the target position.
537
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
538
+ */
539
+ scrollToIndex(params: {
540
+ animated?: boolean | undefined;
541
+ index: number;
542
+ viewOffset?: number | undefined;
543
+ viewPosition?: number | undefined;
544
+ }): void;
545
+ /**
546
+ * Scrolls to a specific item in the list.
547
+ * @param params - Parameters for scrolling.
548
+ * @param params.animated - If true, animates the scroll. Default: true.
549
+ * @param params.item - The item to scroll to.
550
+ * @param params.viewOffset - Offset from the target position.
551
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
552
+ */
553
+ scrollToItem(params: {
554
+ animated?: boolean | undefined;
555
+ item: any;
556
+ viewOffset?: number | undefined;
557
+ viewPosition?: number | undefined;
558
+ }): void;
559
+ /**
560
+ * Scrolls to a specific offset in pixels.
561
+ * @param params - Parameters for scrolling.
562
+ * @param params.offset - The pixel offset to scroll to.
563
+ * @param params.animated - If true, animates the scroll. Default: true.
564
+ */
565
+ scrollToOffset(params: {
566
+ offset: number;
567
+ animated?: boolean | undefined;
568
+ }): void;
569
+ /**
570
+ * Sets or adds to the offset of the visible content anchor.
571
+ * @param value - The offset to set or add.
572
+ * @param animated - If true, uses Animated to animate the change.
573
+ */
574
+ setVisibleContentAnchorOffset(value: number | ((value: number) => number)): void;
575
+ /**
576
+ * Sets whether scroll processing is enabled.
577
+ * @param enabled - If true, scroll processing is enabled.
578
+ */
579
+ setScrollProcessingEnabled(enabled: boolean): void;
580
+ };
581
+ interface ViewToken<ItemT = any> {
582
+ item: ItemT;
583
+ key: string;
584
+ index: number;
585
+ isViewable: boolean;
586
+ containerId: number;
587
+ }
588
+ interface ViewAmountToken<ItemT = any> extends ViewToken<ItemT> {
589
+ sizeVisible: number;
590
+ size: number;
591
+ percentVisible: number;
592
+ percentOfScroller: number;
593
+ scrollSize: number;
594
+ }
595
+ interface ViewabilityConfigCallbackPair<ItemT = any> {
596
+ viewabilityConfig: ViewabilityConfig;
597
+ onViewableItemsChanged?: OnViewableItemsChanged<ItemT>;
598
+ }
599
+ type ViewabilityConfigCallbackPairs<ItemT> = ViewabilityConfigCallbackPair<ItemT>[];
600
+ type OnViewableItemsChanged<ItemT> = ((info: {
601
+ viewableItems: Array<ViewToken<ItemT>>;
602
+ changed: Array<ViewToken<ItemT>>;
603
+ }) => void) | null;
604
+ interface ViewabilityConfig {
605
+ /**
606
+ * A unique ID to identify this viewability config
607
+ */
608
+ id?: string;
609
+ /**
610
+ * Minimum amount of time (in milliseconds) that an item must be physically viewable before the
611
+ * viewability callback will be fired. A high number means that scrolling through content without
612
+ * stopping will not mark the content as viewable.
613
+ */
614
+ minimumViewTime?: number | undefined;
615
+ /**
616
+ * Percent of viewport that must be covered for a partially occluded item to count as
617
+ * "viewable", 0-100. Fully visible items are always considered viewable. A value of 0 means
618
+ * that a single pixel in the viewport makes the item viewable, and a value of 100 means that
619
+ * an item must be either entirely visible or cover the entire viewport to count as viewable.
620
+ */
621
+ viewAreaCoveragePercentThreshold?: number | undefined;
622
+ /**
623
+ * Similar to `viewAreaCoveragePercentThreshold`, but considers the percent of the item that is visible,
624
+ * rather than the fraction of the viewable area it covers.
625
+ */
626
+ itemVisiblePercentThreshold?: number | undefined;
627
+ /**
628
+ * Nothing is considered viewable until the user scrolls or `recordInteraction` is called after
629
+ * render.
630
+ */
631
+ waitForInteraction?: boolean | undefined;
632
+ }
633
+ type ViewabilityCallback<ItemT = any> = (viewToken: ViewToken<ItemT>) => void;
634
+ type ViewabilityAmountCallback<ItemT = any> = (viewToken: ViewAmountToken<ItemT>) => void;
635
+ interface LegendListRecyclingState<T> {
636
+ item: T;
637
+ prevItem: T | undefined;
638
+ index: number;
639
+ prevIndex: number | undefined;
640
+ }
641
+ type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
642
+ declare const typedForwardRef: TypedForwardRef;
643
+ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<React.JSXElementConstructor<T>>, nextProps: Readonly<React.JSXElementConstructor<T>>) => boolean) => T & {
644
+ displayName?: string;
645
+ };
646
+ declare const typedMemo: TypedMemo;
647
+ interface ScrollIndexWithOffset {
648
+ index: number;
649
+ viewOffset?: number;
650
+ viewPosition?: number;
651
+ }
652
+ interface ScrollIndexWithOffsetPosition extends ScrollIndexWithOffset {
653
+ viewPosition?: number;
654
+ }
655
+ interface ScrollIndexWithOffsetAndContentOffset extends ScrollIndexWithOffsetPosition {
656
+ contentOffset?: number;
657
+ }
658
+ interface InitialScrollAnchor extends ScrollIndexWithOffsetPosition {
659
+ attempts?: number;
660
+ lastDelta?: number;
661
+ settledTicks?: number;
662
+ }
663
+ type GetRenderedItemResult<ItemT> = {
664
+ index: number;
665
+ item: ItemT;
666
+ renderedItem: React.ReactNode;
667
+ };
668
+ type GetRenderedItem = (key: string) => GetRenderedItemResult<any> | null;
669
+
670
+ export { type ColumnWrapperStyle as C, type GetRenderedItemResult as G, type InternalState as I, type LegendListProps as L, type MaintainScrollAtEndOptions as M, type OnViewableItemsChanged as O, type ScrollTarget as S, type ThresholdSnapshot as T, type ViewabilityCallback as V, type LegendListRef as a, type ViewabilityAmountCallback as b, type LegendListRecyclingState as c, type LegendListPropsBase as d, type ViewableRange as e, type LegendListRenderItemProps as f, type ScrollState as g, type ViewToken as h, type ViewAmountToken as i, type ViewabilityConfigCallbackPair as j, type ViewabilityConfigCallbackPairs as k, type ViewabilityConfig as l, type TypedForwardRef as m, type TypedMemo as n, typedMemo as o, type ScrollIndexWithOffset as p, type ScrollIndexWithOffsetPosition as q, type ScrollIndexWithOffsetAndContentOffset as r, type InitialScrollAnchor as s, typedForwardRef as t, type GetRenderedItem as u };