@legendapp/list 3.0.0-beta.32 → 3.0.0-beta.33

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 (54) hide show
  1. package/README.md +7 -1
  2. package/animated.d.ts +600 -6
  3. package/animated.js +2 -2
  4. package/animated.mjs +1 -1
  5. package/index.d.ts +454 -108
  6. package/index.js +81 -32
  7. package/index.mjs +81 -32
  8. package/index.native.js +89 -44
  9. package/index.native.mjs +88 -43
  10. package/keyboard-controller.d.ts +611 -6
  11. package/keyboard-controller.js +2 -2
  12. package/keyboard-controller.mjs +1 -1
  13. package/keyboard.d.ts +204 -8
  14. package/keyboard.js +66 -52
  15. package/keyboard.mjs +69 -54
  16. package/{index.d.mts → list-react-native.d.ts} +95 -32
  17. package/list-react-native.js +4234 -0
  18. package/list-react-native.mjs +4204 -0
  19. package/{index.native.d.mts → list-react.d.ts} +355 -40
  20. package/list-react.js +4426 -0
  21. package/list-react.mjs +4396 -0
  22. package/package.json +52 -1
  23. package/reanimated.d.ts +595 -7
  24. package/reanimated.js +156 -11
  25. package/reanimated.mjs +153 -8
  26. package/section-list.d.ts +610 -14
  27. package/section-list.js +6 -6
  28. package/section-list.mjs +1 -1
  29. package/animated.d.mts +0 -9
  30. package/animated.native.d.mts +0 -9
  31. package/animated.native.d.ts +0 -9
  32. package/animated.native.js +0 -9
  33. package/animated.native.mjs +0 -7
  34. package/index.native.d.ts +0 -817
  35. package/keyboard-controller.d.mts +0 -12
  36. package/keyboard-controller.native.d.mts +0 -12
  37. package/keyboard-controller.native.d.ts +0 -12
  38. package/keyboard-controller.native.js +0 -69
  39. package/keyboard-controller.native.mjs +0 -48
  40. package/keyboard.d.mts +0 -13
  41. package/keyboard.native.d.mts +0 -13
  42. package/keyboard.native.d.ts +0 -13
  43. package/keyboard.native.js +0 -399
  44. package/keyboard.native.mjs +0 -377
  45. package/reanimated.d.mts +0 -18
  46. package/reanimated.native.d.mts +0 -18
  47. package/reanimated.native.d.ts +0 -18
  48. package/reanimated.native.js +0 -89
  49. package/reanimated.native.mjs +0 -65
  50. package/section-list.d.mts +0 -112
  51. package/section-list.native.d.mts +0 -112
  52. package/section-list.native.d.ts +0 -112
  53. package/section-list.native.js +0 -293
  54. package/section-list.native.mjs +0 -271
package/section-list.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_native from 'react-native';
2
- import { SectionListData, SectionBase, SectionListRenderItemInfo, SectionListScrollParams } from 'react-native';
3
- import * as React from 'react';
4
- import { LegendListProps, LegendListRef } from '@legendapp/list';
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
+ import * as React$1 from 'react';
4
+ import { Key, ReactNode, ReactElement } from 'react';
5
5
 
