@legendapp/list 3.0.0-beta.16 → 3.0.0-beta.18

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