@legendapp/list 3.5.0 → 3.7.0
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.
- package/CHANGELOG.md +52 -0
- package/README.md +4 -3
- package/animated.d.ts +95 -9
- package/keyboard-legacy.d.ts +62 -4
- package/keyboard.d.ts +63 -7
- package/keyboard.js +193 -13
- package/keyboard.mjs +196 -16
- package/package.json +1 -1
- package/react-native.d.ts +101 -9
- package/react-native.js +2384 -1816
- package/react-native.mjs +2385 -1817
- package/react-native.web.d.ts +100 -9
- package/react-native.web.js +2113 -1370
- package/react-native.web.mjs +2113 -1370
- package/react.d.ts +100 -9
- package/react.js +2113 -1370
- package/react.mjs +2113 -1370
- package/reanimated.d.ts +95 -9
- package/reanimated.js +17 -29
- package/reanimated.mjs +17 -29
- package/section-list.d.ts +107 -10
- package/section-list.js +10 -2
- package/section-list.mjs +10 -2
- package/.DS_Store +0 -0
package/react.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
|
|
|
35
35
|
shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "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" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerLayoutReady${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
39
|
-
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
38
|
+
type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "isScrollActive" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isFollowingEnd" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerLayoutReady${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
39
|
+
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isFollowingEnd" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
40
40
|
type ListenerTypeValueMap = {
|
|
41
41
|
activeStickyIndex: number;
|
|
42
42
|
alignItemsAtEndPadding: number;
|
|
@@ -48,6 +48,7 @@ type ListenerTypeValueMap = {
|
|
|
48
48
|
extraData: any;
|
|
49
49
|
footerSize: number;
|
|
50
50
|
headerSize: number;
|
|
51
|
+
isFollowingEnd: boolean;
|
|
51
52
|
isAtEnd: boolean;
|
|
52
53
|
isAtStart: boolean;
|
|
53
54
|
isNearEnd: boolean;
|
|
@@ -61,6 +62,7 @@ type ListenerTypeValueMap = {
|
|
|
61
62
|
numContainersPooled: number;
|
|
62
63
|
otherAxisSize: number;
|
|
63
64
|
readyToRender: boolean;
|
|
65
|
+
isScrollActive: boolean;
|
|
64
66
|
scrollAdjust: number;
|
|
65
67
|
scrollAdjustPending: number;
|
|
66
68
|
scrollAdjustUserOffset: number;
|
|
@@ -226,6 +228,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
226
228
|
extraData?: any;
|
|
227
229
|
/**
|
|
228
230
|
* In case items always have a fixed size, you can provide a function to return it.
|
|
231
|
+
* Change extraData when the fixed sizes returned by this callback change.
|
|
229
232
|
*/
|
|
230
233
|
getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
|
|
231
234
|
/**
|
|
@@ -252,6 +255,8 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
252
255
|
index: number;
|
|
253
256
|
viewOffset?: number | undefined;
|
|
254
257
|
viewPosition?: number | undefined;
|
|
258
|
+
/** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
|
|
259
|
+
viewPositionFallback?: "start" | "end";
|
|
255
260
|
};
|
|
256
261
|
/**
|
|
257
262
|
* Initial scroll position in pixels.
|
|
@@ -296,6 +301,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
296
301
|
/**
|
|
297
302
|
* If true, auto-scrolls to end when new items are added.
|
|
298
303
|
* Use an options object to opt into specific triggers and control whether that scroll is animated.
|
|
304
|
+
* Setting false pauses maintenance while retaining end-follow intent. Re-enabling resumes
|
|
305
|
+
* that intent even if content grew beyond the threshold; user or list navigation releases it.
|
|
306
|
+
* While paused, isFollowingEnd reports the retained intent.
|
|
307
|
+
* With a native screen reader enabled, unowned accessibility scrolls toward the start
|
|
308
|
+
* release following. Assistive-tech scrolls during library animations are not detected.
|
|
299
309
|
* @default false
|
|
300
310
|
*/
|
|
301
311
|
maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
|
|
@@ -306,11 +316,13 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
306
316
|
maintainScrollAtEndThreshold?: number;
|
|
307
317
|
/**
|
|
308
318
|
* Maintains visibility of content.
|
|
309
|
-
* -
|
|
310
|
-
* - data (default: false) stabilizes when the data array changes
|
|
319
|
+
* - size (default: true) stabilizes during size/layout changes while scrolling.
|
|
320
|
+
* - data (default: false) stabilizes when the data array changes.
|
|
311
321
|
* - shouldRestorePosition can opt out specific items from data-change anchoring.
|
|
312
322
|
* - undefined (default) enables scroll stabilization but skips data-change anchoring.
|
|
313
|
-
* - true enables both behaviors; false disables both.
|
|
323
|
+
* - true enables both JS behaviors; false disables both.
|
|
324
|
+
* Native iOS maintainVisibleContentPosition is enabled when either size or data stabilization is enabled,
|
|
325
|
+
* and disabled when both are disabled.
|
|
314
326
|
*/
|
|
315
327
|
maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
|
|
316
328
|
/**
|
|
@@ -402,8 +414,25 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
402
414
|
*/
|
|
403
415
|
onRefresh?: () => void;
|
|
404
416
|
/**
|
|
405
|
-
* Called
|
|
406
|
-
|
|
417
|
+
* Called once per accepted user gesture, in either direction: native drag (including
|
|
418
|
+
* momentum), web wheel/touch movement, non-repeated scroll keydown, or scrollbar drag.
|
|
419
|
+
* Wheel input at a boundary is ignored unless navigation is active. Without wheel
|
|
420
|
+
* momentum metadata, gesture boundaries are inferred from timing, direction and force.
|
|
421
|
+
* iOS status-bar scrolling emits on native onScrollToTop unless accessibility motion
|
|
422
|
+
* already reported it during the animation.
|
|
423
|
+
* With a native screen reader enabled, otherwise unowned scroll motion with stable
|
|
424
|
+
* content/viewport size is inferred as accessibility input (including focus navigation),
|
|
425
|
+
* once per burst; motion toward the start releases end following. Library animations
|
|
426
|
+
* and controller/native-ref command windows mask assistive-tech scrolling.
|
|
427
|
+
* Native commands bypassing the list and its refs (e.g. Reanimated scrollTo worklets)
|
|
428
|
+
* cannot be distinguished from accessibility input while a screen reader is on; call
|
|
429
|
+
* cancelScroll() on the JS thread before that navigation to release end following.
|
|
430
|
+
* Layout/clamp/MVCP events and commands through the list or its refs do not emit it.
|
|
431
|
+
* @experimental Native pointer/wheel-only input without a screen reader is not detected.
|
|
432
|
+
* Web scrollbar detection requires pointer events in a measurable, non-overlay gutter.
|
|
433
|
+
*/
|
|
434
|
+
onUserScroll?: () => void;
|
|
435
|
+
/** Called when the list scrolls. */
|
|
407
436
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
408
437
|
/**
|
|
409
438
|
* Called when scrolling reaches the start within onStartReachedThreshold.
|
|
@@ -535,6 +564,8 @@ interface AlwaysRenderConfig {
|
|
|
535
564
|
keys?: string[];
|
|
536
565
|
}
|
|
537
566
|
interface MaintainScrollAtEndOnOptions {
|
|
567
|
+
/** Follow only additions that preserve every existing item key in order. */
|
|
568
|
+
dataAppend?: boolean;
|
|
538
569
|
dataChange?: boolean;
|
|
539
570
|
footerLayout?: boolean;
|
|
540
571
|
itemLayout?: boolean;
|
|
@@ -576,9 +607,13 @@ type LegendListState$1 = {
|
|
|
576
607
|
activeStickyIndex: number;
|
|
577
608
|
contentLength: number;
|
|
578
609
|
data: readonly any[];
|
|
610
|
+
dataKey?: Key;
|
|
579
611
|
elementAtIndex: (index: number) => any;
|
|
580
612
|
end: number;
|
|
581
613
|
endBuffered: number;
|
|
614
|
+
/** Distance to the physical scroll edge, including the trailing inset. */
|
|
615
|
+
distanceFromEnd: number;
|
|
616
|
+
isFollowingEnd: boolean;
|
|
582
617
|
isAtEnd: boolean;
|
|
583
618
|
isAtStart: boolean;
|
|
584
619
|
isNearEnd: boolean;
|
|
@@ -588,7 +623,10 @@ type LegendListState$1 = {
|
|
|
588
623
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
589
624
|
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
590
625
|
indexByKey: (key: string) => number | undefined;
|
|
591
|
-
listen:
|
|
626
|
+
listen: {
|
|
627
|
+
<T extends Exclude<LegendListListenerType, "isFollowingEnd">>(listenerType: T, callback: (value: Pick<ListenerTypeValueMap, LegendListListenerType>[T]) => void): () => void;
|
|
628
|
+
<T extends LegendListListenerType>(listenerType: T, callback: (value: Pick<ListenerTypeValueMap, LegendListListenerType>[T]) => void): () => void;
|
|
629
|
+
};
|
|
592
630
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
593
631
|
positionAtIndex: (index: number) => number;
|
|
594
632
|
positionByKey: (key: string) => number | undefined;
|
|
@@ -601,6 +639,28 @@ type LegendListState$1 = {
|
|
|
601
639
|
startBuffered: number;
|
|
602
640
|
};
|
|
603
641
|
type LegendListRef$1 = {
|
|
642
|
+
/** Cancels queued and active scrolling, settles its promise, and stops at the observed offset. */
|
|
643
|
+
cancelScroll(): void;
|
|
644
|
+
/** Scrolls by stable item identity through prepends; resolves without scrolling if the key is missing or removed. */
|
|
645
|
+
scrollToKey(params: {
|
|
646
|
+
key: string;
|
|
647
|
+
animated?: boolean;
|
|
648
|
+
viewOffset?: number;
|
|
649
|
+
viewPosition?: number;
|
|
650
|
+
}): Promise<void>;
|
|
651
|
+
/**
|
|
652
|
+
* Captures an item's key and viewport offset, holding it through layout changes by default.
|
|
653
|
+
* Omit key to use the first visible item; set hold to false to read without side effects.
|
|
654
|
+
* Returns undefined before initial placement, during dataset replacement, or if no item is found.
|
|
655
|
+
* While following at the end, returns the anchor without interrupting end following.
|
|
656
|
+
*/
|
|
657
|
+
anchorVisibleContent(options?: {
|
|
658
|
+
key?: string;
|
|
659
|
+
hold?: boolean;
|
|
660
|
+
}): {
|
|
661
|
+
key: string;
|
|
662
|
+
offset: number;
|
|
663
|
+
} | undefined;
|
|
604
664
|
/**
|
|
605
665
|
* Clears internal virtualization caches.
|
|
606
666
|
* @param options - Cache clearing options.
|
|
@@ -643,20 +703,40 @@ type LegendListRef$1 = {
|
|
|
643
703
|
* @param params - Parameters for scrolling.
|
|
644
704
|
* @param params.animated - If true, animates the scroll. Default: true.
|
|
645
705
|
* @param params.index - The index to scroll to.
|
|
706
|
+
* @param params.itemOffset - Region start measured from the item's start along the scroll axis. Default: 0 when itemLength is provided.
|
|
707
|
+
* @param params.itemLength - Region length along the scroll axis. Default: 0 when itemOffset is provided. Omit both to reveal the whole item.
|
|
708
|
+
* @param params.viewportMargin - Space to keep clear at the start and end of the viewport along the scroll axis.
|
|
709
|
+
* The region should be within the item. A visible region does not scroll; otherwise its nearest edge aligns inside the margins. A region larger than the available space aligns its start.
|
|
646
710
|
*/
|
|
647
711
|
scrollIndexIntoView(params: {
|
|
648
712
|
animated?: boolean | undefined;
|
|
649
713
|
index: number;
|
|
714
|
+
itemOffset?: number;
|
|
715
|
+
itemLength?: number;
|
|
716
|
+
viewportMargin?: {
|
|
717
|
+
start?: number;
|
|
718
|
+
end?: number;
|
|
719
|
+
};
|
|
650
720
|
}): Promise<void>;
|
|
651
721
|
/**
|
|
652
|
-
* Scrolls a specific
|
|
722
|
+
* Scrolls a specific item into view.
|
|
653
723
|
* @param params - Parameters for scrolling.
|
|
654
724
|
* @param params.animated - If true, animates the scroll. Default: true.
|
|
655
725
|
* @param params.item - The item to scroll to.
|
|
726
|
+
* @param params.itemOffset - Region start measured from the item's start along the scroll axis. Default: 0 when itemLength is provided.
|
|
727
|
+
* @param params.itemLength - Region length along the scroll axis. Default: 0 when itemOffset is provided. Omit both to reveal the whole item.
|
|
728
|
+
* @param params.viewportMargin - Space to keep clear at the start and end of the viewport along the scroll axis.
|
|
729
|
+
* The region should be within the item. A visible region does not scroll; otherwise its nearest edge aligns inside the margins. A region larger than the available space aligns its start.
|
|
656
730
|
*/
|
|
657
731
|
scrollItemIntoView(params: {
|
|
658
732
|
animated?: boolean | undefined;
|
|
659
733
|
item: any;
|
|
734
|
+
itemOffset?: number;
|
|
735
|
+
itemLength?: number;
|
|
736
|
+
viewportMargin?: {
|
|
737
|
+
start?: number;
|
|
738
|
+
end?: number;
|
|
739
|
+
};
|
|
660
740
|
}): Promise<void>;
|
|
661
741
|
/**
|
|
662
742
|
* Scrolls to the end of the list.
|
|
@@ -678,6 +758,8 @@ type LegendListRef$1 = {
|
|
|
678
758
|
index: number;
|
|
679
759
|
viewOffset?: number | undefined;
|
|
680
760
|
viewPosition?: number | undefined;
|
|
761
|
+
/** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
|
|
762
|
+
viewPositionFallback?: "start" | "end";
|
|
681
763
|
}): Promise<void>;
|
|
682
764
|
/**
|
|
683
765
|
* Scrolls to a specific item in the list.
|
|
@@ -692,6 +774,8 @@ type LegendListRef$1 = {
|
|
|
692
774
|
item: any;
|
|
693
775
|
viewOffset?: number | undefined;
|
|
694
776
|
viewPosition?: number | undefined;
|
|
777
|
+
/** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
|
|
778
|
+
viewPositionFallback?: "start" | "end";
|
|
695
779
|
}): Promise<void>;
|
|
696
780
|
/**
|
|
697
781
|
* Scrolls to a specific offset in pixels.
|
|
@@ -731,6 +815,10 @@ interface ViewToken<ItemT = any> {
|
|
|
731
815
|
interface ViewAmountToken<ItemT = any> extends ViewToken<ItemT> {
|
|
732
816
|
percentOfScroller: number;
|
|
733
817
|
percentVisible: number;
|
|
818
|
+
/**
|
|
819
|
+
* Viewport size used for this measurement, with any integration-reported
|
|
820
|
+
* occlusion (for example a keyboard) already subtracted.
|
|
821
|
+
*/
|
|
734
822
|
scrollSize: number;
|
|
735
823
|
size: number;
|
|
736
824
|
sizeVisible: number;
|
|
@@ -790,6 +878,8 @@ interface ScrollIndexWithOffset {
|
|
|
790
878
|
index: number;
|
|
791
879
|
viewOffset?: number;
|
|
792
880
|
viewPosition?: number;
|
|
881
|
+
/** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
|
|
882
|
+
viewPositionFallback?: "start" | "end";
|
|
793
883
|
}
|
|
794
884
|
interface ScrollIndexWithOffsetPosition extends ScrollIndexWithOffset {
|
|
795
885
|
viewPosition?: number;
|
|
@@ -821,6 +911,7 @@ interface LooseScrollViewProps {
|
|
|
821
911
|
onMomentumScrollEnd?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
822
912
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
823
913
|
onScrollBeginDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
914
|
+
onScrollToTop?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
824
915
|
onScrollEndDrag?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
825
916
|
refreshControl?: ReactElement | null;
|
|
826
917
|
removeClippedSubviews?: boolean;
|