6
6
  type SectionListSeparatorProps<ItemT, SectionT> = {
7
7
  leadingItem?: ItemT;
@@ -59,6 +59,602 @@ type BuildSectionListDataResult<ItemT, SectionT> = {
59
59
  stickyHeaderIndices: number[];
60
60
  };
61
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>) => 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: 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
+ * @default false
271
+ */
272
+ maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
273
+ /**
274
+ * Distance threshold in percentage of screen size to trigger maintainScrollAtEnd.
275
+ * @default 0.1
276
+ */
277
+ maintainScrollAtEndThreshold?: number;
278
+ /**
279
+ * Maintains visibility of content.
280
+ * - scroll (default: true) stabilizes during size/layout changes while scrolling.
281
+ * - data (default: false) stabilizes when the data array changes; passing true also sets the RN maintainVisibleContentPosition prop.
282
+ * - shouldRestorePosition can opt out specific items from data-change anchoring.
283
+ * - undefined (default) enables scroll stabilization but skips data-change anchoring.
284
+ * - true enables both behaviors; false disables both.
285
+ */
286
+ maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
287
+ /**
288
+ * Number of columns to render items in.
289
+ * @default 1
290
+ */
291
+ numColumns?: number;
292
+ /**
293
+ * Called when scrolling reaches the end within onEndReachedThreshold.
294
+ */
295
+ onEndReached?: ((info: {
296
+ distanceFromEnd: number;
297
+ }) => void) | null | undefined;
298
+ /**
299
+ * How close to the end (in fractional units of visible length) to trigger onEndReached.
300
+ * @default 0.5
301
+ */
302
+ onEndReachedThreshold?: number | null | undefined;
303
+ /**
304
+ * Called when an item's size changes.
305
+ */
306
+ onItemSizeChanged?: (info: {
307
+ size: number;
308
+ previous: number;
309
+ index: number;
310
+ itemKey: string;
311
+ itemData: ItemT;
312
+ }) => void;
313
+ /**
314
+ * Called when list layout metrics change.
315
+ */
316
+ onMetricsChange?: (metrics: LegendListMetrics) => void;
317
+ /**
318
+ * Function to call when the user pulls to refresh.
319
+ */
320
+ onRefresh?: () => void;
321
+ onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
322
+ /**
323
+ * Called when scrolling reaches the start within onStartReachedThreshold.
324
+ */
325
+ onStartReached?: ((info: {
326
+ distanceFromStart: number;
327
+ }) => void) | null | undefined;
328
+ /**
329
+ * How close to the start (in fractional units of visible length) to trigger onStartReached.
330
+ * @default 0.5
331
+ */
332
+ onStartReachedThreshold?: number | null | undefined;
333
+ /**
334
+ * Called when the sticky header changes.
335
+ */
336
+ onStickyHeaderChange?: (info: {
337
+ index: number;
338
+ item: any;
339
+ }) => void;
340
+ /**
341
+ * Called when the viewability of items changes.
342
+ */
343
+ onViewableItemsChanged?: OnViewableItemsChanged<ItemT> | undefined;
344
+ /**
345
+ * Offset in pixels for the refresh indicator.
346
+ * @default 0
347
+ */
348
+ progressViewOffset?: number;
349
+ /**
350
+ * If true, recycles item views for better performance.
351
+ * @default false
352
+ */
353
+ recycleItems?: boolean;
354
+ /**
355
+ * Ref to the underlying ScrollView component.
356
+ */
357
+ refScrollView?: React.Ref<any>;
358
+ /**
359
+ * If true, shows a refresh indicator.
360
+ * @default false
361
+ */
362
+ refreshing?: boolean;
363
+ /**
364
+ * Render custom ScrollView component.
365
+ * Note: When using `stickyHeaderIndices`, you must provide an Animated ScrollView component.
366
+ * @default (props) => <ScrollView {...props} />
367
+ */
368
+ renderScrollComponent?: (props: any) => React.ReactElement | null;
369
+ /**
370
+ * This will log a suggested estimatedItemSize.
371
+ * @required
372
+ * @default false
373
+ */
374
+ suggestEstimatedItemSize?: boolean;
375
+ /**
376
+ * Configuration for determining item viewability.
377
+ */
378
+ viewabilityConfig?: ViewabilityConfig;
379
+ /**
380
+ * Pairs of viewability configs and their callbacks for tracking visibility.
381
+ */
382
+ viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs<ItemT> | undefined;
383
+ /**
384
+ * If true, delays rendering until initial layout is complete.
385
+ * @default false
386
+ */
387
+ waitForInitialLayout?: boolean;
388
+ onLoad?: (info: {
389
+ elapsedTimeInMs: number;
390
+ }) => void;
391
+ snapToIndices?: number[];
392
+ /**
393
+ * Array of child indices determining which children get docked to the top of the screen when scrolling.
394
+ * For example, passing stickyHeaderIndices={[0]} will cause the first child to be fixed to the top of the scroll view.
395
+ * Not supported in conjunction with horizontal={true}.
396
+ * @default undefined
397
+ */
398
+ stickyHeaderIndices?: number[];
399
+ /**
400
+ * @deprecated Use stickyHeaderIndices instead for parity with React Native.
401
+ */
402
+ stickyIndices?: number[];
403
+ /**
404
+ * Configuration for sticky headers.
405
+ * @default undefined
406
+ */
407
+ stickyHeaderConfig?: StickyHeaderConfig;
408
+ getItemType?: (item: ItemT, index: number) => TItemType;
409
+ getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
410
+ itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
411
+ }
412
+ type LegendListPropsBase<ItemT, TScrollViewProps = Record<string, any>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollViewProps> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
413
+ interface MaintainVisibleContentPositionConfig<ItemT = any> {
414
+ data?: boolean;
415
+ size?: boolean;
416
+ shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
417
+ }
418
+ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
419
+ data: boolean;
420
+ size: boolean;
421
+ shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
422
+ }
423
+ interface StickyHeaderConfig {
424
+ /**
425
+ * Specifies how far from the top edge sticky headers should start sticking.
426
+ * Useful for scenarios with a fixed navbar or header, where sticky elements pin below it..
427
+ * @default 0
428
+ */
429
+ offset?: number;
430
+ /**
431
+ * Component to render as a backdrop behind the sticky header.
432
+ * @default undefined
433
+ */
434
+ backdropComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
435
+ }
436
+ interface AlwaysRenderConfig {
437
+ top?: number;
438
+ bottom?: number;
439
+ indices?: number[];
440
+ keys?: string[];
441
+ }
442
+ interface MaintainScrollAtEndOptions {
443
+ onLayout?: boolean;
444
+ onItemLayout?: boolean;
445
+ onDataChange?: boolean;
446
+ }
447
+ interface ColumnWrapperStyle {
448
+ rowGap?: number;
449
+ gap?: number;
450
+ columnGap?: number;
451
+ }
452
+ interface LegendListMetrics {
453
+ headerSize: number;
454
+ footerSize: number;
455
+ }
456
+ interface LegendListRenderItemProps<ItemT, TItemType extends string | number | undefined = string | number | undefined> {
457
+ data: readonly ItemT[];
458
+ extraData: any;
459
+ index: number;
460
+ item: ItemT;
461
+ type: TItemType;
462
+ }
463
+ type LegendListState = {
464
+ activeStickyIndex: number;
465
+ contentLength: number;
466
+ data: readonly any[];
467
+ elementAtIndex: (index: number) => any;
468
+ end: number;
469
+ endBuffered: number;
470
+ isAtEnd: boolean;
471
+ isAtStart: boolean;
472
+ listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
473
+ listenToPosition: (key: string, callback: (value: number) => void) => () => void;
474
+ positionAtIndex: (index: number) => number;
475
+ positions: Map<string, number>;
476
+ scroll: number;
477
+ scrollLength: number;
478
+ scrollVelocity: number;
479
+ sizeAtIndex: (index: number) => number;
480
+ sizes: Map<string, number>;
481
+ start: number;
482
+ startBuffered: number;
483
+ };
484
+ type LegendListRef$1 = {
485
+ /**
486
+ * Displays the scroll indicators momentarily.
487
+ */
488
+ flashScrollIndicators(): void;
489
+ /**
490
+ * Returns the native ScrollView component reference.
491
+ */
492
+ getNativeScrollRef(): any;
493
+ /**
494
+ * Returns the scroll responder instance for handling scroll events.
495
+ */
496
+ getScrollableNode(): any;
497
+ /**
498
+ * Returns the ScrollResponderMixin for advanced scroll handling.
499
+ */
500
+ getScrollResponder(): any;
501
+ /**
502
+ * Returns the internal state of the scroll virtualization.
503
+ */
504
+ getState(): LegendListState;
505
+ /**
506
+ * Scrolls a specific index into view.
507
+ * @param params - Parameters for scrolling.
508
+ * @param params.animated - If true, animates the scroll. Default: true.
509
+ * @param params.index - The index to scroll to.
510
+ */
511
+ scrollIndexIntoView(params: {
512
+ animated?: boolean | undefined;
513
+ index: number;
514
+ }): void;
515
+ /**
516
+ * Scrolls a specific index into view.
517
+ * @param params - Parameters for scrolling.
518
+ * @param params.animated - If true, animates the scroll. Default: true.
519
+ * @param params.item - The item to scroll to.
520
+ */
521
+ scrollItemIntoView(params: {
522
+ animated?: boolean | undefined;
523
+ item: any;
524
+ }): void;
525
+ /**
526
+ * Scrolls to the end of the list.
527
+ * @param options - Options for scrolling.
528
+ * @param options.animated - If true, animates the scroll. Default: true.
529
+ * @param options.viewOffset - Offset from the target position.
530
+ */
531
+ scrollToEnd(options?: {
532
+ animated?: boolean | undefined;
533
+ viewOffset?: number | undefined;
534
+ }): void;
535
+ /**
536
+ * Scrolls to a specific index in the list.
537
+ * @param params - Parameters for scrolling.
538
+ * @param params.animated - If true, animates the scroll. Default: true.
539
+ * @param params.index - The index to scroll to.
540
+ * @param params.viewOffset - Offset from the target position.
541
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
542
+ */
543
+ scrollToIndex(params: {
544
+ animated?: boolean | undefined;
545
+ index: number;
546
+ viewOffset?: number | undefined;
547
+ viewPosition?: number | undefined;
548
+ }): void;
549
+ /**
550
+ * Scrolls to a specific item in the list.
551
+ * @param params - Parameters for scrolling.
552
+ * @param params.animated - If true, animates the scroll. Default: true.
553
+ * @param params.item - The item to scroll to.
554
+ * @param params.viewOffset - Offset from the target position.
555
+ * @param params.viewPosition - Position of the item in the viewport (0 to 1).
556
+ */
557
+ scrollToItem(params: {
558
+ animated?: boolean | undefined;
559
+ item: any;
560
+ viewOffset?: number | undefined;
561
+ viewPosition?: number | undefined;
562
+ }): void;
563
+ /**
564
+ * Scrolls to a specific offset in pixels.
565
+ * @param params - Parameters for scrolling.
566
+ * @param params.offset - The pixel offset to scroll to.
567
+ * @param params.animated - If true, animates the scroll. Default: true.
568
+ */
569
+ scrollToOffset(params: {
570
+ offset: number;
571
+ animated?: boolean | undefined;
572
+ }): void;
573
+ /**
574
+ * Sets or adds to the offset of the visible content anchor.
575
+ * @param value - The offset to set or add.
576
+ * @param animated - If true, uses Animated to animate the change.
577
+ */
578
+ setVisibleContentAnchorOffset(value: number | ((val: number) => number)): void;
579
+ /**
580
+ * Sets whether scroll processing is enabled.
581
+ * @param enabled - If true, scroll processing is enabled.
582
+ */
583
+ setScrollProcessingEnabled(enabled: boolean): void;
584
+ /**
585
+ * Clears internal virtualization caches.
586
+ * @param options - Cache clearing options.
587
+ * @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
588
+ */
589
+ clearCaches(options?: {
590
+ mode?: "sizes" | "full";
591
+ }): void;
592
+ /**
593
+ * Reports an externally measured content inset. Pass null/undefined to clear.
594
+ * Values are merged on top of props/animated/native insets.
595
+ */
596
+ reportContentInset(inset?: Partial<Insets> | null): void;
597
+ };
598
+ interface ViewToken<ItemT = any> {
599
+ containerId: number;
600
+ index: number;
601
+ isViewable: boolean;
602
+ item: ItemT;
603
+ key: string;
604
+ }
605
+ interface ViewabilityConfigCallbackPair<ItemT = any> {
606
+ onViewableItemsChanged?: OnViewableItemsChanged<ItemT>;
607
+ viewabilityConfig: ViewabilityConfig;
608
+ }
609
+ type ViewabilityConfigCallbackPairs<ItemT> = ViewabilityConfigCallbackPair<ItemT>[];
610
+ type OnViewableItemsChanged<ItemT> = ((info: {
611
+ viewableItems: Array<ViewToken<ItemT>>;
612
+ changed: Array<ViewToken<ItemT>>;
613
+ }) => void) | null;
614
+ interface ViewabilityConfig {
615
+ /**
616
+ * A unique ID to identify this viewability config
617
+ */
618
+ id?: string;
619
+ /**
620
+ * Minimum amount of time (in milliseconds) that an item must be physically viewable before the
621
+ * viewability callback will be fired. A high number means that scrolling through content without
622
+ * stopping will not mark the content as viewable.
623
+ */
624
+ minimumViewTime?: number | undefined;
625
+ /**
626
+ * Percent of viewport that must be covered for a partially occluded item to count as
627
+ * "viewable", 0-100. Fully visible items are always considered viewable. A value of 0 means
628
+ * that a single pixel in the viewport makes the item viewable, and a value of 100 means that
629
+ * an item must be either entirely visible or cover the entire viewport to count as viewable.
630
+ */
631
+ viewAreaCoveragePercentThreshold?: number | undefined;
632
+ /**
633
+ * Similar to `viewAreaCoveragePercentThreshold`, but considers the percent of the item that is visible,
634
+ * rather than the fraction of the viewable area it covers.
635
+ */
636
+ itemVisiblePercentThreshold?: number | undefined;
637
+ /**
638
+ * Nothing is considered viewable until the user scrolls or `recordInteraction` is called after
639
+ * render.
640
+ */
641
+ waitForInteraction?: boolean | undefined;
642
+ }
643
+
644
+ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
645
+ onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
646
+ refScrollView?: React.Ref<ScrollView>;
647
+ renderScrollComponent?: (props: ScrollViewProps) => ReactElement<ScrollViewProps>;
648
+ ListHeaderComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
649
+ ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
650
+ };
651
+ type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
652
+ type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
653
+ getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
654
+ getScrollResponder(): ScrollResponderMixin;
655
+ reportContentInset(inset?: Partial<Insets$1> | null): void;
656
+ };
657
+
62
658
  type SectionListViewToken<ItemT, SectionT> = {
63
659
  item: ItemT;
64
660
  key: string;
@@ -74,15 +670,15 @@ type SectionListLegendProps<ItemT, SectionT> = Omit<LegendListProps<FlatSectionL
74
670
  type SectionListProps<ItemT, SectionT extends SectionBase<ItemT> = SectionBase<ItemT>> = SectionListLegendProps<ItemT, SectionT> & {
75
671
  sections: ReadonlyArray<SectionListData<ItemT, SectionT>>;
76
672
  extraData?: any;
77
- renderItem?: (info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null;
673
+ renderItem?: (info: SectionListRenderItemInfo<ItemT, SectionT>) => React$1.ReactElement | null;
78
674
  renderSectionHeader?: (info: {
79
675
  section: SectionListData<ItemT, SectionT>;
80
- }) => React.ReactElement | null;
676
+ }) => React$1.ReactElement | null;
81
677
  renderSectionFooter?: (info: {
82
678
  section: SectionListData<ItemT, SectionT>;
83
- }) => React.ReactElement | null;
84
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null;
85
- SectionSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | React.ReactElement | null;
679
+ }) => React$1.ReactElement | null;
680
+ ItemSeparatorComponent?: React$1.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null;
681
+ SectionSeparatorComponent?: React$1.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | React$1.ReactElement | null;
86
682
  keyExtractor?: (item: ItemT, index: number) => string;
