@legendapp/list 3.0.0-beta.2 → 3.0.0-beta.21

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