@legendapp/list 3.0.0-beta.4 → 3.0.0-beta.41

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 (49) hide show
  1. package/.DS_Store +0 -0
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +9 -2
  4. package/animated.d.ts +620 -5
  5. package/animated.js +2 -2
  6. package/animated.mjs +1 -1
  7. package/index.d.ts +1227 -11
  8. package/index.js +2594 -1023
  9. package/index.mjs +2593 -1024
  10. package/index.native.js +2347 -961
  11. package/index.native.mjs +2327 -943
  12. package/keyboard-test.d.ts +206 -0
  13. package/keyboard-test.js +34 -0
  14. package/keyboard-test.mjs +13 -0
  15. package/keyboard.d.ts +206 -8
  16. package/keyboard.js +340 -32
  17. package/keyboard.mjs +343 -34
  18. package/package.json +62 -1
  19. package/{types-JPHClxiw.d.mts → react-native.d.ts} +436 -158
  20. package/react-native.js +4942 -0
  21. package/react-native.mjs +4911 -0
  22. package/{types-JPHClxiw.d.ts → react-native.web.d.ts} +493 -158
  23. package/react-native.web.js +5357 -0
  24. package/react-native.web.mjs +5326 -0
  25. package/{types-YNdphn_A.d.mts → react.d.ts} +493 -158
  26. package/react.js +5357 -0
  27. package/react.mjs +5326 -0
  28. package/reanimated.d.ts +631 -7
  29. package/reanimated.js +156 -30
  30. package/reanimated.mjs +155 -29
  31. package/section-list.d.ts +620 -5
  32. package/section-list.js +38 -3679
  33. package/section-list.mjs +34 -3676
  34. package/animated.d.mts +0 -9
  35. package/index.d.mts +0 -23
  36. package/index.native.d.mts +0 -23
  37. package/index.native.d.ts +0 -23
  38. package/keyboard-controller.d.mts +0 -12
  39. package/keyboard-controller.d.ts +0 -12
  40. package/keyboard-controller.js +0 -69
  41. package/keyboard-controller.mjs +0 -48
  42. package/keyboard.d.mts +0 -13
  43. package/reanimated.d.mts +0 -18
  44. package/section-list.d.mts +0 -113
  45. package/section-list.native.d.mts +0 -113
  46. package/section-list.native.d.ts +0 -113
  47. package/section-list.native.js +0 -3700
  48. package/section-list.native.mjs +0 -3679
  49. package/types-YNdphn_A.d.ts +0 -670