87
683
  stickySectionHeadersEnabled?: boolean;
88
684
  onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT>;
@@ -93,19 +689,19 @@ type SectionListRef = LegendListRef & {
93
689
  declare const SectionList: (<ItemT, SectionT extends SectionBase<ItemT, react_native.DefaultSectionT>>(props: SectionListLegendProps<ItemT, SectionT> & {
94
690
  sections: readonly SectionListData<ItemT, SectionT>[];
95
691
  extraData?: any;
96
- renderItem?: ((info: SectionListRenderItemInfo<ItemT, SectionT>) => React.ReactElement | null) | undefined;
692
+ renderItem?: ((info: SectionListRenderItemInfo<ItemT, SectionT>) => React$1.ReactElement | null) | undefined;
97
693
  renderSectionHeader?: ((info: {
98
694
  section: SectionListData<ItemT, SectionT>;
99
- }) => React.ReactElement | null) | undefined;
695
+ }) => React$1.ReactElement | null) | undefined;
100
696
  renderSectionFooter?: ((info: {
101
697
  section: SectionListData<ItemT, SectionT>;
102
- }) => React.ReactElement | null) | undefined;
103
- ItemSeparatorComponent?: React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
104
- SectionSeparatorComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
698
+ }) => React$1.ReactElement | null) | undefined;
699
+ ItemSeparatorComponent?: React$1.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
700
+ SectionSeparatorComponent?: React$1.ReactElement<any, string | React$1.JSXElementConstructor<any>> | React$1.ComponentType<SectionListSeparatorProps<ItemT, SectionT>> | null | undefined;
105
701
  keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
