@legendapp/list 1.0.0-beta.2 → 1.0.0-beta.20
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/animated.d.mts +52 -4
- package/animated.d.ts +52 -4
- package/index.d.mts +92 -15
- package/index.d.ts +92 -15
- package/index.js +792 -389
- package/index.mjs +775 -376
- package/package.json +3 -6
- package/reanimated.d.mts +5 -2
- package/reanimated.d.ts +5 -2
- package/reanimated.js +20 -16
- package/reanimated.mjs +21 -17
package/animated.d.mts
CHANGED
|
@@ -1,9 +1,57 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import * as _legendapp_list from '@legendapp/list';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
3
4
|
import { Animated } from 'react-native';
|
|
4
5
|
|
|
5
|
-
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props:
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
7
|
+
data: readonly T[];
|
|
8
|
+
initialScrollOffset?: number;
|
|
9
|
+
initialScrollIndex?: number;
|
|
10
|
+
drawDistance?: number;
|
|
11
|
+
recycleItems?: boolean;
|
|
12
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
13
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
14
|
+
maintainScrollAtEnd?: boolean;
|
|
15
|
+
maintainScrollAtEndThreshold?: number;
|
|
16
|
+
alignItemsAtEnd?: boolean;
|
|
17
|
+
maintainVisibleContentPosition?: boolean;
|
|
18
|
+
numColumns?: number;
|
|
19
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
20
|
+
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
21
|
+
waitForInitialLayout?: boolean;
|
|
22
|
+
estimatedItemSize?: number;
|
|
23
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
24
|
+
onStartReached?: ((info: {
|
|
25
|
+
distanceFromStart: number;
|
|
26
|
+
}) => void) | null | undefined;
|
|
27
|
+
onEndReached?: ((info: {
|
|
28
|
+
distanceFromEnd: number;
|
|
29
|
+
}) => void) | null | undefined;
|
|
30
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
31
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
32
|
+
ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
33
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
34
|
+
ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
35
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
36
|
+
ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
37
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
38
|
+
leadingItem: T;
|
|
39
|
+
}> | undefined;
|
|
40
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
41
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
42
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
43
|
+
onItemSizeChanged?: ((info: {
|
|
44
|
+
size: number;
|
|
45
|
+
previous: number;
|
|
46
|
+
index: number;
|
|
47
|
+
itemKey: string;
|
|
48
|
+
itemData: T;
|
|
49
|
+
}) => void) | undefined;
|
|
50
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
51
|
+
extraData?: any;
|
|
52
|
+
refreshing?: boolean;
|
|
53
|
+
onRefresh?: () => void;
|
|
54
|
+
progressViewOffset?: number;
|
|
55
|
+
} & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode)>;
|
|
8
56
|
|
|
9
57
|
export { AnimatedLegendList };
|
package/animated.d.ts
CHANGED
|
@@ -1,9 +1,57 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
2
|
import * as _legendapp_list from '@legendapp/list';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
3
4
|
import { Animated } from 'react-native';
|
|
4
5
|
|
|
5
|
-
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props:
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
7
|
+
data: readonly T[];
|
|
8
|
+
initialScrollOffset?: number;
|
|
9
|
+
initialScrollIndex?: number;
|
|
10
|
+
drawDistance?: number;
|
|
11
|
+
recycleItems?: boolean;
|
|
12
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
13
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
14
|
+
maintainScrollAtEnd?: boolean;
|
|
15
|
+
maintainScrollAtEndThreshold?: number;
|
|
16
|
+
alignItemsAtEnd?: boolean;
|
|
17
|
+
maintainVisibleContentPosition?: boolean;
|
|
18
|
+
numColumns?: number;
|
|
19
|
+
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
20
|
+
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
21
|
+
waitForInitialLayout?: boolean;
|
|
22
|
+
estimatedItemSize?: number;
|
|
23
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
24
|
+
onStartReached?: ((info: {
|
|
25
|
+
distanceFromStart: number;
|
|
26
|
+
}) => void) | null | undefined;
|
|
27
|
+
onEndReached?: ((info: {
|
|
28
|
+
distanceFromEnd: number;
|
|
29
|
+
}) => void) | null | undefined;
|
|
30
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
31
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
32
|
+
ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
33
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
34
|
+
ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
35
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
36
|
+
ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
37
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
38
|
+
leadingItem: T;
|
|
39
|
+
}> | undefined;
|
|
40
|
+
viewabilityConfigCallbackPairs?: _legendapp_list.ViewabilityConfigCallbackPairs | undefined;
|
|
41
|
+
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
42
|
+
onViewableItemsChanged?: _legendapp_list.OnViewableItemsChanged | undefined;
|
|
43
|
+
onItemSizeChanged?: ((info: {
|
|
44
|
+
size: number;
|
|
45
|
+
previous: number;
|
|
46
|
+
index: number;
|
|
47
|
+
itemKey: string;
|
|
48
|
+
itemData: T;
|
|
49
|
+
}) => void) | undefined;
|
|
50
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
51
|
+
extraData?: any;
|
|
52
|
+
refreshing?: boolean;
|
|
53
|
+
onRefresh?: () => void;
|
|
54
|
+
progressViewOffset?: number;
|
|
55
|
+
} & React$1.RefAttributes<_legendapp_list.LegendListRef>) => React.ReactNode)>;
|
|
8
56
|
|
|
9
57
|
export { AnimatedLegendList };
|
package/index.d.mts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
2
4
|
import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
|
|
3
5
|
import Animated from 'react-native-reanimated';
|
|
4
6
|
|
|
5
7
|
declare class ScrollAdjustHandler {
|
|
6
8
|
private ctx;
|
|
7
9
|
private appliedAdjust;
|
|
8
|
-
private pendingAdjust;
|
|
9
10
|
private busy;
|
|
10
11
|
private context;
|
|
11
|
-
private
|
|
12
|
+
private isPaused;
|
|
12
13
|
constructor(ctx: any);
|
|
14
|
+
private doAjdust;
|
|
13
15
|
requestAdjust(adjust: number, onAdjusted: (diff: number) => void): void;
|
|
14
16
|
getAppliedAdjust(): number;
|
|
17
|
+
pauseAdjust(): void;
|
|
18
|
+
unPauseAdjust(): boolean;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView,
|
|
18
|
-
data:
|
|
21
|
+
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
22
|
+
data: ReadonlyArray<ItemT>;
|
|
19
23
|
initialScrollOffset?: number;
|
|
20
24
|
initialScrollIndex?: number;
|
|
21
25
|
drawDistance?: number;
|
|
@@ -27,6 +31,7 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
27
31
|
alignItemsAtEnd?: boolean;
|
|
28
32
|
maintainVisibleContentPosition?: boolean;
|
|
29
33
|
numColumns?: number;
|
|
34
|
+
columnWrapperStyle?: ColumnWrapperStyle;
|
|
30
35
|
refScrollView?: React.Ref<ScrollView>;
|
|
31
36
|
waitForInitialLayout?: boolean;
|
|
32
37
|
estimatedItemSize?: number;
|
|
@@ -44,8 +49,9 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
44
49
|
ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
45
50
|
ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
|
|
46
51
|
ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
ItemSeparatorComponent?: React.ComponentType<{
|
|
53
|
+
leadingItem: ItemT;
|
|
54
|
+
}>;
|
|
49
55
|
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
|
|
50
56
|
viewabilityConfig?: ViewabilityConfig;
|
|
51
57
|
onViewableItemsChanged?: OnViewableItemsChanged | undefined;
|
|
@@ -62,6 +68,19 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
62
68
|
*/
|
|
63
69
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
64
70
|
extraData?: any;
|
|
71
|
+
refreshing?: boolean;
|
|
72
|
+
onRefresh?: () => void;
|
|
73
|
+
progressViewOffset?: number;
|
|
74
|
+
};
|
|
75
|
+
interface ColumnWrapperStyle {
|
|
76
|
+
rowGap?: number;
|
|
77
|
+
gap?: number;
|
|
78
|
+
columnGap?: number;
|
|
79
|
+
}
|
|
80
|
+
type AnchoredPosition = {
|
|
81
|
+
type: "top" | "bottom";
|
|
82
|
+
relativeCoordinate: number;
|
|
83
|
+
top: number;
|
|
65
84
|
};
|
|
66
85
|
type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
|
|
67
86
|
interface InternalState {
|
|
@@ -76,13 +95,11 @@ interface InternalState {
|
|
|
76
95
|
sizes: Map<string, number>;
|
|
77
96
|
sizesLaidOut: Map<string, number> | undefined;
|
|
78
97
|
pendingAdjust: number;
|
|
79
|
-
animFrameLayout: any;
|
|
80
98
|
isStartReached: boolean;
|
|
81
99
|
isEndReached: boolean;
|
|
82
100
|
isAtBottom: boolean;
|
|
83
101
|
isAtTop: boolean;
|
|
84
|
-
data: any[];
|
|
85
|
-
idsInFirstRender: Set<string>;
|
|
102
|
+
data: readonly any[];
|
|
86
103
|
hasScrolled: boolean;
|
|
87
104
|
scrollLength: number;
|
|
88
105
|
startBuffered: number;
|
|
@@ -110,12 +127,14 @@ interface InternalState {
|
|
|
110
127
|
}>;
|
|
111
128
|
scrollTimer: Timer | undefined;
|
|
112
129
|
startReachedBlockedByTimer: boolean;
|
|
113
|
-
|
|
130
|
+
endReachedBlockedByTimer: boolean;
|
|
114
131
|
scrollForNextCalculateItemsInView: {
|
|
115
132
|
top: number;
|
|
116
133
|
bottom: number;
|
|
117
134
|
} | undefined;
|
|
118
135
|
enableScrollForNextCalculateItemsInView: boolean;
|
|
136
|
+
minIndexSizeChanged: number | undefined;
|
|
137
|
+
numPendingInitialLayout: number;
|
|
119
138
|
}
|
|
120
139
|
interface ViewableRange<T> {
|
|
121
140
|
startBuffered: number;
|
|
@@ -227,9 +246,67 @@ interface LegendListRecyclingState<T> {
|
|
|
227
246
|
index: number;
|
|
228
247
|
prevIndex: number | undefined;
|
|
229
248
|
}
|
|
249
|
+
type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
|
|
250
|
+
declare const typedForwardRef: TypedForwardRef;
|
|
251
|
+
type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean) => T & {
|
|
252
|
+
displayName?: string;
|
|
253
|
+
};
|
|
254
|
+
declare const typedMemo: TypedMemo;
|
|
255
|
+
|
|
256
|
+
declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
257
|
+
data: readonly T[];
|
|
258
|
+
initialScrollOffset?: number;
|
|
259
|
+
initialScrollIndex?: number;
|
|
260
|
+
drawDistance?: number;
|
|
261
|
+
recycleItems?: boolean;
|
|
262
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
263
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
264
|
+
maintainScrollAtEnd?: boolean;
|
|
265
|
+
maintainScrollAtEndThreshold?: number;
|
|
266
|
+
alignItemsAtEnd?: boolean;
|
|
267
|
+
maintainVisibleContentPosition?: boolean;
|
|
268
|
+
numColumns?: number;
|
|
269
|
+
columnWrapperStyle?: ColumnWrapperStyle;
|
|
270
|
+
refScrollView?: React$1.Ref<ScrollView>;
|
|
271
|
+
waitForInitialLayout?: boolean;
|
|
272
|
+
estimatedItemSize?: number;
|
|
273
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
274
|
+
onStartReached?: ((info: {
|
|
275
|
+
distanceFromStart: number;
|
|
276
|
+
}) => void) | null | undefined;
|
|
277
|
+
onEndReached?: ((info: {
|
|
278
|
+
distanceFromEnd: number;
|
|
279
|
+
}) => void) | null | undefined;
|
|
280
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
281
|
+
renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
282
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
283
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
284
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
285
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
286
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
287
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
288
|
+
leadingItem: T;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
|
|
291
|
+
viewabilityConfig?: ViewabilityConfig;
|
|
292
|
+
onViewableItemsChanged?: OnViewableItemsChanged | undefined;
|
|
293
|
+
onItemSizeChanged?: ((info: {
|
|
294
|
+
size: number;
|
|
295
|
+
previous: number;
|
|
296
|
+
index: number;
|
|
297
|
+
itemKey: string;
|
|
298
|
+
itemData: T;
|
|
299
|
+
}) => void) | undefined;
|
|
300
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
301
|
+
extraData?: any;
|
|
302
|
+
refreshing?: boolean;
|
|
303
|
+
onRefresh?: () => void;
|
|
304
|
+
progressViewOffset?: number;
|
|
305
|
+
} & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
|
|
230
306
|
|
|
231
|
-
declare
|
|
232
|
-
|
|
233
|
-
|
|
307
|
+
declare function useViewability(configId: string, callback: ViewabilityCallback): void;
|
|
308
|
+
declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
|
|
309
|
+
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
310
|
+
declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, React$1.Dispatch<any>];
|
|
234
311
|
|
|
235
|
-
export { type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange };
|
|
312
|
+
export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
package/index.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
2
4
|
import { ScrollView, StyleProp, ViewStyle, ScrollViewProps, ScrollViewComponent, ScrollResponderMixin } from 'react-native';
|
|
3
5
|
import Animated from 'react-native-reanimated';
|
|
4
6
|
|
|
5
7
|
declare class ScrollAdjustHandler {
|
|
6
8
|
private ctx;
|
|
7
9
|
private appliedAdjust;
|
|
8
|
-
private pendingAdjust;
|
|
9
10
|
private busy;
|
|
10
11
|
private context;
|
|
11
|
-
private
|
|
12
|
+
private isPaused;
|
|
12
13
|
constructor(ctx: any);
|
|
14
|
+
private doAjdust;
|
|
13
15
|
requestAdjust(adjust: number, onAdjusted: (diff: number) => void): void;
|
|
14
16
|
getAppliedAdjust(): number;
|
|
17
|
+
pauseAdjust(): void;
|
|
18
|
+
unPauseAdjust(): boolean;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView,
|
|
18
|
-
data:
|
|
21
|
+
type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof ScrollView> | ComponentProps<typeof Animated.ScrollView>> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
22
|
+
data: ReadonlyArray<ItemT>;
|
|
19
23
|
initialScrollOffset?: number;
|
|
20
24
|
initialScrollIndex?: number;
|
|
21
25
|
drawDistance?: number;
|
|
@@ -27,6 +31,7 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
27
31
|
alignItemsAtEnd?: boolean;
|
|
28
32
|
maintainVisibleContentPosition?: boolean;
|
|
29
33
|
numColumns?: number;
|
|
34
|
+
columnWrapperStyle?: ColumnWrapperStyle;
|
|
30
35
|
refScrollView?: React.Ref<ScrollView>;
|
|
31
36
|
waitForInitialLayout?: boolean;
|
|
32
37
|
estimatedItemSize?: number;
|
|
@@ -44,8 +49,9 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
44
49
|
ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
45
50
|
ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
|
|
46
51
|
ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
ItemSeparatorComponent?: React.ComponentType<{
|
|
53
|
+
leadingItem: ItemT;
|
|
54
|
+
}>;
|
|
49
55
|
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
|
|
50
56
|
viewabilityConfig?: ViewabilityConfig;
|
|
51
57
|
onViewableItemsChanged?: OnViewableItemsChanged | undefined;
|
|
@@ -62,6 +68,19 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
62
68
|
*/
|
|
63
69
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
64
70
|
extraData?: any;
|
|
71
|
+
refreshing?: boolean;
|
|
72
|
+
onRefresh?: () => void;
|
|
73
|
+
progressViewOffset?: number;
|
|
74
|
+
};
|
|
75
|
+
interface ColumnWrapperStyle {
|
|
76
|
+
rowGap?: number;
|
|
77
|
+
gap?: number;
|
|
78
|
+
columnGap?: number;
|
|
79
|
+
}
|
|
80
|
+
type AnchoredPosition = {
|
|
81
|
+
type: "top" | "bottom";
|
|
82
|
+
relativeCoordinate: number;
|
|
83
|
+
top: number;
|
|
65
84
|
};
|
|
66
85
|
type LegendListProps<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof ScrollView>>;
|
|
67
86
|
interface InternalState {
|
|
@@ -76,13 +95,11 @@ interface InternalState {
|
|
|
76
95
|
sizes: Map<string, number>;
|
|
77
96
|
sizesLaidOut: Map<string, number> | undefined;
|
|
78
97
|
pendingAdjust: number;
|
|
79
|
-
animFrameLayout: any;
|
|
80
98
|
isStartReached: boolean;
|
|
81
99
|
isEndReached: boolean;
|
|
82
100
|
isAtBottom: boolean;
|
|
83
101
|
isAtTop: boolean;
|
|
84
|
-
data: any[];
|
|
85
|
-
idsInFirstRender: Set<string>;
|
|
102
|
+
data: readonly any[];
|
|
86
103
|
hasScrolled: boolean;
|
|
87
104
|
scrollLength: number;
|
|
88
105
|
startBuffered: number;
|
|
@@ -110,12 +127,14 @@ interface InternalState {
|
|
|
110
127
|
}>;
|
|
111
128
|
scrollTimer: Timer | undefined;
|
|
112
129
|
startReachedBlockedByTimer: boolean;
|
|
113
|
-
|
|
130
|
+
endReachedBlockedByTimer: boolean;
|
|
114
131
|
scrollForNextCalculateItemsInView: {
|
|
115
132
|
top: number;
|
|
116
133
|
bottom: number;
|
|
117
134
|
} | undefined;
|
|
118
135
|
enableScrollForNextCalculateItemsInView: boolean;
|
|
136
|
+
minIndexSizeChanged: number | undefined;
|
|
137
|
+
numPendingInitialLayout: number;
|
|
119
138
|
}
|
|
120
139
|
interface ViewableRange<T> {
|
|
121
140
|
startBuffered: number;
|
|
@@ -227,9 +246,67 @@ interface LegendListRecyclingState<T> {
|
|
|
227
246
|
index: number;
|
|
228
247
|
prevIndex: number | undefined;
|
|
229
248
|
}
|
|
249
|
+
type TypedForwardRef = <T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactNode) => (props: P & React.RefAttributes<T>) => React.ReactNode;
|
|
250
|
+
declare const typedForwardRef: TypedForwardRef;
|
|
251
|
+
type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: (prevProps: Readonly<ComponentProps<T>>, nextProps: Readonly<ComponentProps<T>>) => boolean) => T & {
|
|
252
|
+
displayName?: string;
|
|
253
|
+
};
|
|
254
|
+
declare const typedMemo: TypedMemo;
|
|
255
|
+
|
|
256
|
+
declare const LegendList: <T>(props: Omit<react_native.ScrollViewProps, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices"> & {
|
|
257
|
+
data: readonly T[];
|
|
258
|
+
initialScrollOffset?: number;
|
|
259
|
+
initialScrollIndex?: number;
|
|
260
|
+
drawDistance?: number;
|
|
261
|
+
recycleItems?: boolean;
|
|
262
|
+
onEndReachedThreshold?: number | null | undefined;
|
|
263
|
+
onStartReachedThreshold?: number | null | undefined;
|
|
264
|
+
maintainScrollAtEnd?: boolean;
|
|
265
|
+
maintainScrollAtEndThreshold?: number;
|
|
266
|
+
alignItemsAtEnd?: boolean;
|
|
267
|
+
maintainVisibleContentPosition?: boolean;
|
|
268
|
+
numColumns?: number;
|
|
269
|
+
columnWrapperStyle?: ColumnWrapperStyle;
|
|
270
|
+
refScrollView?: React$1.Ref<ScrollView>;
|
|
271
|
+
waitForInitialLayout?: boolean;
|
|
272
|
+
estimatedItemSize?: number;
|
|
273
|
+
getEstimatedItemSize?: ((index: number, item: T) => number) | undefined;
|
|
274
|
+
onStartReached?: ((info: {
|
|
275
|
+
distanceFromStart: number;
|
|
276
|
+
}) => void) | null | undefined;
|
|
277
|
+
onEndReached?: ((info: {
|
|
278
|
+
distanceFromEnd: number;
|
|
279
|
+
}) => void) | null | undefined;
|
|
280
|
+
keyExtractor?: ((item: T, index: number) => string) | undefined;
|
|
281
|
+
renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
282
|
+
ListHeaderComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
283
|
+
ListHeaderComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
284
|
+
ListFooterComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
285
|
+
ListFooterComponentStyle?: react_native.StyleProp<react_native.ViewStyle> | undefined;
|
|
286
|
+
ListEmptyComponent?: React$1.ComponentType<any> | React$1.ReactElement | null | undefined;
|
|
287
|
+
ItemSeparatorComponent?: React$1.ComponentType<{
|
|
288
|
+
leadingItem: T;
|
|
289
|
+
}> | undefined;
|
|
290
|
+
viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
|
|
291
|
+
viewabilityConfig?: ViewabilityConfig;
|
|
292
|
+
onViewableItemsChanged?: OnViewableItemsChanged | undefined;
|
|
293
|
+
onItemSizeChanged?: ((info: {
|
|
294
|
+
size: number;
|
|
295
|
+
previous: number;
|
|
296
|
+
index: number;
|
|
297
|
+
itemKey: string;
|
|
298
|
+
itemData: T;
|
|
299
|
+
}) => void) | undefined;
|
|
300
|
+
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
301
|
+
extraData?: any;
|
|
302
|
+
refreshing?: boolean;
|
|
303
|
+
onRefresh?: () => void;
|
|
304
|
+
progressViewOffset?: number;
|
|
305
|
+
} & React$1.RefAttributes<LegendListRef>) => React$1.ReactNode;
|
|
230
306
|
|
|
231
|
-
declare
|
|
232
|
-
|
|
233
|
-
|
|
307
|
+
declare function useViewability(configId: string, callback: ViewabilityCallback): void;
|
|
308
|
+
declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
|
|
309
|
+
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
310
|
+
declare function useRecyclingState(valueOrFun: ((info: LegendListRecyclingState<unknown>) => any) | any): [any, React$1.Dispatch<any>];
|
|
234
311
|
|
|
235
|
-
export { type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange };
|
|
312
|
+
export { type AnchoredPosition, type ColumnWrapperStyle, type InternalState, LegendList, type LegendListProps, type LegendListPropsBase, type LegendListRecyclingState, type LegendListRef, type LegendListRenderItemProps, type OnViewableItemsChanged, type TypedForwardRef, type TypedMemo, type ViewAmountToken, type ViewToken, type ViewabilityAmountCallback, type ViewabilityCallback, type ViewabilityConfig, type ViewabilityConfigCallbackPair, type ViewabilityConfigCallbackPairs, type ViewableRange, typedForwardRef, typedMemo, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|