@legendapp/list 2.0.0-beta.2 → 2.0.0-beta.4
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/index.d.mts +10 -11
- package/index.d.ts +10 -11
- package/index.js +163 -690
- package/index.mjs +164 -691
- package/package.json +1 -1
- package/.DS_Store +0 -0
package/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
3
|
-
import { View, Animated, ScrollView, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin, StyleProp, ViewStyle, ScrollViewProps } from 'react-native';
|
|
3
|
+
import { View, Animated, ScrollView, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin, StyleProp, ViewStyle, NativeSyntheticEvent, NativeScrollEvent, ScrollViewProps } from 'react-native';
|
|
4
4
|
import Animated$1 from 'react-native-reanimated';
|
|
5
5
|
|
|
6
6
|
type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize";
|
|
@@ -30,9 +30,10 @@ declare class ScrollAdjustHandler {
|
|
|
30
30
|
constructor(ctx: StateContext);
|
|
31
31
|
requestAdjust(add: number): void;
|
|
32
32
|
setMounted(): void;
|
|
33
|
+
getAdjust(): number;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children">;
|
|
36
|
+
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
|
|
36
37
|
interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
37
38
|
/**
|
|
38
39
|
* Array of items to render in the list.
|
|
@@ -65,6 +66,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
65
66
|
* @default false
|
|
66
67
|
*/
|
|
67
68
|
alignItemsAtEnd?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* If true, enables using average sizes for performance optimization.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
enableAverages?: boolean;
|
|
68
74
|
/**
|
|
69
75
|
* Style applied to each column's wrapper view.
|
|
70
76
|
*/
|
|
@@ -190,6 +196,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
190
196
|
* Function to call when the user pulls to refresh.
|
|
191
197
|
*/
|
|
192
198
|
onRefresh?: () => void;
|
|
199
|
+
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
193
200
|
/**
|
|
194
201
|
* Called when scrolling reaches the start within onStartReachedThreshold.
|
|
195
202
|
*/
|
|
@@ -282,7 +289,6 @@ interface InternalState {
|
|
|
282
289
|
sizesKnown: Map<string, number>;
|
|
283
290
|
containerItemKeys: Set<string>;
|
|
284
291
|
containerItemTypes: Map<number, string>;
|
|
285
|
-
pendingAdjust: number;
|
|
286
292
|
isStartReached: boolean;
|
|
287
293
|
isEndReached: boolean;
|
|
288
294
|
isAtEnd: boolean;
|
|
@@ -347,14 +353,6 @@ interface InternalState {
|
|
|
347
353
|
loadStartTime: number;
|
|
348
354
|
initialScroll: ScrollIndexWithOffset | undefined;
|
|
349
355
|
lastLayout: LayoutRectangle | undefined;
|
|
350
|
-
queuedItemSizeUpdates: {
|
|
351
|
-
itemKey: string;
|
|
352
|
-
sizeObj: {
|
|
353
|
-
width: number;
|
|
354
|
-
height: number;
|
|
355
|
-
};
|
|
356
|
-
}[];
|
|
357
|
-
queuedItemSizeUpdatesWaiting?: boolean;
|
|
358
356
|
timeoutSetPaddingTop?: any;
|
|
359
357
|
activeStickyIndex: number | undefined;
|
|
360
358
|
stickyContainers: Map<number, number>;
|
|
@@ -392,6 +390,7 @@ interface InternalState {
|
|
|
392
390
|
stickyIndicesSet: Set<number>;
|
|
393
391
|
stickyIndicesArr: number[];
|
|
394
392
|
itemsAreEqual: LegendListProps["itemsAreEqual"];
|
|
393
|
+
enableAverages: boolean;
|
|
395
394
|
};
|
|
396
395
|
}
|
|
397
396
|
interface ViewableRange<T> {
|
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ComponentProps, ReactNode, Dispatch, SetStateAction } from 'react';
|
|
3
|
-
import { View, Animated, ScrollView, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin, StyleProp, ViewStyle, ScrollViewProps } from 'react-native';
|
|
3
|
+
import { View, Animated, ScrollView, LayoutRectangle, ScrollViewComponent, ScrollResponderMixin, StyleProp, ViewStyle, NativeSyntheticEvent, NativeScrollEvent, ScrollViewProps } from 'react-native';
|
|
4
4
|
import Animated$1 from 'react-native-reanimated';
|
|
5
5
|
|
|
6
6
|
type ListenerType = "numContainers" | "numContainersPooled" | `containerItemKey${number}` | `containerItemData${number}` | `containerPosition${number}` | `containerColumn${number}` | `containerSticky${number}` | `containerStickyOffset${number}` | "containersDidLayout" | "extraData" | "numColumns" | "lastItemKeys" | "totalSize" | "alignItemsPaddingTop" | "stylePaddingTop" | "scrollAdjust" | "scrollAdjustUserOffset" | "headerSize" | "footerSize" | "maintainVisibleContentPosition" | "debugRawScroll" | "debugComputedScroll" | "otherAxisSize" | "snapToOffsets" | "scrollSize";
|
|
@@ -30,9 +30,10 @@ declare class ScrollAdjustHandler {
|
|
|
30
30
|
constructor(ctx: StateContext);
|
|
31
31
|
requestAdjust(add: number): void;
|
|
32
32
|
setMounted(): void;
|
|
33
|
+
getAdjust(): number;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children">;
|
|
36
|
+
type BaseScrollViewProps<TScrollView> = Omit<TScrollView, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews" | "children" | "onScroll">;
|
|
36
37
|
interface DataModeProps<ItemT, TItemType extends string | undefined> {
|
|
37
38
|
/**
|
|
38
39
|
* Array of items to render in the list.
|
|
@@ -65,6 +66,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
65
66
|
* @default false
|
|
66
67
|
*/
|
|
67
68
|
alignItemsAtEnd?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* If true, enables using average sizes for performance optimization.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
enableAverages?: boolean;
|
|
68
74
|
/**
|
|
69
75
|
* Style applied to each column's wrapper view.
|
|
70
76
|
*/
|
|
@@ -190,6 +196,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
190
196
|
* Function to call when the user pulls to refresh.
|
|
191
197
|
*/
|
|
192
198
|
onRefresh?: () => void;
|
|
199
|
+
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
193
200
|
/**
|
|
194
201
|
* Called when scrolling reaches the start within onStartReachedThreshold.
|
|
195
202
|
*/
|
|
@@ -282,7 +289,6 @@ interface InternalState {
|
|
|
282
289
|
sizesKnown: Map<string, number>;
|
|
283
290
|
containerItemKeys: Set<string>;
|
|
284
291
|
containerItemTypes: Map<number, string>;
|
|
285
|
-
pendingAdjust: number;
|
|
286
292
|
isStartReached: boolean;
|
|
287
293
|
isEndReached: boolean;
|
|
288
294
|
isAtEnd: boolean;
|
|
@@ -347,14 +353,6 @@ interface InternalState {
|
|
|
347
353
|
loadStartTime: number;
|
|
348
354
|
initialScroll: ScrollIndexWithOffset | undefined;
|
|
349
355
|
lastLayout: LayoutRectangle | undefined;
|
|
350
|
-
queuedItemSizeUpdates: {
|
|
351
|
-
itemKey: string;
|
|
352
|
-
sizeObj: {
|
|
353
|
-
width: number;
|
|
354
|
-
height: number;
|
|
355
|
-
};
|
|
356
|
-
}[];
|
|
357
|
-
queuedItemSizeUpdatesWaiting?: boolean;
|
|
358
356
|
timeoutSetPaddingTop?: any;
|
|
359
357
|
activeStickyIndex: number | undefined;
|
|
360
358
|
stickyContainers: Map<number, number>;
|
|
@@ -392,6 +390,7 @@ interface InternalState {
|
|
|
392
390
|
stickyIndicesSet: Set<number>;
|
|
393
391
|
stickyIndicesArr: number[];
|
|
394
392
|
itemsAreEqual: LegendListProps["itemsAreEqual"];
|
|
393
|
+
enableAverages: boolean;
|
|
395
394
|
};
|
|
396
395
|
}
|
|
397
396
|
interface ViewableRange<T> {
|