106
702
  stickySectionHeadersEnabled?: boolean;
107
703
  onViewableItemsChanged?: SectionListOnViewableItemsChanged<ItemT, SectionT> | undefined;
108
- } & React.RefAttributes<SectionListRef>) => React.ReactNode) & {
704
+ } & React$1.RefAttributes<SectionListRef>) => React$1.ReactNode) & {
109
705
  displayName?: string;
110
706
  };
111
707
 
package/section-list.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var reactNative = require('react-native');
5
- var list = require('@legendapp/list');
4
+ var reactNative$1 = require('react-native');
5
+ var reactNative = require('@legendapp/list/react-native');
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -139,8 +139,8 @@ function resolveSeparatorComponent(component, props) {
139
139
  const Component = component;
140
140
  return /* @__PURE__ */ React__namespace.createElement(Component, { ...props });
141
141
  }
142
- var SectionList = list.typedMemo(
143
- list.typedForwardRef(function SectionListInner(props, ref) {
142
+ var SectionList = reactNative.typedMemo(
143
+ reactNative.typedForwardRef(function SectionListInner(props, ref) {
144
144
  const {
145
145
  sections,
146
146
  renderItem: renderItemProp,
@@ -148,7 +148,7 @@ var SectionList = list.typedMemo(
148
148
  renderSectionFooter,
149
149
  ItemSeparatorComponent,
150
150
  SectionSeparatorComponent,
151
- stickySectionHeadersEnabled = reactNative.Platform.OS === "ios",
151
+ stickySectionHeadersEnabled = reactNative$1.Platform.OS === "ios",
152
152
  keyExtractor,
153
153
  extraData,
154
154
  onViewableItemsChanged,
@@ -273,7 +273,7 @@ var SectionList = list.typedMemo(
273
273
  [scrollToLocation]
274
274
  );
275
275
  return /* @__PURE__ */ React__namespace.createElement(
276
- list.LegendList,
276
+ reactNative.LegendList,
277
277
  {
278
278
  ...restProps,
279
279
  columnWrapperStyle: void 0,