@legendapp/list 1.0.20 → 1.1.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 +5 -0
- package/animated.d.mts +10 -2
- package/animated.d.ts +10 -2
- package/index.d.mts +227 -5
- package/index.d.ts +227 -5
- package/index.js +49 -20
- package/index.mjs +49 -21
- package/keyboard-controller.d.mts +40 -8
- package/keyboard-controller.d.ts +40 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## 1.1.0
|
|
2
|
+
- Feat: Add LazyLegendList component for virtualizing regular children
|
|
3
|
+
- Feat: Support initialScrollIndex with viewOffset and viewPosition
|
|
4
|
+
- Feat: Add estimatedListSize prop for better initial size estimation
|
|
5
|
+
|
|
1
6
|
## 1.0.20
|
|
2
7
|
- Types: Fix type of ref in Reanimated LegendList
|
|
3
8
|
|
package/animated.d.mts
CHANGED
|
@@ -3,17 +3,25 @@ import * as _legendapp_list from '@legendapp/list';
|
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { Animated } from 'react-native';
|
|
5
5
|
|
|
6
|
-
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
7
7
|
alignItemsAtEnd?: boolean;
|
|
8
8
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
9
9
|
data: readonly T[];
|
|
10
10
|
drawDistance?: number;
|
|
11
11
|
estimatedItemSize?: number;
|
|
12
|
+
estimatedListSize?: {
|
|
13
|
+
height: number;
|
|
14
|
+
width: number;
|
|
15
|
+
};
|
|
12
16
|
extraData?: any;
|
|
13
17
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
14
18
|
initialContainerPoolRatio?: number | undefined;
|
|
15
19
|
initialScrollOffset?: number;
|
|
16
|
-
initialScrollIndex?: number
|
|
20
|
+
initialScrollIndex?: number | {
|
|
21
|
+
index: number;
|
|
22
|
+
viewOffset?: number | undefined;
|
|
23
|
+
viewPosition?: number | undefined;
|
|
24
|
+
};
|
|
17
25
|
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
18
26
|
leadingItem: T;
|
|
19
27
|
}> | undefined;
|
package/animated.d.ts
CHANGED
|
@@ -3,17 +3,25 @@ import * as _legendapp_list from '@legendapp/list';
|
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { Animated } from 'react-native';
|
|
5
5
|
|
|
6
|
-
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
7
7
|
alignItemsAtEnd?: boolean;
|
|
8
8
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
9
9
|
data: readonly T[];
|
|
10
10
|
drawDistance?: number;
|
|
11
11
|
estimatedItemSize?: number;
|
|
12
|
+
estimatedListSize?: {
|
|
13
|
+
height: number;
|
|
14
|
+
width: number;
|
|
15
|
+
};
|
|
12
16
|
extraData?: any;
|
|
13
17
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
14
18
|
initialContainerPoolRatio?: number | undefined;
|
|
15
19
|
initialScrollOffset?: number;
|
|
16
|
-
initialScrollIndex?: number
|
|
20
|
+
initialScrollIndex?: number | {
|
|
21
|
+
index: number;
|
|
22
|
+
viewOffset?: number | undefined;
|
|
23
|
+
viewPosition?: number | undefined;
|
|
24
|
+
};
|
|
17
25
|
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
18
26
|
leadingItem: T;
|
|
19
27
|
}> | undefined;
|
package/index.d.mts
CHANGED
|
@@ -3,6 +3,9 @@ import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
|
|
5
5
|
import Animated from 'react-native-reanimated';
|
|
6
|
+
import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
|
|
7
|
+
import * as _legendapp_list from '@legendapp/list';
|
|
8
|
+
import { LegendListProps as LegendListProps$1, LegendListRenderItemProps as LegendListRenderItemProps$1, LegendListRef as LegendListRef$1 } from '@legendapp/list';
|
|
6
9
|
|
|
7
10
|
declare class ScrollAdjustHandler {
|
|
8
11
|
private ctx;
|
|
@@ -20,7 +23,7 @@ declare class ScrollAdjustHandler {
|
|
|
20
23
|
unPauseAdjust(): boolean;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
26
|
+
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
24
27
|
/**
|
|
25
28
|
* If true, aligns items at the end of the list.
|
|
26
29
|
* @default false
|
|
@@ -46,6 +49,14 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
46
49
|
* @default undefined
|
|
47
50
|
*/
|
|
48
51
|
estimatedItemSize?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Estimated size of the ScrollView in pixels, a hint for the first render to improve performance
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
estimatedListSize?: {
|
|
57
|
+
height: number;
|
|
58
|
+
width: number;
|
|
59
|
+
};
|
|
49
60
|
/**
|
|
50
61
|
* Extra data to trigger re-rendering when changed.
|
|
51
62
|
*/
|
|
@@ -69,7 +80,11 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
69
80
|
* Index to scroll to initially.
|
|
70
81
|
* @default 0
|
|
71
82
|
*/
|
|
72
|
-
initialScrollIndex?: number
|
|
83
|
+
initialScrollIndex?: number | {
|
|
84
|
+
index: number;
|
|
85
|
+
viewOffset?: number | undefined;
|
|
86
|
+
viewPosition?: number | undefined;
|
|
87
|
+
};
|
|
73
88
|
/**
|
|
74
89
|
* Component to render between items, receiving the leading item as prop.
|
|
75
90
|
*/
|
|
@@ -478,18 +493,31 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
|
|
|
478
493
|
displayName?: string;
|
|
479
494
|
};
|
|
480
495
|
declare const typedMemo: TypedMemo;
|
|
496
|
+
type ScrollIndexWithOffsetPosition = {
|
|
497
|
+
index: number;
|
|
498
|
+
viewOffset?: number;
|
|
499
|
+
viewPosition?: number;
|
|
500
|
+
};
|
|
481
501
|
|
|
482
|
-
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
502
|
+
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
483
503
|
alignItemsAtEnd?: boolean;
|
|
484
504
|
columnWrapperStyle?: ColumnWrapperStyle;
|
|
485
505
|
data: readonly T[];
|
|
486
506
|
drawDistance?: number;
|
|
487
507
|
estimatedItemSize?: number;
|
|
508
|
+
estimatedListSize?: {
|
|
509
|
+
height: number;
|
|
510
|
+
width: number;
|
|
511
|
+
};
|
|
488
512
|
extraData?: any;
|
|
489
513
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
490
514
|
initialContainerPoolRatio?: number | undefined;
|
|
491
515
|
initialScrollOffset?: number;
|
|
492
|
-
initialScrollIndex?: number
|
|
516
|
+
initialScrollIndex?: number | {
|
|
517
|
+
index: number;
|
|
518
|
+
viewOffset?: number | undefined;
|
|
519
|
+
viewPosition?: number | undefined;
|
|
520
|
+
};
|
|
493
521
|
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
494
522
|
leadingItem: T;
|
|
495
523
|
}> | undefined;
|
|
@@ -535,6 +563,200 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
|
|
|
535
563
|
}) => void;
|
|
536
564
|
} & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
|
|
537
565
|
|
|
566
|
+
interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps$1<ItemT>, "data" | "keyExtractor" | "renderItem"> {
|
|
567
|
+
children?: React$1.ReactNode | undefined;
|
|
568
|
+
LegendList?: ListT;
|
|
569
|
+
}
|
|
570
|
+
declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
571
|
+
alignItemsAtEnd?: boolean;
|
|
572
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
573
|
+
data: readonly T[];
|
|
574
|
+
drawDistance?: number;
|
|
575
|
+
estimatedItemSize?: number;
|
|
576
|
+
estimatedListSize?: {
|
|
577
|
+
height: number;
|
|
578
|
+
width: number;
|
|
579
|
+
};
|
|
580
|
+
extraData?: any;
|
|
581
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
582
|
+
initialContainerPoolRatio?: number | undefined;
|
|
583
|
+
initialScrollOffset?: number;
|
|
584
|
+
initialScrollIndex?: number | {
|
|
585
|
+
index: number;
|
|
586
|
+
viewOffset?: number | undefined;
|
|
587
|
+
viewPosition?: number | undefined;
|
|
588
|
+
};
|
|
589
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
590
|
+
leadingItem: T;
|
|
591
|
+
}> | undefined;
|
|
592
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
593
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
594
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
595
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
596
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
597
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
598
|
+
maintainScrollAtEnd?: boolean;
|
|
599
|
+
maintainScrollAtEndThreshold?: number;
|
|
600
|
+
maintainVisibleContentPosition?: boolean;
|
|
601
|
+
numColumns?: number;
|
|
602
|
+
onEndReached?: ((info: {
|
|
603
|
+
distanceFromEnd: number;
|
|
604
|
+
}) => void) | null | undefined;
|
|
605
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
606
|
+
onItemSizeChanged?: ((info: {
|
|
607
|
+
size: number;
|
|
608
|
+
previous: number;
|
|
609
|
+
index: number;
|
|
610
|
+
itemKey: string;
|
|
611
|
+
itemData: T;
|
|
612
|
+
}) => void) | undefined;
|
|
613
|
+
onRefresh?: () => void;
|
|
614
|
+
onStartReached?: ((info: {
|
|
615
|
+
distanceFromStart: number;
|
|
616
|
+
}) => void) | null | undefined;
|
|
617
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
618
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
619
|
+
progressViewOffset?: number;
|
|
620
|
+
recycleItems?: boolean;
|
|
621
|
+
refScrollView?: React$1.Ref<react_native.ScrollView>;
|
|
622
|
+
refreshing?: boolean;
|
|
623
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
|
|
624
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
625
|
+
suggestEstimatedItemSize?: boolean;
|
|
626
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
627
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
628
|
+
waitForInitialLayout?: boolean;
|
|
629
|
+
onLoad?: (info: {
|
|
630
|
+
elapsedTimeInMs: number;
|
|
631
|
+
}) => void;
|
|
632
|
+
} & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
633
|
+
alignItemsAtEnd?: boolean;
|
|
634
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
635
|
+
data: readonly T[];
|
|
636
|
+
drawDistance?: number;
|
|
637
|
+
estimatedItemSize?: number;
|
|
638
|
+
estimatedListSize?: {
|
|
639
|
+
height: number;
|
|
640
|
+
width: number;
|
|
641
|
+
};
|
|
642
|
+
extraData?: any;
|
|
643
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
644
|
+
initialContainerPoolRatio?: number | undefined;
|
|
645
|
+
initialScrollOffset?: number;
|
|
646
|
+
initialScrollIndex?: number | {
|
|
647
|
+
index: number;
|
|
648
|
+
viewOffset?: number | undefined;
|
|
649
|
+
viewPosition?: number | undefined;
|
|
650
|
+
};
|
|
651
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
652
|
+
leadingItem: T;
|
|
653
|
+
}> | undefined;
|
|
654
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
655
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
656
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
657
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
658
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
659
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
660
|
+
maintainScrollAtEnd?: boolean;
|
|
661
|
+
maintainScrollAtEndThreshold?: number;
|
|
662
|
+
maintainVisibleContentPosition?: boolean;
|
|
663
|
+
numColumns?: number;
|
|
664
|
+
onEndReached?: ((info: {
|
|
665
|
+
distanceFromEnd: number;
|
|
666
|
+
}) => void) | null | undefined;
|
|
667
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
668
|
+
onItemSizeChanged?: ((info: {
|
|
669
|
+
size: number;
|
|
670
|
+
previous: number;
|
|
671
|
+
index: number;
|
|
672
|
+
itemKey: string;
|
|
673
|
+
itemData: T;
|
|
674
|
+
}) => void) | undefined;
|
|
675
|
+
onRefresh?: () => void;
|
|
676
|
+
onStartReached?: ((info: {
|
|
677
|
+
distanceFromStart: number;
|
|
678
|
+
}) => void) | null | undefined;
|
|
679
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
680
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
681
|
+
progressViewOffset?: number;
|
|
682
|
+
recycleItems?: boolean;
|
|
683
|
+
refScrollView?: React$1.Ref<react_native.ScrollView>;
|
|
684
|
+
refreshing?: boolean;
|
|
685
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
|
|
686
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
687
|
+
suggestEstimatedItemSize?: boolean;
|
|
688
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
689
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
690
|
+
waitForInitialLayout?: boolean;
|
|
691
|
+
onLoad?: (info: {
|
|
692
|
+
elapsedTimeInMs: number;
|
|
693
|
+
}) => void;
|
|
694
|
+
} & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
|
|
695
|
+
ref?: React$1.Ref<LegendListRef$1>;
|
|
696
|
+
}) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
697
|
+
alignItemsAtEnd?: boolean;
|
|
698
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
699
|
+
data: readonly T[];
|
|
700
|
+
drawDistance?: number;
|
|
701
|
+
estimatedItemSize?: number;
|
|
702
|
+
estimatedListSize?: {
|
|
703
|
+
height: number;
|
|
704
|
+
width: number;
|
|
705
|
+
};
|
|
706
|
+
extraData?: any;
|
|
707
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
708
|
+
initialContainerPoolRatio?: number | undefined;
|
|
709
|
+
initialScrollOffset?: number;
|
|
710
|
+
initialScrollIndex?: number | {
|
|
711
|
+
index: number;
|
|
712
|
+
viewOffset?: number | undefined;
|
|
713
|
+
viewPosition?: number | undefined;
|
|
714
|
+
};
|
|
715
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
716
|
+
leadingItem: T;
|
|
717
|
+
}> | undefined;
|
|
718
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
719
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
720
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
721
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
722
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
723
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
724
|
+
maintainScrollAtEnd?: boolean;
|
|
725
|
+
maintainScrollAtEndThreshold?: number;
|
|
726
|
+
maintainVisibleContentPosition?: boolean;
|
|
727
|
+
numColumns?: number;
|
|
728
|
+
onEndReached?: ((info: {
|
|
729
|
+
distanceFromEnd: number;
|
|
730
|
+
}) => void) | null | undefined;
|
|
731
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
732
|
+
onItemSizeChanged?: ((info: {
|
|
733
|
+
size: number;
|
|
734
|
+
previous: number;
|
|
735
|
+
index: number;
|
|
736
|
+
itemKey: string;
|
|
737
|
+
itemData: T;
|
|
738
|
+
}) => void) | undefined;
|
|
739
|
+
onRefresh?: () => void;
|
|
740
|
+
onStartReached?: ((info: {
|
|
741
|
+
distanceFromStart: number;
|
|
742
|
+
}) => void) | null | undefined;
|
|
743
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
744
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
745
|
+
progressViewOffset?: number;
|
|
746
|
+
recycleItems?: boolean;
|
|
747
|
+
refScrollView?: React$1.Ref<react_native.ScrollView>;
|
|
748
|
+
refreshing?: boolean;
|
|
749
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
|
|
750
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
751
|
+
suggestEstimatedItemSize?: boolean;
|
|
752
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
753
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
754
|
+
waitForInitialLayout?: boolean;
|
|
755
|
+
onLoad?: (info: {
|
|
756
|
+
elapsedTimeInMs: number;
|
|
757
|
+
}) => void;
|
|
758
|
+
} & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode;
|
|
759
|
+
|
|
538
760
|
declare function useViewability(callback: ViewabilityCallback, configId?: string): void;
|
|
539
761
|
declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
|
|
540
762
|
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
@@ -545,4 +767,4 @@ declare function useListScrollSize(): {
|
|
|
545
767
|
height: number;
|
|
546
768
|
};
|
|
547
769
|
|
|
548
|
-
export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
|
770
|
+
export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LazyLegendList, type LazyLegendListProps, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollIndexWithOffsetPosition, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, NativeSyntheticEvent, NativeScrollEvent, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
|
|
5
5
|
import Animated from 'react-native-reanimated';
|
|
6
|
+
import * as _legendapp_list_reanimated from '@legendapp/list/reanimated';
|
|
7
|
+
import * as _legendapp_list from '@legendapp/list';
|
|
8
|
+
import { LegendListProps as LegendListProps$1, LegendListRenderItemProps as LegendListRenderItemProps$1, LegendListRef as LegendListRef$1 } from '@legendapp/list';
|
|
6
9
|
|
|
7
10
|
declare class ScrollAdjustHandler {
|
|
8
11
|
private ctx;
|
|
@@ -20,7 +23,7 @@ declare class ScrollAdjustHandler {
|
|
|
20
23
|
unPauseAdjust(): boolean;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
26
|
+
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
24
27
|
/**
|
|
25
28
|
* If true, aligns items at the end of the list.
|
|
26
29
|
* @default false
|
|
@@ -46,6 +49,14 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
46
49
|
* @default undefined
|
|
47
50
|
*/
|
|
48
51
|
estimatedItemSize?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Estimated size of the ScrollView in pixels, a hint for the first render to improve performance
|
|
54
|
+
* @default undefined
|
|
55
|
+
*/
|
|
56
|
+
estimatedListSize?: {
|
|
57
|
+
height: number;
|
|
58
|
+
width: number;
|
|
59
|
+
};
|
|
49
60
|
/**
|
|
50
61
|
* Extra data to trigger re-rendering when changed.
|
|
51
62
|
*/
|
|
@@ -69,7 +80,11 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
69
80
|
* Index to scroll to initially.
|
|
70
81
|
* @default 0
|
|
71
82
|
*/
|
|
72
|
-
initialScrollIndex?: number
|
|
83
|
+
initialScrollIndex?: number | {
|
|
84
|
+
index: number;
|
|
85
|
+
viewOffset?: number | undefined;
|
|
86
|
+
viewPosition?: number | undefined;
|
|
87
|
+
};
|
|
73
88
|
/**
|
|
74
89
|
* Component to render between items, receiving the leading item as prop.
|
|
75
90
|
*/
|
|
@@ -478,18 +493,31 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
|
|
|
478
493
|
displayName?: string;
|
|
479
494
|
};
|
|
480
495
|
declare const typedMemo: TypedMemo;
|
|
496
|
+
type ScrollIndexWithOffsetPosition = {
|
|
497
|
+
index: number;
|
|
498
|
+
viewOffset?: number;
|
|
499
|
+
viewPosition?: number;
|
|
500
|
+
};
|
|
481
501
|
|
|
482
|
-
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
502
|
+
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
483
503
|
alignItemsAtEnd?: boolean;
|
|
484
504
|
columnWrapperStyle?: ColumnWrapperStyle;
|
|
485
505
|
data: readonly T[];
|
|
486
506
|
drawDistance?: number;
|
|
487
507
|
estimatedItemSize?: number;
|
|
508
|
+
estimatedListSize?: {
|
|
509
|
+
height: number;
|
|
510
|
+
width: number;
|
|
511
|
+
};
|
|
488
512
|
extraData?: any;
|
|
489
513
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
490
514
|
initialContainerPoolRatio?: number | undefined;
|
|
491
515
|
initialScrollOffset?: number;
|
|
492
|
-
initialScrollIndex?: number
|
|
516
|
+
initialScrollIndex?: number | {
|
|
517
|
+
index: number;
|
|
518
|
+
viewOffset?: number | undefined;
|
|
519
|
+
viewPosition?: number | undefined;
|
|
520
|
+
};
|
|
493
521
|
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
494
522
|
leadingItem: T;
|
|
495
523
|
}> | undefined;
|
|
@@ -535,6 +563,200 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
|
|
|
535
563
|
}) => void;
|
|
536
564
|
} & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
|
|
537
565
|
|
|
566
|
+
interface LazyLegendListProps<ItemT, ListT> extends Omit<LegendListProps$1<ItemT>, "data" | "keyExtractor" | "renderItem"> {
|
|
567
|
+
children?: React$1.ReactNode | undefined;
|
|
568
|
+
LegendList?: ListT;
|
|
569
|
+
}
|
|
570
|
+
declare const LazyLegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
571
|
+
alignItemsAtEnd?: boolean;
|
|
572
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
573
|
+
data: readonly T[];
|
|
574
|
+
drawDistance?: number;
|
|
575
|
+
estimatedItemSize?: number;
|
|
576
|
+
estimatedListSize?: {
|
|
577
|
+
height: number;
|
|
578
|
+
width: number;
|
|
579
|
+
};
|
|
580
|
+
extraData?: any;
|
|
581
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
582
|
+
initialContainerPoolRatio?: number | undefined;
|
|
583
|
+
initialScrollOffset?: number;
|
|
584
|
+
initialScrollIndex?: number | {
|
|
585
|
+
index: number;
|
|
586
|
+
viewOffset?: number | undefined;
|
|
587
|
+
viewPosition?: number | undefined;
|
|
588
|
+
};
|
|
589
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
590
|
+
leadingItem: T;
|
|
591
|
+
}> | undefined;
|
|
592
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
593
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
594
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
595
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
596
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
597
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
598
|
+
maintainScrollAtEnd?: boolean;
|
|
599
|
+
maintainScrollAtEndThreshold?: number;
|
|
600
|
+
maintainVisibleContentPosition?: boolean;
|
|
601
|
+
numColumns?: number;
|
|
602
|
+
onEndReached?: ((info: {
|
|
603
|
+
distanceFromEnd: number;
|
|
604
|
+
}) => void) | null | undefined;
|
|
605
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
606
|
+
onItemSizeChanged?: ((info: {
|
|
607
|
+
size: number;
|
|
608
|
+
previous: number;
|
|
609
|
+
index: number;
|
|
610
|
+
itemKey: string;
|
|
611
|
+
itemData: T;
|
|
612
|
+
}) => void) | undefined;
|
|
613
|
+
onRefresh?: () => void;
|
|
614
|
+
onStartReached?: ((info: {
|
|
615
|
+
distanceFromStart: number;
|
|
616
|
+
}) => void) | null | undefined;
|
|
617
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
618
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
619
|
+
progressViewOffset?: number;
|
|
620
|
+
recycleItems?: boolean;
|
|
621
|
+
refScrollView?: React$1.Ref<react_native.ScrollView>;
|
|
622
|
+
refreshing?: boolean;
|
|
623
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
|
|
624
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
625
|
+
suggestEstimatedItemSize?: boolean;
|
|
626
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
627
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
628
|
+
waitForInitialLayout?: boolean;
|
|
629
|
+
onLoad?: (info: {
|
|
630
|
+
elapsedTimeInMs: number;
|
|
631
|
+
}) => void;
|
|
632
|
+
} & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
633
|
+
alignItemsAtEnd?: boolean;
|
|
634
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
635
|
+
data: readonly T[];
|
|
636
|
+
drawDistance?: number;
|
|
637
|
+
estimatedItemSize?: number;
|
|
638
|
+
estimatedListSize?: {
|
|
639
|
+
height: number;
|
|
640
|
+
width: number;
|
|
641
|
+
};
|
|
642
|
+
extraData?: any;
|
|
643
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
644
|
+
initialContainerPoolRatio?: number | undefined;
|
|
645
|
+
initialScrollOffset?: number;
|
|
646
|
+
initialScrollIndex?: number | {
|
|
647
|
+
index: number;
|
|
648
|
+
viewOffset?: number | undefined;
|
|
649
|
+
viewPosition?: number | undefined;
|
|
650
|
+
};
|
|
651
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
652
|
+
leadingItem: T;
|
|
653
|
+
}> | undefined;
|
|
654
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
655
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
656
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
657
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
658
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
659
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
660
|
+
maintainScrollAtEnd?: boolean;
|
|
661
|
+
maintainScrollAtEndThreshold?: number;
|
|
662
|
+
maintainVisibleContentPosition?: boolean;
|
|
663
|
+
numColumns?: number;
|
|
664
|
+
onEndReached?: ((info: {
|
|
665
|
+
distanceFromEnd: number;
|
|
666
|
+
}) => void) | null | undefined;
|
|
667
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
668
|
+
onItemSizeChanged?: ((info: {
|
|
669
|
+
size: number;
|
|
670
|
+
previous: number;
|
|
671
|
+
index: number;
|
|
672
|
+
itemKey: string;
|
|
673
|
+
itemData: T;
|
|
674
|
+
}) => void) | undefined;
|
|
675
|
+
onRefresh?: () => void;
|
|
676
|
+
onStartReached?: ((info: {
|
|
677
|
+
distanceFromStart: number;
|
|
678
|
+
}) => void) | null | undefined;
|
|
679
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
680
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
681
|
+
progressViewOffset?: number;
|
|
682
|
+
recycleItems?: boolean;
|
|
683
|
+
refScrollView?: React$1.Ref<react_native.ScrollView>;
|
|
684
|
+
refreshing?: boolean;
|
|
685
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
|
|
686
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
687
|
+
suggestEstimatedItemSize?: boolean;
|
|
688
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
689
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
690
|
+
waitForInitialLayout?: boolean;
|
|
691
|
+
onLoad?: (info: {
|
|
692
|
+
elapsedTimeInMs: number;
|
|
693
|
+
}) => void;
|
|
694
|
+
} & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
|
|
695
|
+
ref?: React$1.Ref<LegendListRef$1>;
|
|
696
|
+
}) => React$1.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
697
|
+
alignItemsAtEnd?: boolean;
|
|
698
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
699
|
+
data: readonly T[];
|
|
700
|
+
drawDistance?: number;
|
|
701
|
+
estimatedItemSize?: number;
|
|
702
|
+
estimatedListSize?: {
|
|
703
|
+
height: number;
|
|
704
|
+
width: number;
|
|
705
|
+
};
|
|
706
|
+
extraData?: any;
|
|
707
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
708
|
+
initialContainerPoolRatio?: number | undefined;
|
|
709
|
+
initialScrollOffset?: number;
|
|
710
|
+
initialScrollIndex?: number | {
|
|
711
|
+
index: number;
|
|
712
|
+
viewOffset?: number | undefined;
|
|
713
|
+
viewPosition?: number | undefined;
|
|
714
|
+
};
|
|
715
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
716
|
+
leadingItem: T;
|
|
717
|
+
}> | undefined;
|
|
718
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
719
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
720
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
721
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
722
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
723
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
724
|
+
maintainScrollAtEnd?: boolean;
|
|
725
|
+
maintainScrollAtEndThreshold?: number;
|
|
726
|
+
maintainVisibleContentPosition?: boolean;
|
|
727
|
+
numColumns?: number;
|
|
728
|
+
onEndReached?: ((info: {
|
|
729
|
+
distanceFromEnd: number;
|
|
730
|
+
}) => void) | null | undefined;
|
|
731
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
732
|
+
onItemSizeChanged?: ((info: {
|
|
733
|
+
size: number;
|
|
734
|
+
previous: number;
|
|
735
|
+
index: number;
|
|
736
|
+
itemKey: string;
|
|
737
|
+
itemData: T;
|
|
738
|
+
}) => void) | undefined;
|
|
739
|
+
onRefresh?: () => void;
|
|
740
|
+
onStartReached?: ((info: {
|
|
741
|
+
distanceFromStart: number;
|
|
742
|
+
}) => void) | null | undefined;
|
|
743
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
744
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
745
|
+
progressViewOffset?: number;
|
|
746
|
+
recycleItems?: boolean;
|
|
747
|
+
refScrollView?: React$1.Ref<react_native.ScrollView>;
|
|
748
|
+
refreshing?: boolean;
|
|
749
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps$1<T>> | ((props: LegendListRenderItemProps$1<T>) => React$1.ReactNode) | undefined;
|
|
750
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
751
|
+
suggestEstimatedItemSize?: boolean;
|
|
752
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
753
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
754
|
+
waitForInitialLayout?: boolean;
|
|
755
|
+
onLoad?: (info: {
|
|
756
|
+
elapsedTimeInMs: number;
|
|
757
|
+
}) => void;
|
|
758
|
+
} & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode>(props: LazyLegendListProps<ItemT, ListT> & React$1.RefAttributes<LegendListRef$1>) => React$1.ReactNode;
|
|
759
|
+
|
|
538
760
|
declare function useViewability(callback: ViewabilityCallback, configId?: string): void;
|
|
539
761
|
declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
|
|
540
762
|
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
@@ -545,4 +767,4 @@ declare function useListScrollSize(): {
|
|
|
545
767
|
height: number;
|
|
546
768
|
};
|
|
547
769
|
|
|
548
|
-
export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
|
770
|
+
export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LazyLegendList, type LazyLegendListProps, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ScrollIndexWithOffsetPosition, type ScrollState, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
package/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var React2 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var shim = require('use-sync-external-store/shim');
|
|
6
|
+
var list = require('@legendapp/list');
|
|
6
7
|
|
|
7
8
|
function _interopNamespace(e) {
|
|
8
9
|
if (e && e.__esModule) return e;
|
|
@@ -193,6 +194,9 @@ function useInterval(callback, delay) {
|
|
|
193
194
|
function isFunction(obj) {
|
|
194
195
|
return typeof obj === "function";
|
|
195
196
|
}
|
|
197
|
+
function isArray(obj) {
|
|
198
|
+
return Array.isArray(obj);
|
|
199
|
+
}
|
|
196
200
|
var warned = /* @__PURE__ */ new Set();
|
|
197
201
|
function warnDevOnce(id, text) {
|
|
198
202
|
if (__DEV__ && !warned.has(id)) {
|
|
@@ -1005,7 +1009,7 @@ var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
|
|
|
1005
1009
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
1006
1010
|
const {
|
|
1007
1011
|
data: dataProp = [],
|
|
1008
|
-
initialScrollIndex,
|
|
1012
|
+
initialScrollIndex: initialScrollIndexProp,
|
|
1009
1013
|
initialScrollOffset,
|
|
1010
1014
|
horizontal,
|
|
1011
1015
|
drawDistance = 250,
|
|
@@ -1021,7 +1025,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1021
1025
|
numColumns: numColumnsProp = 1,
|
|
1022
1026
|
columnWrapperStyle,
|
|
1023
1027
|
keyExtractor: keyExtractorProp,
|
|
1024
|
-
renderItem,
|
|
1028
|
+
renderItem: renderItem2,
|
|
1029
|
+
estimatedListSize,
|
|
1025
1030
|
estimatedItemSize: estimatedItemSizeProp,
|
|
1026
1031
|
getEstimatedItemSize,
|
|
1027
1032
|
suggestEstimatedItemSize,
|
|
@@ -1044,6 +1049,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1044
1049
|
onViewableItemsChanged,
|
|
1045
1050
|
...rest
|
|
1046
1051
|
} = props;
|
|
1052
|
+
const initialScroll = typeof initialScrollIndexProp === "number" ? { index: initialScrollIndexProp } : initialScrollIndexProp;
|
|
1053
|
+
const initialScrollIndex = initialScroll == null ? void 0 : initialScroll.index;
|
|
1047
1054
|
const refLoadStartTime = React2.useRef(Date.now());
|
|
1048
1055
|
const callbacks = React2.useRef({
|
|
1049
1056
|
onStartReached: rest.onStartReached,
|
|
@@ -1121,9 +1128,21 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1121
1128
|
}
|
|
1122
1129
|
return 0;
|
|
1123
1130
|
};
|
|
1131
|
+
const calculateOffsetWithOffsetPosition = (offsetParam, params) => {
|
|
1132
|
+
const { index, viewOffset, viewPosition } = params;
|
|
1133
|
+
let offset = offsetParam;
|
|
1134
|
+
const state = refState.current;
|
|
1135
|
+
if (viewOffset) {
|
|
1136
|
+
offset -= viewOffset;
|
|
1137
|
+
}
|
|
1138
|
+
if (viewPosition !== void 0 && index !== void 0) {
|
|
1139
|
+
offset -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1140
|
+
}
|
|
1141
|
+
return offset;
|
|
1142
|
+
};
|
|
1124
1143
|
const initialContentOffset = initialScrollOffset != null ? initialScrollOffset : React2.useMemo(() => calculateOffsetForIndex(void 0), []);
|
|
1125
1144
|
if (!refState.current) {
|
|
1126
|
-
const initialScrollLength = reactNative.Dimensions.get("window")[horizontal ? "width" : "height"];
|
|
1145
|
+
const initialScrollLength = (estimatedListSize != null ? estimatedListSize : reactNative.Dimensions.get("window"))[horizontal ? "width" : "height"];
|
|
1127
1146
|
refState.current = {
|
|
1128
1147
|
sizes: /* @__PURE__ */ new Map(),
|
|
1129
1148
|
positions: /* @__PURE__ */ new Map(),
|
|
@@ -1247,12 +1266,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1247
1266
|
props.onLoad({ elapsedTimeInMs: Date.now() - refLoadStartTime.current });
|
|
1248
1267
|
}
|
|
1249
1268
|
};
|
|
1250
|
-
if (
|
|
1269
|
+
if (initialScroll) {
|
|
1251
1270
|
queueMicrotask(() => {
|
|
1252
|
-
scrollToIndex({
|
|
1271
|
+
scrollToIndex({ ...initialScroll, animated: false });
|
|
1253
1272
|
requestAnimationFrame(() => {
|
|
1254
1273
|
if (!IsNewArchitecture) {
|
|
1255
|
-
scrollToIndex({
|
|
1274
|
+
scrollToIndex({ ...initialScroll, animated: false });
|
|
1256
1275
|
}
|
|
1257
1276
|
setIt();
|
|
1258
1277
|
});
|
|
@@ -1466,8 +1485,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1466
1485
|
let scrollState = state.scroll;
|
|
1467
1486
|
const scrollExtra = 0;
|
|
1468
1487
|
const useAverageSize = !state.disableScrollJumpsFrom && speed >= 0 && peek$(ctx, "containersDidLayout");
|
|
1469
|
-
if (!state.queuedInitialLayout &&
|
|
1470
|
-
const updatedOffset =
|
|
1488
|
+
if (!state.queuedInitialLayout && initialScroll) {
|
|
1489
|
+
const updatedOffset = calculateOffsetWithOffsetPosition(
|
|
1490
|
+
calculateOffsetForIndex(initialScroll.index),
|
|
1491
|
+
initialScroll
|
|
1492
|
+
);
|
|
1471
1493
|
scrollState = updatedOffset;
|
|
1472
1494
|
}
|
|
1473
1495
|
const scrollAdjustPad = -previousScrollAdjust - topPad;
|
|
@@ -1759,14 +1781,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1759
1781
|
const scrollTo = (params = {}) => {
|
|
1760
1782
|
var _a;
|
|
1761
1783
|
const state = refState.current;
|
|
1762
|
-
const { animated
|
|
1763
|
-
|
|
1764
|
-
if (viewOffset) {
|
|
1765
|
-
offset -= viewOffset;
|
|
1766
|
-
}
|
|
1767
|
-
if (viewPosition !== void 0 && index !== void 0) {
|
|
1768
|
-
offset -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1769
|
-
}
|
|
1784
|
+
const { animated } = params;
|
|
1785
|
+
const offset = calculateOffsetWithOffsetPosition(params.offset, params);
|
|
1770
1786
|
state.scrollAdjustHandler.setDisableAdjust(true);
|
|
1771
1787
|
state.scrollHistory.length = 0;
|
|
1772
1788
|
state.scrollingTo = params;
|
|
@@ -2097,10 +2113,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2097
2113
|
calcTotalSizesAndPositions({ forgetPositions: false });
|
|
2098
2114
|
}
|
|
2099
2115
|
React2.useEffect(() => {
|
|
2100
|
-
if (
|
|
2116
|
+
if (initialScroll && ListHeaderComponent) {
|
|
2101
2117
|
const dispose = listen$(ctx, "headerSize", (size) => {
|
|
2102
2118
|
if (size > 0) {
|
|
2103
|
-
scrollToIndex({
|
|
2119
|
+
scrollToIndex({ ...initialScroll, animated: false });
|
|
2104
2120
|
dispose == null ? void 0 : dispose();
|
|
2105
2121
|
}
|
|
2106
2122
|
});
|
|
@@ -2120,7 +2136,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2120
2136
|
React2.useEffect(() => {
|
|
2121
2137
|
set$(ctx, "extraData", extraData);
|
|
2122
2138
|
}, [extraData]);
|
|
2123
|
-
refState.current.renderItem =
|
|
2139
|
+
refState.current.renderItem = renderItem2;
|
|
2124
2140
|
React2.useEffect(initalizeStateVars, [
|
|
2125
2141
|
memoizedLastItemKeys.join(","),
|
|
2126
2142
|
numColumnsProp,
|
|
@@ -2161,7 +2177,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2161
2177
|
}
|
|
2162
2178
|
set$(ctx, "numContainers", numContainers);
|
|
2163
2179
|
set$(ctx, "numContainersPooled", numContainers * initialContainerPoolRatio);
|
|
2164
|
-
if (
|
|
2180
|
+
if (initialScroll) {
|
|
2165
2181
|
requestAnimationFrame(() => {
|
|
2166
2182
|
calculateItemsInView(
|
|
2167
2183
|
/*isReset*/
|
|
@@ -2569,7 +2585,20 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2569
2585
|
}
|
|
2570
2586
|
), __DEV__ && ENABLE_DEBUG_VIEW && /* @__PURE__ */ React2__namespace.createElement(DebugView, { state: refState.current }));
|
|
2571
2587
|
});
|
|
2588
|
+
var typedForwardRef2 = React2.forwardRef;
|
|
2589
|
+
var renderItem = ({ item }) => item;
|
|
2590
|
+
var LazyLegendList = typedForwardRef2(function LazyLegendList2(props, forwardedRef) {
|
|
2591
|
+
const { LegendList: LegendListProp, children, ...rest } = props;
|
|
2592
|
+
const LegendListComponent = LegendListProp != null ? LegendListProp : list.LegendList;
|
|
2593
|
+
const data = (isArray(children) ? children : React2__namespace.Children.toArray(children)).flat(1);
|
|
2594
|
+
console.log({ data });
|
|
2595
|
+
return (
|
|
2596
|
+
// @ts-expect-error TODO: Fix this type
|
|
2597
|
+
/* @__PURE__ */ React2__namespace.createElement(LegendListComponent, { ...rest, data, renderItem, ref: forwardedRef })
|
|
2598
|
+
);
|
|
2599
|
+
});
|
|
2572
2600
|
|
|
2601
|
+
exports.LazyLegendList = LazyLegendList;
|
|
2573
2602
|
exports.LegendList = LegendList;
|
|
2574
2603
|
exports.useIsLastItem = useIsLastItem;
|
|
2575
2604
|
exports.useListScrollSize = useListScrollSize;
|
package/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import * as React2 from 'react';
|
|
|
2
2
|
import React2__default, { useReducer, useEffect, createContext, useMemo, useRef, useCallback, useLayoutEffect, useImperativeHandle, useContext, useState, forwardRef, memo } from 'react';
|
|
3
3
|
import { View, Text, Platform, Animated, ScrollView, StyleSheet, Dimensions, RefreshControl } from 'react-native';
|
|
4
4
|
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
5
|
+
import { LegendList as LegendList$1 } from '@legendapp/list';
|
|
5
6
|
|
|
6
7
|
// src/LegendList.tsx
|
|
7
8
|
var ContextState = React2.createContext(null);
|
|
@@ -172,6 +173,9 @@ function useInterval(callback, delay) {
|
|
|
172
173
|
function isFunction(obj) {
|
|
173
174
|
return typeof obj === "function";
|
|
174
175
|
}
|
|
176
|
+
function isArray(obj) {
|
|
177
|
+
return Array.isArray(obj);
|
|
178
|
+
}
|
|
175
179
|
var warned = /* @__PURE__ */ new Set();
|
|
176
180
|
function warnDevOnce(id, text) {
|
|
177
181
|
if (__DEV__ && !warned.has(id)) {
|
|
@@ -984,7 +988,7 @@ var LegendList = typedForwardRef(function LegendList2(props, forwardedRef) {
|
|
|
984
988
|
var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedRef) {
|
|
985
989
|
const {
|
|
986
990
|
data: dataProp = [],
|
|
987
|
-
initialScrollIndex,
|
|
991
|
+
initialScrollIndex: initialScrollIndexProp,
|
|
988
992
|
initialScrollOffset,
|
|
989
993
|
horizontal,
|
|
990
994
|
drawDistance = 250,
|
|
@@ -1000,7 +1004,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1000
1004
|
numColumns: numColumnsProp = 1,
|
|
1001
1005
|
columnWrapperStyle,
|
|
1002
1006
|
keyExtractor: keyExtractorProp,
|
|
1003
|
-
renderItem,
|
|
1007
|
+
renderItem: renderItem2,
|
|
1008
|
+
estimatedListSize,
|
|
1004
1009
|
estimatedItemSize: estimatedItemSizeProp,
|
|
1005
1010
|
getEstimatedItemSize,
|
|
1006
1011
|
suggestEstimatedItemSize,
|
|
@@ -1023,6 +1028,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1023
1028
|
onViewableItemsChanged,
|
|
1024
1029
|
...rest
|
|
1025
1030
|
} = props;
|
|
1031
|
+
const initialScroll = typeof initialScrollIndexProp === "number" ? { index: initialScrollIndexProp } : initialScrollIndexProp;
|
|
1032
|
+
const initialScrollIndex = initialScroll == null ? void 0 : initialScroll.index;
|
|
1026
1033
|
const refLoadStartTime = useRef(Date.now());
|
|
1027
1034
|
const callbacks = useRef({
|
|
1028
1035
|
onStartReached: rest.onStartReached,
|
|
@@ -1100,9 +1107,21 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1100
1107
|
}
|
|
1101
1108
|
return 0;
|
|
1102
1109
|
};
|
|
1110
|
+
const calculateOffsetWithOffsetPosition = (offsetParam, params) => {
|
|
1111
|
+
const { index, viewOffset, viewPosition } = params;
|
|
1112
|
+
let offset = offsetParam;
|
|
1113
|
+
const state = refState.current;
|
|
1114
|
+
if (viewOffset) {
|
|
1115
|
+
offset -= viewOffset;
|
|
1116
|
+
}
|
|
1117
|
+
if (viewPosition !== void 0 && index !== void 0) {
|
|
1118
|
+
offset -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1119
|
+
}
|
|
1120
|
+
return offset;
|
|
1121
|
+
};
|
|
1103
1122
|
const initialContentOffset = initialScrollOffset != null ? initialScrollOffset : useMemo(() => calculateOffsetForIndex(void 0), []);
|
|
1104
1123
|
if (!refState.current) {
|
|
1105
|
-
const initialScrollLength = Dimensions.get("window")[horizontal ? "width" : "height"];
|
|
1124
|
+
const initialScrollLength = (estimatedListSize != null ? estimatedListSize : Dimensions.get("window"))[horizontal ? "width" : "height"];
|
|
1106
1125
|
refState.current = {
|
|
1107
1126
|
sizes: /* @__PURE__ */ new Map(),
|
|
1108
1127
|
positions: /* @__PURE__ */ new Map(),
|
|
@@ -1226,12 +1245,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1226
1245
|
props.onLoad({ elapsedTimeInMs: Date.now() - refLoadStartTime.current });
|
|
1227
1246
|
}
|
|
1228
1247
|
};
|
|
1229
|
-
if (
|
|
1248
|
+
if (initialScroll) {
|
|
1230
1249
|
queueMicrotask(() => {
|
|
1231
|
-
scrollToIndex({
|
|
1250
|
+
scrollToIndex({ ...initialScroll, animated: false });
|
|
1232
1251
|
requestAnimationFrame(() => {
|
|
1233
1252
|
if (!IsNewArchitecture) {
|
|
1234
|
-
scrollToIndex({
|
|
1253
|
+
scrollToIndex({ ...initialScroll, animated: false });
|
|
1235
1254
|
}
|
|
1236
1255
|
setIt();
|
|
1237
1256
|
});
|
|
@@ -1445,8 +1464,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1445
1464
|
let scrollState = state.scroll;
|
|
1446
1465
|
const scrollExtra = 0;
|
|
1447
1466
|
const useAverageSize = !state.disableScrollJumpsFrom && speed >= 0 && peek$(ctx, "containersDidLayout");
|
|
1448
|
-
if (!state.queuedInitialLayout &&
|
|
1449
|
-
const updatedOffset =
|
|
1467
|
+
if (!state.queuedInitialLayout && initialScroll) {
|
|
1468
|
+
const updatedOffset = calculateOffsetWithOffsetPosition(
|
|
1469
|
+
calculateOffsetForIndex(initialScroll.index),
|
|
1470
|
+
initialScroll
|
|
1471
|
+
);
|
|
1450
1472
|
scrollState = updatedOffset;
|
|
1451
1473
|
}
|
|
1452
1474
|
const scrollAdjustPad = -previousScrollAdjust - topPad;
|
|
@@ -1738,14 +1760,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1738
1760
|
const scrollTo = (params = {}) => {
|
|
1739
1761
|
var _a;
|
|
1740
1762
|
const state = refState.current;
|
|
1741
|
-
const { animated
|
|
1742
|
-
|
|
1743
|
-
if (viewOffset) {
|
|
1744
|
-
offset -= viewOffset;
|
|
1745
|
-
}
|
|
1746
|
-
if (viewPosition !== void 0 && index !== void 0) {
|
|
1747
|
-
offset -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1748
|
-
}
|
|
1763
|
+
const { animated } = params;
|
|
1764
|
+
const offset = calculateOffsetWithOffsetPosition(params.offset, params);
|
|
1749
1765
|
state.scrollAdjustHandler.setDisableAdjust(true);
|
|
1750
1766
|
state.scrollHistory.length = 0;
|
|
1751
1767
|
state.scrollingTo = params;
|
|
@@ -2076,10 +2092,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2076
2092
|
calcTotalSizesAndPositions({ forgetPositions: false });
|
|
2077
2093
|
}
|
|
2078
2094
|
useEffect(() => {
|
|
2079
|
-
if (
|
|
2095
|
+
if (initialScroll && ListHeaderComponent) {
|
|
2080
2096
|
const dispose = listen$(ctx, "headerSize", (size) => {
|
|
2081
2097
|
if (size > 0) {
|
|
2082
|
-
scrollToIndex({
|
|
2098
|
+
scrollToIndex({ ...initialScroll, animated: false });
|
|
2083
2099
|
dispose == null ? void 0 : dispose();
|
|
2084
2100
|
}
|
|
2085
2101
|
});
|
|
@@ -2099,7 +2115,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2099
2115
|
useEffect(() => {
|
|
2100
2116
|
set$(ctx, "extraData", extraData);
|
|
2101
2117
|
}, [extraData]);
|
|
2102
|
-
refState.current.renderItem =
|
|
2118
|
+
refState.current.renderItem = renderItem2;
|
|
2103
2119
|
useEffect(initalizeStateVars, [
|
|
2104
2120
|
memoizedLastItemKeys.join(","),
|
|
2105
2121
|
numColumnsProp,
|
|
@@ -2140,7 +2156,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2140
2156
|
}
|
|
2141
2157
|
set$(ctx, "numContainers", numContainers);
|
|
2142
2158
|
set$(ctx, "numContainersPooled", numContainers * initialContainerPoolRatio);
|
|
2143
|
-
if (
|
|
2159
|
+
if (initialScroll) {
|
|
2144
2160
|
requestAnimationFrame(() => {
|
|
2145
2161
|
calculateItemsInView(
|
|
2146
2162
|
/*isReset*/
|
|
@@ -2548,5 +2564,17 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2548
2564
|
}
|
|
2549
2565
|
), __DEV__ && ENABLE_DEBUG_VIEW && /* @__PURE__ */ React2.createElement(DebugView, { state: refState.current }));
|
|
2550
2566
|
});
|
|
2567
|
+
var typedForwardRef2 = forwardRef;
|
|
2568
|
+
var renderItem = ({ item }) => item;
|
|
2569
|
+
var LazyLegendList = typedForwardRef2(function LazyLegendList2(props, forwardedRef) {
|
|
2570
|
+
const { LegendList: LegendListProp, children, ...rest } = props;
|
|
2571
|
+
const LegendListComponent = LegendListProp != null ? LegendListProp : LegendList$1;
|
|
2572
|
+
const data = (isArray(children) ? children : React2.Children.toArray(children)).flat(1);
|
|
2573
|
+
console.log({ data });
|
|
2574
|
+
return (
|
|
2575
|
+
// @ts-expect-error TODO: Fix this type
|
|
2576
|
+
/* @__PURE__ */ React2.createElement(LegendListComponent, { ...rest, data, renderItem, ref: forwardedRef })
|
|
2577
|
+
);
|
|
2578
|
+
});
|
|
2551
2579
|
|
|
2552
|
-
export { LegendList, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
|
2580
|
+
export { LazyLegendList, LegendList, useIsLastItem, useListScrollSize, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
|
@@ -4,17 +4,25 @@ import { LegendListRef } from '@legendapp/list';
|
|
|
4
4
|
import * as react_native from 'react-native';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
|
|
7
|
-
declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
7
|
+
declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
8
8
|
alignItemsAtEnd?: boolean;
|
|
9
9
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
10
10
|
data: readonly T[];
|
|
11
11
|
drawDistance?: number;
|
|
12
12
|
estimatedItemSize?: number;
|
|
13
|
+
estimatedListSize?: {
|
|
14
|
+
height: number;
|
|
15
|
+
width: number;
|
|
16
|
+
};
|
|
13
17
|
extraData?: any;
|
|
14
18
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
15
19
|
initialContainerPoolRatio?: number | undefined;
|
|
16
20
|
initialScrollOffset?: number;
|
|
17
|
-
initialScrollIndex?: number
|
|
21
|
+
initialScrollIndex?: number | {
|
|
22
|
+
index: number;
|
|
23
|
+
viewOffset?: number | undefined;
|
|
24
|
+
viewPosition?: number | undefined;
|
|
25
|
+
};
|
|
18
26
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
19
27
|
leadingItem: T;
|
|
20
28
|
}> | undefined;
|
|
@@ -58,17 +66,25 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
58
66
|
onLoad?: (info: {
|
|
59
67
|
elapsedTimeInMs: number;
|
|
60
68
|
}) => void;
|
|
61
|
-
} & React.RefAttributes<LegendListRef>) => React.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
69
|
+
} & React.RefAttributes<LegendListRef>) => React.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
62
70
|
alignItemsAtEnd?: boolean;
|
|
63
71
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
64
72
|
data: readonly T[];
|
|
65
73
|
drawDistance?: number;
|
|
66
74
|
estimatedItemSize?: number;
|
|
75
|
+
estimatedListSize?: {
|
|
76
|
+
height: number;
|
|
77
|
+
width: number;
|
|
78
|
+
};
|
|
67
79
|
extraData?: any;
|
|
68
80
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
69
81
|
initialContainerPoolRatio?: number | undefined;
|
|
70
82
|
initialScrollOffset?: number;
|
|
71
|
-
initialScrollIndex?: number
|
|
83
|
+
initialScrollIndex?: number | {
|
|
84
|
+
index: number;
|
|
85
|
+
viewOffset?: number | undefined;
|
|
86
|
+
viewPosition?: number | undefined;
|
|
87
|
+
};
|
|
72
88
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
73
89
|
leadingItem: T;
|
|
74
90
|
}> | undefined;
|
|
@@ -114,17 +130,25 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
114
130
|
}) => void;
|
|
115
131
|
} & React.RefAttributes<LegendListRef>) => React.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
|
|
116
132
|
ref?: React.Ref<LegendListRef>;
|
|
117
|
-
}) => React.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
133
|
+
}) => React.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
118
134
|
alignItemsAtEnd?: boolean;
|
|
119
135
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
120
136
|
data: readonly T[];
|
|
121
137
|
drawDistance?: number;
|
|
122
138
|
estimatedItemSize?: number;
|
|
139
|
+
estimatedListSize?: {
|
|
140
|
+
height: number;
|
|
141
|
+
width: number;
|
|
142
|
+
};
|
|
123
143
|
extraData?: any;
|
|
124
144
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
125
145
|
initialContainerPoolRatio?: number | undefined;
|
|
126
146
|
initialScrollOffset?: number;
|
|
127
|
-
initialScrollIndex?: number
|
|
147
|
+
initialScrollIndex?: number | {
|
|
148
|
+
index: number;
|
|
149
|
+
viewOffset?: number | undefined;
|
|
150
|
+
viewPosition?: number | undefined;
|
|
151
|
+
};
|
|
128
152
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
129
153
|
leadingItem: T;
|
|
130
154
|
}> | undefined;
|
|
@@ -168,17 +192,25 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
168
192
|
onLoad?: (info: {
|
|
169
193
|
elapsedTimeInMs: number;
|
|
170
194
|
}) => void;
|
|
171
|
-
} & React.RefAttributes<LegendListRef>) => React.ReactNode>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
195
|
+
} & React.RefAttributes<LegendListRef>) => React.ReactNode>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
172
196
|
alignItemsAtEnd?: boolean;
|
|
173
197
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
174
198
|
data: readonly ItemT[];
|
|
175
199
|
drawDistance?: number;
|
|
176
200
|
estimatedItemSize?: number;
|
|
201
|
+
estimatedListSize?: {
|
|
202
|
+
height: number;
|
|
203
|
+
width: number;
|
|
204
|
+
};
|
|
177
205
|
extraData?: any;
|
|
178
206
|
getEstimatedItemSize?: ((index: number, item: ItemT) => number) | undefined;
|
|
179
207
|
initialContainerPoolRatio?: number | undefined;
|
|
180
208
|
initialScrollOffset?: number;
|
|
181
|
-
initialScrollIndex?: number
|
|
209
|
+
initialScrollIndex?: number | {
|
|
210
|
+
index: number;
|
|
211
|
+
viewOffset?: number | undefined;
|
|
212
|
+
viewPosition?: number | undefined;
|
|
213
|
+
};
|
|
182
214
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
183
215
|
leadingItem: ItemT;
|
|
184
216
|
}> | undefined;
|
package/keyboard-controller.d.ts
CHANGED
|
@@ -4,17 +4,25 @@ import { LegendListRef } from '@legendapp/list';
|
|
|
4
4
|
import * as react_native from 'react-native';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
|
|
7
|
-
declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
7
|
+
declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
8
8
|
alignItemsAtEnd?: boolean;
|
|
9
9
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
10
10
|
data: readonly T[];
|
|
11
11
|
drawDistance?: number;
|
|
12
12
|
estimatedItemSize?: number;
|
|
13
|
+
estimatedListSize?: {
|
|
14
|
+
height: number;
|
|
15
|
+
width: number;
|
|
16
|
+
};
|
|
13
17
|
extraData?: any;
|
|
14
18
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
15
19
|
initialContainerPoolRatio?: number | undefined;
|
|
16
20
|
initialScrollOffset?: number;
|
|
17
|
-
initialScrollIndex?: number
|
|
21
|
+
initialScrollIndex?: number | {
|
|
22
|
+
index: number;
|
|
23
|
+
viewOffset?: number | undefined;
|
|
24
|
+
viewPosition?: number | undefined;
|
|
25
|
+
};
|
|
18
26
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
19
27
|
leadingItem: T;
|
|
20
28
|
}> | undefined;
|
|
@@ -58,17 +66,25 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
58
66
|
onLoad?: (info: {
|
|
59
67
|
elapsedTimeInMs: number;
|
|
60
68
|
}) => void;
|
|
61
|
-
} & React.RefAttributes<LegendListRef>) => React.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
69
|
+
} & React.RefAttributes<LegendListRef>) => React.ReactNode) | react_native.Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
62
70
|
alignItemsAtEnd?: boolean;
|
|
63
71
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
64
72
|
data: readonly T[];
|
|
65
73
|
drawDistance?: number;
|
|
66
74
|
estimatedItemSize?: number;
|
|
75
|
+
estimatedListSize?: {
|
|
76
|
+
height: number;
|
|
77
|
+
width: number;
|
|
78
|
+
};
|
|
67
79
|
extraData?: any;
|
|
68
80
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
69
81
|
initialContainerPoolRatio?: number | undefined;
|
|
70
82
|
initialScrollOffset?: number;
|
|
71
|
-
initialScrollIndex?: number
|
|
83
|
+
initialScrollIndex?: number | {
|
|
84
|
+
index: number;
|
|
85
|
+
viewOffset?: number | undefined;
|
|
86
|
+
viewPosition?: number | undefined;
|
|
87
|
+
};
|
|
72
88
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
73
89
|
leadingItem: T;
|
|
74
90
|
}> | undefined;
|
|
@@ -114,17 +130,25 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
114
130
|
}) => void;
|
|
115
131
|
} & React.RefAttributes<LegendListRef>) => React.ReactNode)> | (<ItemT_1>(props: _legendapp_list_reanimated.AnimatedLegendListProps<ItemT_1> & {
|
|
116
132
|
ref?: React.Ref<LegendListRef>;
|
|
117
|
-
}) => React.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
133
|
+
}) => React.ReactElement | null) = <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
118
134
|
alignItemsAtEnd?: boolean;
|
|
119
135
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
120
136
|
data: readonly T[];
|
|
121
137
|
drawDistance?: number;
|
|
122
138
|
estimatedItemSize?: number;
|
|
139
|
+
estimatedListSize?: {
|
|
140
|
+
height: number;
|
|
141
|
+
width: number;
|
|
142
|
+
};
|
|
123
143
|
extraData?: any;
|
|
124
144
|
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
125
145
|
initialContainerPoolRatio?: number | undefined;
|
|
126
146
|
initialScrollOffset?: number;
|
|
127
|
-
initialScrollIndex?: number
|
|
147
|
+
initialScrollIndex?: number | {
|
|
148
|
+
index: number;
|
|
149
|
+
viewOffset?: number | undefined;
|
|
150
|
+
viewPosition?: number | undefined;
|
|
151
|
+
};
|
|
128
152
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
129
153
|
leadingItem: T;
|
|
130
154
|
}> | undefined;
|
|
@@ -168,17 +192,25 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
168
192
|
onLoad?: (info: {
|
|
169
193
|
elapsedTimeInMs: number;
|
|
170
194
|
}) => void;
|
|
171
|
-
} & React.RefAttributes<LegendListRef>) => React.ReactNode>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
195
|
+
} & React.RefAttributes<LegendListRef>) => React.ReactNode>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children"> & {
|
|
172
196
|
alignItemsAtEnd?: boolean;
|
|
173
197
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
174
198
|
data: readonly ItemT[];
|
|
175
199
|
drawDistance?: number;
|
|
176
200
|
estimatedItemSize?: number;
|
|
201
|
+
estimatedListSize?: {
|
|
202
|
+
height: number;
|
|
203
|
+
width: number;
|
|
204
|
+
};
|
|
177
205
|
extraData?: any;
|
|
178
206
|
getEstimatedItemSize?: ((index: number, item: ItemT) => number) | undefined;
|
|
179
207
|
initialContainerPoolRatio?: number | undefined;
|
|
180
208
|
initialScrollOffset?: number;
|
|
181
|
-
initialScrollIndex?: number
|
|
209
|
+
initialScrollIndex?: number | {
|
|
210
|
+
index: number;
|
|
211
|
+
viewOffset?: number | undefined;
|
|
212
|
+
viewPosition?: number | undefined;
|
|
213
|
+
};
|
|
182
214
|
ItemSeparatorComponent?: React.ComponentType<{
|
|
183
215
|
leadingItem: ItemT;
|
|
184
216
|
}> | undefined;
|
package/package.json
CHANGED