package/section-list.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import * as react_native from 'react-native';
2
- import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
2
+ import { SectionListData, ScrollViewProps, NativeSyntheticEvent as NativeSyntheticEvent$1, NativeScrollEvent as NativeScrollEvent$1, ScrollView, StyleProp as StyleProp$1, ViewStyle as ViewStyle$1, ScrollViewComponent, ScrollResponderMixin, Insets as Insets$1, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
3
3
  import * as React from 'react';
4
- import { a as LegendListRef, L as LegendListProps } from './types-JPHClxiw.js';
5
- import 'react-native-reanimated';
4
+ import { Key } from 'react';
6
5
 
7
6
  type SectionListSeparatorProps<ItemT, SectionT> = {
8
7
  leadingItem?: ItemT;
@@ -60,6 +59,622 @@ type BuildSectionListDataResult<ItemT, SectionT> = {
60
59
  stickyHeaderIndices: number[];
61
60
  };
62
61
 
62
+ type ListenerType = "activeStickyIndex" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
63
+ type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
64
+ type ListenerTypeValueMap = {
65
+ activeStickyIndex: number;
66
+ animatedScrollY: any;
67
+ debugComputedScroll: number;
68
+ debugRawScroll: number;
69
+ extraData: any;
70
+ footerSize: number;
71
+ headerSize: number;
72
+ lastItemKeys: string[];
73
+ lastPositionUpdate: number;
74
+ maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
75
+ numColumns: number;
76
+ numContainers: number;
77
+ numContainersPooled: number;
78
+ otherAxisSize: number;
79
+ readyToRender: boolean;
80
+ scrollAdjust: number;
81
+ scrollAdjustPending: number;
82
+ scrollAdjustUserOffset: number;
83
+ scrollSize: {
84
+ width: number;
85
+ height: number;
86
+ };
87
+ snapToOffsets: number[];
88
+ stylePaddingTop: number;
89
+ totalSize: number;
90
+ } & {
91
+ [K in ListenerType as K extends `containerItemKey${number}` ? K : never]: string;
92
+ } & {
93
+ [K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
94
+ } & {
95
+ [K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
96
+ } & {
97
+ [K in ListenerType as K extends `containerColumn${number}` ? K : never]: number;
98
+ } & {
99
+ [K in ListenerType as K extends `containerSpan${number}` ? K : never]: number;
100
+ } & {
101
+ [K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
102
+ };
103
+
104
+ interface Insets {
105
+ top: number;
106
+ left: number;
107
+ bottom: number;
108
+ right: number;
109
+ }
110
+ interface NativeScrollEvent {
111
+ contentOffset: {
112
+ x: number;
113
+ y: number;
114
+ };
115
+ contentSize: {
116
+ width: number;
117
+ height: number;
118
+ };
119
+ layoutMeasurement: {
120
+ width: number;
121
+ height: number;
122
+ };
123
+ contentInset: Insets;
124
+ zoomScale: number;
125
+ }
126
+ interface NativeSyntheticEvent<T> {
127
+ nativeEvent: T;
128
+ }
129
+ type ViewStyle = Record<string, unknown>;
130
+ type StyleProp<T> = T | T[] | null | undefined | false;
131
+ type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
132
+ interface DataModeProps<ItemT, TItemType extends string | undefined> {
133
+ /**
134
+ * Array of items to render in the list.
135
+ * @required when using data mode
136
+ */
137
+ data: ReadonlyArray<ItemT>;
138
+ /**
139
+ * Function or React component to render each item in the list.
140
+ * Can be either:
141
+ * - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
142
+ * - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
143
+ * @required when using data mode
144
+ */
145
+ renderItem: ((props: LegendListRenderItemProps<ItemT, TItemType>) => React.ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT, TItemType>>;
146
+ children?: never;
147
+ }
148
+ interface ChildrenModeProps {
149
+ /**
150
+ * React children elements to render as list items.
151
+ * Each child will be treated as an individual list item.
152
+ * @required when using children mode
153
+ */
154
+ children: React.ReactNode;
155
+ data?: never;
156
+ renderItem?: never;
157
+ }
158
+ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
159
+ /**
160
+ * If true, aligns items at the end of the list.
161
+ * @default false
162
+ */
163
+ alignItemsAtEnd?: boolean;
164
+ /**
165
+ * Keeps selected items mounted even when they scroll out of view.
166
+ * @default undefined
167
+ */
168
+ alwaysRender?: AlwaysRenderConfig;
169
+ /**
170
+ * Style applied to each column's wrapper view.
171
+ */
172
+ columnWrapperStyle?: ColumnWrapperStyle;
173
+ /**
174
+ * Distance in pixels to pre-render items ahead of the visible area.
175
+ * @default 250
176
+ */
177
+ drawDistance?: number;
178
+ /**
179
+ * Estimated size of each item in pixels, a hint for the first render. After some
180
+ * items are rendered, the average size of rendered items will be used instead.
181
+ * @default undefined
182
+ */
183
+ estimatedItemSize?: number;
184
+ /**
185
+ * Estimated size of the ScrollView in pixels, a hint for the first render to improve performance
186
+ * @default undefined
187
+ */
188
+ estimatedListSize?: {
189
+ height: number;
190
+ width: number;
191
+ };
192
+ /**
193
+ * Extra data to trigger re-rendering when changed.
194
+ */
195
+ extraData?: any;
196
+ /**
197
+ * Version token that forces the list to treat data as updated even when the array reference is stable.
198
+ * Increment or change this when mutating the data array in place.
199
+ */
200
+ dataVersion?: Key;
201
+ /**
202
+ * In case you have distinct item sizes, you can provide a function to get the size of an item.
203
+ * Use instead of FlatList's getItemLayout or FlashList overrideItemLayout if you want to have accurate initialScrollOffset, you should provide this function
204
+ */
205
+ getEstimatedItemSize?: (item: ItemT, index: number, type: TItemType) => number;
206
+ /**
207
+ * Customize layout for multi-column lists, such as allowing items to span multiple columns.
208
+ * Similar to FlashList's overrideItemLayout.
209
+ */
210
+ overrideItemLayout?: (layout: {
211
+ span?: number;
212
+ }, item: ItemT, index: number, maxColumns: number, extraData?: any) => void;
213
+ /**
214
+ * Ratio of initial container pool size to data length (e.g., 0.5 for half).
215
+ * @default 2
216
+ */
217
+ initialContainerPoolRatio?: number | undefined;
218
+ /**
219
+ * Initial scroll position in pixels.
220
+ * @default 0
221
+ */
222
+ initialScrollOffset?: number;
223
+ /**
224
+ * Index to scroll to initially.
225
+ * @default 0
226
+ */
227
+ initialScrollIndex?: number | {
228
+ index: number;
229
+ viewOffset?: number | undefined;
230
+ viewPosition?: number | undefined;
231
+ };
232
+ /**
233
+ * When true, the list initializes scrolled to the last item.
234
+ * Overrides `initialScrollIndex` and `initialScrollOffset` when data is available.
235
+ * @default false
236
+ */
237
+ initialScrollAtEnd?: boolean;
238
+ /**
239
+ * Component to render between items, receiving the leading item as prop.
240
+ */
241
+ ItemSeparatorComponent?: React.ComponentType<{
242
+ leadingItem: ItemT;
243
+ }>;
244
+ /**
245
+ * Function to extract a unique key for each item.
246
+ */
247
+ keyExtractor?: (item: ItemT, index: number) => string;
248
+ /**
249
+ * Component or element to render when the list is empty.
250
+ */
251
+ ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
252
+ /**
253
+ * Component or element to render below the list.
254
+ */
255
+ ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
256
+ /**
257
+ * Style for the footer component.
258
+ */
259
+ ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
260
+ /**
261
+ * Component or element to render above the list.
262
+ */
263
+ ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
264
+ /**
265
+ * Style for the header component.
266
+ */
267
+ ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
268
+ /**
269
+ * If true, auto-scrolls to end when new items are added.
270
+ * Use an options object to opt into specific triggers and control whether that scroll is animated.
271
+ * @default false
272
+ */
273
+ maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
274
+ /**
275
+ * Distance threshold in percentage of screen size to trigger maintainScrollAtEnd.
276
+ * @default 0.1
277
+ */
278
+ maintainScrollAtEndThreshold?: number;
279
+ /**
280
+ * Maintains visibility of content.
281
+ * - scroll (default: true) stabilizes during size/layout changes while scrolling.
282
+ * - data (default: false) stabilizes when the data array changes; passing true also sets the RN maintainVisibleContentPosition prop.
283
+ * - shouldRestorePosition can opt out specific items from data-change anchoring.
284
+ * - undefined (default) enables scroll stabilization but skips data-change anchoring.
285
+ * - true enables both behaviors; false disables both.
286
+ */
287
+ maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
288
+ /**
289
+ * Web only: when true, listens to window/body scrolling instead of rendering a scrollable list container.
290
+ * @default false
291
+ */
292
+ useWindowScroll?: boolean;
293
+ /**
294
+ * Number of columns to render items in.
295
+ * @default 1
296
+ */
297
+ numColumns?: number;
298
+ /**
299
+ * Called when scrolling reaches the end within onEndReachedThreshold.
300
+ */
301
+ onEndReached?: ((info: {
302
+ distanceFromEnd: number;
303
+ }) => void) | null | undefined;
304
+ /**
305
+ * How close to the end (in fractional units of visible length) to trigger onEndReached.
306
+ * @default 0.5
307
+ */
308
+ onEndReachedThreshold?: number | null | undefined;
309
+ /**
310
+ * Called when an item's size changes.
311
+ */
312
+ onItemSizeChanged?: (info: {
313
+ size: number;
314
+ previous: number;
315
+ index: number;
316
+ itemKey: string;
317
+ itemData: ItemT;
318
+ }) => void;
319
+ /**
320
+ * Called when list layout metrics change.
321
+ */
322
+ onMetricsChange?: (metrics: LegendListMetrics) => void;
323
+ /**
324
+ * Function to call when the user pulls to refresh.
325
+ */
326
+ onRefresh?: () => void;
327
+ onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
328
+ /**
329
+ * Called when scrolling reaches the start within onStartReachedThreshold.
330
+ */
331
+ onStartReached?: ((info: {
332
+ distanceFromStart: number;
333
+ }) => void) | null | undefined;
334
+ /**
335
+ * How close to the start (in fractional units of visible length) to trigger onStartReached.
336
+ * @default 0.5
337
+ */
338
+ onStartReachedThreshold?: number | null | undefined;
339
+ /**
340
+ * Called when the sticky header changes.
341
+ */
342
+ onStickyHeaderChange?: (info: {
343
+ index: number;
344
+ item: any;
345
+ }) => void;
346
+ /**
347
+ * Called when the viewability of items changes.
348
+ */
349
+ onViewableItemsChanged?: OnViewableItemsChanged<ItemT> | undefined;
350
+ /**
351
+ * Offset in pixels for the refresh indicator.
352
+ * @default 0
353
+ */
354
+ progressViewOffset?: number;
355
+ /**
356
+ * If true, recycles item views for better performance.
357
+ * @default false
358
+ */
359
+ recycleItems?: boolean;
360
+ /**
361
+ * Ref to the underlying ScrollView component.
362
+ */
363
+ refScrollView?: React.Ref<any>;
364
+ /**
365
+ * If true, shows a refresh indicator.
366
+ * @default false
367
+ */
368
+ refreshing?: boolean;
369
+ /**
370
+ * Render custom ScrollView component.
371
+ * Note: When using `stickyHeaderIndices`, you must provide an Animated ScrollView component.
372
+ * @default (props) => <ScrollView {...props} />
373
+ */
374
+ renderScrollComponent?: (props: any) => React.ReactElement | null;
375
+ /**
376
+ * This will log a suggested estimatedItemSize.
377
+ * @required
378
+ * @default false
379
+ */
380
+ suggestEstimatedItemSize?: boolean;
381
+ /**
382
+ * Configuration for determining item viewability.
383
+ */
384
+ viewabilityConfig?: ViewabilityConfig;
385
+ /**
386
+ * Pairs of viewability configs and their callbacks for tracking visibility.
387
+ */
388
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs<ItemT> | undefined;
389
+ /**
390
+ * If true, delays rendering until initial layout is complete.
391
+ * @default false
392
+ */
393
+ waitForInitialLayout?: boolean;
394
+ onLoad?: (info: {
395
+ elapsedTimeInMs: number;
396
+ }) => void;
397
+ snapToIndices?: number[];
398
+ /**
399
+ * Array of child indices determining which children get docked to the top of the screen when scrolling.
400
+ * For example, passing stickyHeaderIndices={[0]} will cause the first child to be fixed to the top of the scroll view.
401
+ * Not supported in conjunction with horizontal={true}.
402
+ * @default undefined
403
+ */
404
+ stickyHeaderIndices?: number[];
405
+ /**
406
+ * @deprecated Use stickyHeaderIndices instead for parity with React Native.
407
+ */
408
+ stickyIndices?: number[];
409
+ /**
410
+ * Configuration for sticky headers.
411
+ * @default undefined
412
+ */
413
+ stickyHeaderConfig?: StickyHeaderConfig;
414
+ getItemType?: (item: ItemT, index: number) => TItemType;
415
+ getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
416
+ itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
417
+ }
418
+ type LegendListPropsBase<ItemT, TScrollViewProps = Record<string, any>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollViewProps> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
419
+ interface MaintainVisibleContentPositionConfig<ItemT = any> {
420
+ data?: boolean;
421
+ size?: boolean;
422
+ shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
423
+ }
424
+ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
425
+ data: boolean;
426
+ size: boolean;
427
+ shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
428
+ }
429
+ interface StickyHeaderConfig {
430
+ /**
431
+ * Specifies how far from the top edge sticky headers should start sticking.
432
+ * Useful for scenarios with a fixed navbar or header, where sticky elements pin below it..
433
+ * @default 0
434
+ */
435
+ offset?: number;
436
+ /**
437
+ * Component to render as a backdrop behind the sticky header.
438
+ * @default undefined
439
+ */
440
+ backdropComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
441
+ }
442
+ interface AlwaysRenderConfig {
443
+ top?: number;
444
+ bottom?: number;
445
+ indices?: number[];
446
+ keys?: string[];
447
+ }
448
+ interface MaintainScrollAtEndOnOptions {
449
+ dataChange?: boolean;
450
+ itemLayout?: boolean;
451
+ layout?: boolean;
452
+ }
453
+ interface MaintainScrollAtEndOptions {
454
+ /**
455
+ * Whether maintainScrollAtEnd should animate when it scrolls to the end.
456
+ */
457
+ animated?: boolean;
458
+ /**
459
+ * Which events should keep the list pinned to the end.
460
+ * - If omitted, object values default to all triggers.
461
+ * - If provided, only the keys set to `true` are enabled.
462
+ */
463
+ on?: MaintainScrollAtEndOnOptions;
464
+ }
465
+ interface ColumnWrapperStyle {
466
+ rowGap?: number;
467
+ gap?: number;
468
+ columnGap?: number;
469
+ }
470
+ interface LegendListMetrics {
471
+ headerSize: number;
472
+ footerSize: number;
473
+ }
474
+ interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
475
+ data: readonly ItemT[];
476
+ extraData: any;
477
+ index: number;
478
+ item: ItemT;
479
+ type: TItemType;
480
+ }
481
+ type LegendListState = {
482
+ activeStickyIndex: number;
483
+ contentLength: number;
484
+ data: readonly any[];
485
+ elementAtIndex: (index: number) => any;
486
+ end: number;
487
+ endBuffered: number;
488
+ isAtEnd: boolean;
489
+ isAtStart: boolean;
490
+ isEndReached: boolean;
491
+ isStartReached: boolean;
492
+ listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
493
+ listenToPosition: (key: string, callback: (value: number) => void) => () => void;
494
+ positionAtIndex: (index: number) => number;
495
+ positionByKey: (key: string) => number | undefined;
496
+ scroll: number;
497
+ scrollLength: number;
498
+ scrollVelocity: number;
499
+ sizeAtIndex: (index: number) => number;
500
+ sizes: Map<string, number>;
501
+ start: number;
502
+ startBuffered: number;
503
+ };
504
+ type LegendListRef$1 = {
505
+ /**
506
+ * Displays the scroll indicators momentarily.
507
+ */
508
+ flashScrollIndicators(): void;
509
+ /**
510
+ * Returns the native ScrollView component reference.
511
+ */
512
+ getNativeScrollRef(): any;
513
+ /**
514
+ * Returns the scroll responder instance for handling scroll events.
515
+ */
516
+ getScrollableNode(): any;
517
+ /**
518
+ * Returns the ScrollResponderMixin for advanced scroll handling.
519
+ */
520
+ getScrollResponder(): any;
521
+ /**
522
+ * Returns the internal state of the scroll virtualization.
523
+ */
524
+ getState(): LegendListState;
525
+ /**
526
+ * Scrolls a specific index into view.
527
+ * @param params - Parameters for scrolling.
528
+ * @param params.animated - If true, animates the scroll. Default: true.
529
+ * @param params.index - The index to scroll to.
530
+ */
531
+ scrollIndexIntoView(params: {
532
+ animated?: boolean | undefined;
533
+ index: number;
534
+ }): Promise<void>;
535
+ /**
536
+ * Scrolls a specific index into view.
537
+ * @param params - Parameters for scrolling.
538
+ * @param params.animated - If true, animates the scroll. Default: true.
539
+ * @param params.item - The item to scroll to.
540
+ */
541
+ scrollItemIntoView(params: {
542
+ animated?: boolean | undefined;
543
+ item: any;
544
+ }): Promise<void>;
545
+ /**
546
+ * Scrolls to the end of the list.
547
+ * @param options - Options for scrolling.
548
+ * @param options.animated - If true, animates the scroll. Default: true.
549
+ * @param options.viewOffset - Offset from the target position.
550
+ */
551
+ scrollToEnd(options?: {
552
+ animated?: boolean | undefined;
553
+ viewOffset?: number | undefined;
554
+ }): Promise<void>;
555
+ /**
556
+ * Scrolls to a specific index in the list.
557
+ * @param params - Parameters for scrolling.
558
+ * @param params.animated - If true, animates the scroll. Default: true.
559
+ * @param params.index - The index to scroll to.
560
+ * @param params.viewOffset - Offset from the target position.
561
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
562
+ */
563
+ scrollToIndex(params: {
564
+ animated?: boolean | undefined;
565
+ index: number;
566
+ viewOffset?: number | undefined;
567
+ viewPosition?: number | undefined;
568
+ }): Promise<void>;
569
+ /**
570
+ * Scrolls to a specific item in the list.
571
+ * @param params - Parameters for scrolling.
572
+ * @param params.animated - If true, animates the scroll. Default: true.
573
+ * @param params.item - The item to scroll to.
574
+ * @param params.viewOffset - Offset from the target position.
575
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
576
+ */
577
+ scrollToItem(params: {
578
+ animated?: boolean | undefined;
579
+ item: any;
580
+ viewOffset?: number | undefined;
581
+ viewPosition?: number | undefined;
582
+ }): Promise<void>;
583
+ /**
584
+ * Scrolls to a specific offset in pixels.
585
+ * @param params - Parameters for scrolling.
586
+ * @param params.offset - The pixel offset to scroll to.
587
+ * @param params.animated - If true, animates the scroll. Default: true.
588
+ */
589
+ scrollToOffset(params: {
590
+ offset: number;
591
+ animated?: boolean | undefined;
592
+ }): Promise<void>;
593
+ /**
594
+ * Sets or adds to the offset of the visible content anchor.
595
+ * @param value - The offset to set or add.
596
+ * @param animated - If true, uses Animated to animate the change.
597
+ */
598
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
599
+ /**
600
+ * Sets whether scroll processing is enabled.
601
+ * @param enabled - If true, scroll processing is enabled.
602
+ */
603
+ setScrollProcessingEnabled(enabled: boolean): void;
604
+ /**
605
+ * Clears internal virtualization caches.
606
+ * @param options - Cache clearing options.
607
+ * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
608
+ */
609
+ clearCaches(options?: {
610
+ mode?: "sizes" | "full";
611
+ }): void;
612
+ /**
613
+ * Reports an externally measured content inset. Pass null/undefined to clear.
614
+ * Values are merged on top of props/animated/native insets.
615
+ */
616
+ reportContentInset(inset?: Partial<Insets> | null): void;
617
+ };
618
+ interface ViewToken<ItemT = any> {
619
+ containerId: number;
620
+ index: number;
621
+ isViewable: boolean;
622
+ item: ItemT;
623
+ key: string;
624
+ }
625
+ interface ViewabilityConfigCallbackPair<ItemT = any> {
626
+ onViewableItemsChanged?: OnViewableItemsChanged<ItemT>;
627
+ viewabilityConfig: ViewabilityConfig;
628
+ }
629
+ type ViewabilityConfigCallbackPairs<ItemT> = ViewabilityConfigCallbackPair<ItemT>[];
630
+ type OnViewableItemsChanged<ItemT> = ((info: {
631
+ viewableItems: Array<ViewToken<ItemT>>;
632
+ changed: Array<ViewToken<ItemT>>;
633
+ }) => void) | null;
634
+ interface ViewabilityConfig {
635
+ /**
636
+ * A unique ID to identify this viewability config
637
+ */
638
+ id?: string;
639
+ /**
640
+ * Minimum amount of time (in milliseconds) that an item must be physically viewable before the
641
+ * viewability callback will be fired. A high number means that scrolling through content without
642
+ * stopping will not mark the content as viewable.
643
+ */
644
+ minimumViewTime?: number | undefined;
645
+ /**
646
+ * Percent of viewport that must be covered for a partially occluded item to count as
647
+ * "viewable", 0-100. Fully visible items are always considered viewable. A value of 0 means
648
+ * that a single pixel in the viewport makes the item viewable, and a value of 100 means that
649
+ * an item must be either entirely visible or cover the entire viewport to count as viewable.
650
+ */
651
+ viewAreaCoveragePercentThreshold?: number | undefined;
652
+ /**
653
+ * Similar to `viewAreaCoveragePercentThreshold`, but considers the percent of the item that is visible,
654
+ * rather than the fraction of the viewable area it covers.
655
+ */
656
+ itemVisiblePercentThreshold?: number | undefined;
657
+ /**
658
+ * Nothing is considered viewable until the user scrolls or `recordInteraction` is called after
659
+ * render.
660
+ */
661
+ waitForInteraction?: boolean | undefined;
662
+ }
663
+
664
+ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
665
+ onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
666
+ refScrollView?: React.Ref<ScrollView>;
667
+ renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
668
+ ListHeaderComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
669
+ ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
670
+ };
671
+ type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
672
+ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
673
+ getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
674
+ getScrollResponder(): ScrollResponderMixin;
675
+ reportContentInset(inset?: Partial<Insets$1> | null): void;
676
+ };
677
+
63
678
  type SectionListViewToken<ItemT, SectionT> = {
64
679
  item: ItemT;
65
680
  key: string;
@@ -102,11 +717,11 @@ declare const SectionList: (<ItemT, SectionT extends SectionBase<ItemT, react_na
102
717
  section: SectionListData<ItemT, SectionT>;
103
718
  }) => React.ReactElement | null) | undefined;
104
719
  ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
105
- SectionSeparatorComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
720
+ SectionSeparatorComponent?: React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
106
721
  keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
107
722
  stickySectionHeadersEnabled?: boolean;
108
723
  onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT> | undefined;
109
- } & React.RefAttributes<SectionListRef>) => React.ReactNode) & {
724
+ } & React.RefAttributes<SectionListRef>) => React.ReactElement | null) & {
110
725
  displayName?: string;
111
726
  };
112
727