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

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