@legendapp/list 3.0.0-beta.31 → 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.
- package/.DS_Store +0 -0
- package/README.md +7 -1
- package/animated.d.ts +600 -6
- package/animated.js +2 -2
- package/animated.mjs +1 -1
- package/index.d.ts +462 -109
- package/index.js +290 -147
- package/index.mjs +290 -147
- package/index.native.js +245 -122
- package/index.native.mjs +246 -123
- package/keyboard-controller.d.ts +611 -6
- package/keyboard-controller.js +2 -2
- package/keyboard-controller.mjs +1 -1
- package/keyboard.d.ts +204 -8
- package/keyboard.js +66 -52
- package/keyboard.mjs +69 -54
- package/{index.d.mts → list-react-native.d.ts} +103 -33
- package/list-react-native.js +4234 -0
- package/list-react-native.mjs +4204 -0
- package/{index.native.d.mts → list-react.d.ts} +363 -41
- package/list-react.js +4426 -0
- package/list-react.mjs +4396 -0
- package/package.json +52 -1
- package/reanimated.d.ts +595 -7
- package/reanimated.js +156 -11
- package/reanimated.mjs +153 -8
- package/section-list.d.ts +610 -14
- package/section-list.js +6 -6
- package/section-list.mjs +1 -1
- package/animated.d.mts +0 -9
- package/animated.native.d.mts +0 -9
- package/animated.native.d.ts +0 -9
- package/animated.native.js +0 -9
- package/animated.native.mjs +0 -7
- package/index.native.d.ts +0 -810
- package/keyboard-controller.d.mts +0 -12
- package/keyboard-controller.native.d.mts +0 -12
- package/keyboard-controller.native.d.ts +0 -12
- package/keyboard-controller.native.js +0 -69
- package/keyboard-controller.native.mjs +0 -48
- package/keyboard.d.mts +0 -13
- package/keyboard.native.d.mts +0 -13
- package/keyboard.native.d.ts +0 -13
- package/keyboard.native.js +0 -399
- package/keyboard.native.mjs +0 -377
- package/reanimated.d.mts +0 -18
- package/reanimated.native.d.mts +0 -18
- package/reanimated.native.d.ts +0 -18
- package/reanimated.native.js +0 -89
- package/reanimated.native.mjs +0 -65
- package/section-list.d.mts +0 -112
- package/section-list.native.d.mts +0 -112
- package/section-list.native.d.ts +0 -112
- package/section-list.native.js +0 -293
- package/section-list.native.mjs +0 -271
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import Reanimated from 'react-native-reanimated';
|
|
2
|
+
import { Key, ReactNode, ReactElement, Dispatch, SetStateAction } 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, View } from 'react-native';
|
|
5
4
|
|
|
6
5
|
type AnimatedValue = number;
|
|
7
6
|
|
|
7
|
+
type LooseMeasureCallback = (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void;
|
|
8
|
+
interface LooseView {
|
|
9
|
+
measure?: (callback: LooseMeasureCallback) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
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}`;
|
|
9
13
|
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
10
14
|
type ListenerTypeValueMap = {
|
|
@@ -65,7 +69,7 @@ interface StateContext {
|
|
|
65
69
|
positionListeners: Map<string, Set<(value: any) => void>>;
|
|
66
70
|
state: InternalState;
|
|
67
71
|
values: Map<ListenerType, any>;
|
|
68
|
-
viewRefs: Map<number, React$1.RefObject<
|
|
72
|
+
viewRefs: Map<number, React$1.RefObject<LooseView>>;
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
declare class ScrollAdjustHandler {
|
|
@@ -85,6 +89,39 @@ type StylesAsSharedValue<Style> = {
|
|
|
85
89
|
[key in keyof Style]: Style[key] | BaseSharedValue<Style[key]>;
|
|
86
90
|
};
|
|
87
91
|
|
|
92
|
+
interface Insets {
|
|
93
|
+
top: number;
|
|
94
|
+
left: number;
|
|
95
|
+
bottom: number;
|
|
96
|
+
right: number;
|
|
97
|
+
}
|
|
98
|
+
interface LayoutRectangle {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
width: number;
|
|
102
|
+
height: number;
|
|
103
|
+
}
|
|
104
|
+
interface NativeScrollEvent {
|
|
105
|
+
contentOffset: {
|
|
106
|
+
x: number;
|
|
107
|
+
y: number;
|
|
108
|
+
};
|
|
109
|
+
contentSize: {
|
|
110
|
+
width: number;
|
|
111
|
+
height: number;
|
|
112
|
+
};
|
|
113
|
+
layoutMeasurement: {
|
|
114
|
+
width: number;
|
|
115
|
+
height: number;
|
|
116
|
+
};
|
|
117
|
+
contentInset: Insets;
|
|
118
|
+
zoomScale: number;
|
|
119
|
+
}
|
|
120
|
+
interface NativeSyntheticEvent<T> {
|
|
121
|
+
nativeEvent: T;
|
|
122
|
+
}
|
|
123
|
+
type ViewStyle = Record<string, unknown>;
|
|
124
|
+
type StyleProp<T> = T | T[] | null | undefined | false;
|
|
88
125
|
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
|
|
89
126
|
interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
90
127
|
/**
|
|
@@ -311,7 +348,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
311
348
|
/**
|
|
312
349
|
* Ref to the underlying ScrollView component.
|
|
313
350
|
*/
|
|
314
|
-
refScrollView?: React.Ref<
|
|
351
|
+
refScrollView?: React.Ref<any>;
|
|
315
352
|
/**
|
|
316
353
|
* If true, shows a refresh indicator.
|
|
317
354
|
* @default false
|
|
@@ -322,7 +359,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
322
359
|
* Note: When using `stickyHeaderIndices`, you must provide an Animated ScrollView component.
|
|
323
360
|
* @default (props) => <ScrollView {...props} />
|
|
324
361
|
*/
|
|
325
|
-
renderScrollComponent?: (props:
|
|
362
|
+
renderScrollComponent?: (props: any) => React.ReactElement | null;
|
|
326
363
|
/**
|
|
327
364
|
* This will log a suggested estimatedItemSize.
|
|
328
365
|
* @required
|
|
@@ -366,7 +403,8 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
366
403
|
getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
|
|
367
404
|
itemsAreEqual?: (itemPrevious: ItemT, item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
368
405
|
}
|
|
369
|
-
type LegendListPropsBase<ItemT,
|
|
406
|
+
type LegendListPropsBase<ItemT, TScrollViewProps = Record<string, any>, TItemType extends string | undefined = string | undefined> = BaseScrollViewProps<TScrollViewProps> & LegendListSpecificProps<ItemT, TItemType> & (DataModeProps<ItemT, TItemType> | ChildrenModeProps);
|
|
407
|
+
type LegendListPropsInternal = LegendListSpecificProps<any, string | undefined> & DataModeProps<any, string | undefined>;
|
|
370
408
|
interface MaintainVisibleContentPositionConfig<ItemT = any> {
|
|
371
409
|
data?: boolean;
|
|
372
410
|
size?: boolean;
|
|
@@ -410,7 +448,6 @@ interface LegendListMetrics {
|
|
|
410
448
|
headerSize: number;
|
|
411
449
|
footerSize: number;
|
|
412
450
|
}
|
|
413
|
-
type LegendListProps<ItemT = any> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
|
|
414
451
|
interface ThresholdSnapshot {
|
|
415
452
|
scrollPosition: number;
|
|
416
453
|
contentSize?: number;
|
|
@@ -473,6 +510,12 @@ interface InternalState {
|
|
|
473
510
|
loadStartTime: number;
|
|
474
511
|
maintainingScrollAtEnd?: boolean;
|
|
475
512
|
minIndexSizeChanged: number | undefined;
|
|
513
|
+
mvcpAnchorLock?: {
|
|
514
|
+
id: string;
|
|
515
|
+
position: number;
|
|
516
|
+
quietPasses: number;
|
|
517
|
+
expiresAt: number;
|
|
518
|
+
};
|
|
476
519
|
contentInsetOverride?: Partial<Insets> | null;
|
|
477
520
|
nativeContentInset?: Insets;
|
|
478
521
|
nativeMarginTop: number;
|
|
@@ -482,8 +525,9 @@ interface InternalState {
|
|
|
482
525
|
positions: Map<string, number>;
|
|
483
526
|
previousData?: readonly unknown[];
|
|
484
527
|
queuedCalculateItemsInView: number | undefined;
|
|
528
|
+
queuedMVCPRecalculate?: number;
|
|
485
529
|
queuedInitialLayout?: boolean | undefined;
|
|
486
|
-
refScroller: React.RefObject<
|
|
530
|
+
refScroller: React.RefObject<any>;
|
|
487
531
|
scroll: number;
|
|
488
532
|
scrollAdjustHandler: ScrollAdjustHandler;
|
|
489
533
|
scrollForNextCalculateItemsInView: {
|
|
@@ -523,38 +567,40 @@ interface InternalState {
|
|
|
523
567
|
viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs<any> | undefined;
|
|
524
568
|
props: {
|
|
525
569
|
alignItemsAtEnd: boolean;
|
|
526
|
-
animatedProps: StylesAsSharedValue<
|
|
570
|
+
animatedProps: StylesAsSharedValue<Record<string, any>>;
|
|
527
571
|
alwaysRender: AlwaysRenderConfig | undefined;
|
|
528
572
|
alwaysRenderIndicesArr: number[];
|
|
529
573
|
alwaysRenderIndicesSet: Set<number>;
|
|
530
574
|
contentInset: Insets | undefined;
|
|
531
575
|
data: readonly any[];
|
|
532
576
|
dataVersion: Key | undefined;
|
|
577
|
+
drawDistance: number;
|
|
533
578
|
estimatedItemSize: number | undefined;
|
|
534
|
-
getEstimatedItemSize:
|
|
535
|
-
getFixedItemSize:
|
|
536
|
-
getItemType:
|
|
579
|
+
getEstimatedItemSize: LegendListPropsInternal["getEstimatedItemSize"];
|
|
580
|
+
getFixedItemSize: LegendListPropsInternal["getFixedItemSize"];
|
|
581
|
+
getItemType: LegendListPropsInternal["getItemType"];
|
|
537
582
|
horizontal: boolean;
|
|
538
583
|
initialContainerPoolRatio: number;
|
|
539
|
-
itemsAreEqual:
|
|
540
|
-
keyExtractor:
|
|
584
|
+
itemsAreEqual: LegendListPropsInternal["itemsAreEqual"];
|
|
585
|
+
keyExtractor: LegendListPropsInternal["keyExtractor"];
|
|
541
586
|
maintainScrollAtEnd: boolean | MaintainScrollAtEndOptions;
|
|
542
587
|
maintainScrollAtEndThreshold: number | undefined;
|
|
543
588
|
maintainVisibleContentPosition: MaintainVisibleContentPositionNormalized;
|
|
544
589
|
numColumns: number;
|
|
545
|
-
onEndReached:
|
|
590
|
+
onEndReached: LegendListPropsInternal["onEndReached"];
|
|
546
591
|
onEndReachedThreshold: number | null | undefined;
|
|
547
|
-
onItemSizeChanged:
|
|
548
|
-
onLoad:
|
|
549
|
-
onScroll:
|
|
550
|
-
onStartReached:
|
|
592
|
+
onItemSizeChanged: LegendListPropsInternal["onItemSizeChanged"];
|
|
593
|
+
onLoad: LegendListPropsInternal["onLoad"];
|
|
594
|
+
onScroll: LegendListPropsInternal["onScroll"];
|
|
595
|
+
onStartReached: LegendListPropsInternal["onStartReached"];
|
|
551
596
|
onStartReachedThreshold: number | null | undefined;
|
|
552
|
-
onStickyHeaderChange:
|
|
553
|
-
overrideItemLayout:
|
|
597
|
+
onStickyHeaderChange: LegendListPropsInternal["onStickyHeaderChange"];
|
|
598
|
+
overrideItemLayout: LegendListPropsInternal["overrideItemLayout"];
|
|
554
599
|
recycleItems: boolean;
|
|
555
|
-
renderItem:
|
|
556
|
-
scrollBuffer
|
|
600
|
+
renderItem: LegendListPropsInternal["renderItem"];
|
|
601
|
+
scrollBuffer?: number;
|
|
557
602
|
snapToIndices: number[] | undefined;
|
|
603
|
+
stickyPositionComponentInternal: React.ComponentType<any> | undefined;
|
|
558
604
|
stickyIndicesArr: number[];
|
|
559
605
|
stickyIndicesSet: Set<number>;
|
|
560
606
|
stylePaddingBottom: number | undefined;
|
|
@@ -576,11 +622,11 @@ interface LegendListRenderItemProps<ItemT, TItemType extends string | number | u
|
|
|
576
622
|
item: ItemT;
|
|
577
623
|
type: TItemType;
|
|
578
624
|
}
|
|
579
|
-
type LegendListState = {
|
|
625
|
+
type LegendListState$1 = {
|
|
580
626
|
activeStickyIndex: number;
|
|
581
627
|
contentLength: number;
|
|
582
628
|
data: readonly any[];
|
|
583
|
-
elementAtIndex: (index: number) =>
|
|
629
|
+
elementAtIndex: (index: number) => any;
|
|
584
630
|
end: number;
|
|
585
631
|
endBuffered: number;
|
|
586
632
|
isAtEnd: boolean;
|
|
@@ -597,7 +643,7 @@ type LegendListState = {
|
|
|
597
643
|
start: number;
|
|
598
644
|
startBuffered: number;
|
|
599
645
|
};
|
|
600
|
-
type LegendListRef = {
|
|
646
|
+
type LegendListRef$1 = {
|
|
601
647
|
/**
|
|
602
648
|
* Displays the scroll indicators momentarily.
|
|
603
649
|
*/
|
|
@@ -605,7 +651,7 @@ type LegendListRef = {
|
|
|
605
651
|
/**
|
|
606
652
|
* Returns the native ScrollView component reference.
|
|
607
653
|
*/
|
|
608
|
-
getNativeScrollRef():
|
|
654
|
+
getNativeScrollRef(): any;
|
|
609
655
|
/**
|
|
610
656
|
* Returns the scroll responder instance for handling scroll events.
|
|
611
657
|
*/
|
|
@@ -613,11 +659,11 @@ type LegendListRef = {
|
|
|
613
659
|
/**
|
|
614
660
|
* Returns the ScrollResponderMixin for advanced scroll handling.
|
|
615
661
|
*/
|
|
616
|
-
getScrollResponder():
|
|
662
|
+
getScrollResponder(): any;
|
|
617
663
|
/**
|
|
618
664
|
* Returns the internal state of the scroll virtualization.
|
|
619
665
|
*/
|
|
620
|
-
getState(): LegendListState;
|
|
666
|
+
getState(): LegendListState$1;
|
|
621
667
|
/**
|
|
622
668
|
* Scrolls a specific index into view.
|
|
623
669
|
* @param params - Parameters for scrolling.
|
|
@@ -697,6 +743,14 @@ type LegendListRef = {
|
|
|
697
743
|
* @param enabled - If true, scroll processing is enabled.
|
|
698
744
|
*/
|
|
699
745
|
setScrollProcessingEnabled(enabled: boolean): void;
|
|
746
|
+
/**
|
|
747
|
+
* Clears internal virtualization caches.
|
|
748
|
+
* @param options - Cache clearing options.
|
|
749
|
+
* @param options.mode - `sizes` clears measurement caches. `full` also clears key/position caches.
|
|
750
|
+
*/
|
|
751
|
+
clearCaches(options?: {
|
|
752
|
+
mode?: "sizes" | "full";
|
|
753
|
+
}): void;
|
|
700
754
|
/**
|
|
701
755
|
* Reports an externally measured content inset. Pass null/undefined to clear.
|
|
702
756
|
* Values are merged on top of props/animated/native insets.
|
|
@@ -792,9 +846,23 @@ type GetRenderedItemResult<ItemT> = {
|
|
|
792
846
|
};
|
|
793
847
|
type GetRenderedItem = (key: string) => GetRenderedItemResult<any> | null;
|
|
794
848
|
|
|
795
|
-
|
|
796
|
-
|
|
849
|
+
type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
|
|
850
|
+
onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
|
|
851
|
+
refScrollView?: React.Ref<ScrollView>;
|
|
852
|
+
renderScrollComponent?: (props: ScrollViewProps) => ReactElement<ScrollViewProps>;
|
|
853
|
+
ListHeaderComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
|
|
854
|
+
ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
|
|
855
|
+
};
|
|
856
|
+
type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
|
|
857
|
+
type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
|
|
858
|
+
getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
859
|
+
getScrollResponder(): ScrollResponderMixin;
|
|
860
|
+
reportContentInset(inset?: Partial<Insets$1> | null): void;
|
|
797
861
|
};
|
|
862
|
+
type LegendListState = Omit<LegendListState$1, "elementAtIndex"> & {
|
|
863
|
+
elementAtIndex: (index: number) => View | null | undefined;
|
|
864
|
+
};
|
|
865
|
+
type LegendListComponent = <ItemT = any>(props: LegendListProps<ItemT> & React.RefAttributes<LegendListRef>) => React.ReactElement | null;
|
|
798
866
|
|
|
799
867
|
declare function useViewability<ItemT = any>(callback: ViewabilityCallback<ItemT>, configId?: string): void;
|
|
800
868
|
declare function useViewabilityAmount<ItemT = any>(callback: ViewabilityAmountCallback<ItemT>): void;
|
|
@@ -807,4 +875,6 @@ declare function useListScrollSize(): {
|
|
|
807
875
|
};
|
|
808
876
|
declare function useSyncLayout(): () => void;
|
|
809
877
|
|
|
810
|
-
|
|
878
|
+
declare const LegendList: LegendListComponent;
|
|
879
|
+
|
|
880
|
+
export { type AlwaysRenderConfig, type BaseScrollViewProps, type ColumnWrapperStyle, type GetRenderedItem, type GetRenderedItemResult, type InitialScrollAnchor, type Insets, type InternalState, type LayoutRectangle, LegendList, type LegendListComponent, type LegendListMetrics, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type LegendListState, type MaintainScrollAtEndOptions, type MaintainVisibleContentPositionConfig, type MaintainVisibleContentPositionNormalized, type NativeScrollEvent, type NativeSyntheticEvent, type OnViewableItemsChanged, type ScrollIndexWithOffset, type ScrollIndexWithOffsetAndContentOffset, type ScrollIndexWithOffsetPosition, type ScrollTarget, type StickyHeaderConfig, type StyleProp, type ThresholdSnapshot, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewStyle, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useSyncLayout, useViewability, useViewabilityAmount };
|