@legendapp/list 3.0.0-beta.5 → 3.0.0-beta.51

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