@legendapp/list 1.0.15 → 1.0.17
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 +26 -0
- package/animated.d.mts +2 -2
- package/animated.d.ts +2 -2
- package/index.d.mts +18 -9
- package/index.d.ts +18 -9
- package/index.js +89 -67
- package/index.mjs +89 -67
- package/keyboard-controller.d.mts +5 -5
- package/keyboard-controller.d.ts +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## 1.0.17
|
|
2
|
+
- Fix: initialScrollIndex not taking header component size into account
|
|
3
|
+
- Fix: PaddingAndAdjust for ListHeaderComponent
|
|
4
|
+
- Fix: ignore alignItemsAtEnd when the list is empty
|
|
5
|
+
|
|
6
|
+
## 1.0.16
|
|
7
|
+
- Fix: isAtEnd was going to false when overscrolling
|
|
8
|
+
- Fix: refreshControl not being top padded correctly
|
|
9
|
+
- Fix: type of useLastItem hook
|
|
10
|
+
- Fix: header component was not displaying if a list had no data
|
|
11
|
+
- Fix: scrollToIndex logic that fixes scroll after items layout was not using viewPosition/viewOffset
|
|
12
|
+
- Fix: Improve scrollToIndex accuracy
|
|
13
|
+
- Fix: Improve scrollToEnd accuracy
|
|
14
|
+
|
|
15
|
+
## 1.0.15
|
|
16
|
+
- Feat: Add a useIsLastItem hook
|
|
17
|
+
- Feat: Support horizontal lists without an intrinsic height, it takes the maximum height of list items
|
|
18
|
+
- Feat: Add onLoad prop
|
|
19
|
+
- Fix: maintainVisibleContentPosition not working on horizontal lists
|
|
20
|
+
- Perf: scrollForNextCalculateItemsInView was not taking drawDistance into account correctly
|
|
21
|
+
- Perf: Improved the algorithm for allocating containers to items
|
|
22
|
+
- Perf: Use useLayoutEffect in LegendList if available to get the outer ScrollView layout as soon as possible
|
|
23
|
+
|
|
24
|
+
## 1.0.14
|
|
25
|
+
- Fix: A container changing size while inactive but not yet recycled could potentially overlap with elements onscreen if large enough
|
|
26
|
+
|
|
1
27
|
## 1.0.13
|
|
2
28
|
- Fix: Missing React import in ListHeaderComponentContainer crashing some environments
|
|
3
29
|
- Fix: `initialScrollIndex` was off by padding if using "padding" or "paddingVertical" props
|
package/animated.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ 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">, "
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
7
7
|
alignItemsAtEnd?: boolean;
|
|
8
8
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
9
9
|
data: readonly T[];
|
|
@@ -48,7 +48,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
|
|
|
48
48
|
recycleItems?: boolean;
|
|
49
49
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
50
50
|
refreshing?: boolean;
|
|
51
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
51
|
+
renderItem?: React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
52
52
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
53
53
|
suggestEstimatedItemSize?: boolean;
|
|
54
54
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
package/animated.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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">, "
|
|
6
|
+
declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
7
7
|
alignItemsAtEnd?: boolean;
|
|
8
8
|
columnWrapperStyle?: _legendapp_list.ColumnWrapperStyle;
|
|
9
9
|
data: readonly T[];
|
|
@@ -48,7 +48,7 @@ declare const AnimatedLegendList: Animated.AnimatedComponent<(<T>(props: Omit<Om
|
|
|
48
48
|
recycleItems?: boolean;
|
|
49
49
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
50
50
|
refreshing?: boolean;
|
|
51
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
51
|
+
renderItem?: React$1.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | ((props: _legendapp_list.LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
52
52
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
53
53
|
suggestEstimatedItemSize?: boolean;
|
|
54
54
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
package/index.d.mts
CHANGED
|
@@ -180,10 +180,13 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
180
180
|
*/
|
|
181
181
|
refreshing?: boolean;
|
|
182
182
|
/**
|
|
183
|
-
* Function to render each item in the list.
|
|
183
|
+
* Function or React component to render each item in the list.
|
|
184
|
+
* Can be either:
|
|
185
|
+
* - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
|
|
186
|
+
* - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
|
|
184
187
|
* @required
|
|
185
188
|
*/
|
|
186
|
-
renderItem?: (props: LegendListRenderItemProps<ItemT>) => ReactNode
|
|
189
|
+
renderItem?: ((props: LegendListRenderItemProps<ItemT>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT>>;
|
|
187
190
|
/**
|
|
188
191
|
* Render custom ScrollView component.
|
|
189
192
|
* @default (props) => <ScrollView {...props} />
|
|
@@ -237,8 +240,8 @@ interface InternalState {
|
|
|
237
240
|
pendingAdjust: number;
|
|
238
241
|
isStartReached: boolean;
|
|
239
242
|
isEndReached: boolean;
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
isAtEnd: boolean;
|
|
244
|
+
isAtStart: boolean;
|
|
242
245
|
data: readonly any[];
|
|
243
246
|
hasScrolled?: boolean;
|
|
244
247
|
scrollLength: number;
|
|
@@ -262,7 +265,7 @@ interface InternalState {
|
|
|
262
265
|
nativeMarginTop: number;
|
|
263
266
|
indexByKey: Map<string, number>;
|
|
264
267
|
viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs | undefined;
|
|
265
|
-
renderItem: (props: LegendListRenderItemProps<any>) => ReactNode
|
|
268
|
+
renderItem: ((props: LegendListRenderItemProps<any>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<any>>;
|
|
266
269
|
scrollHistory: Array<{
|
|
267
270
|
scroll: number;
|
|
268
271
|
time: number;
|
|
@@ -281,7 +284,13 @@ interface InternalState {
|
|
|
281
284
|
lastBatchingAction: number;
|
|
282
285
|
ignoreScrollFromCalcTotal?: boolean;
|
|
283
286
|
disableScrollJumpsFrom?: number;
|
|
284
|
-
|
|
287
|
+
scrollingTo?: {
|
|
288
|
+
offset: number;
|
|
289
|
+
index?: number;
|
|
290
|
+
viewOffset?: number;
|
|
291
|
+
viewPosition?: number;
|
|
292
|
+
animated?: boolean;
|
|
293
|
+
} | undefined;
|
|
285
294
|
previousTotalSize?: number;
|
|
286
295
|
needsOtherAxisSize?: boolean;
|
|
287
296
|
averageSizes: Record<string, {
|
|
@@ -468,7 +477,7 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
|
|
|
468
477
|
};
|
|
469
478
|
declare const typedMemo: TypedMemo;
|
|
470
479
|
|
|
471
|
-
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "
|
|
480
|
+
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
472
481
|
alignItemsAtEnd?: boolean;
|
|
473
482
|
columnWrapperStyle?: ColumnWrapperStyle;
|
|
474
483
|
data: readonly T[];
|
|
@@ -513,7 +522,7 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
|
|
|
513
522
|
recycleItems?: boolean;
|
|
514
523
|
refScrollView?: React$1.Ref<ScrollView>;
|
|
515
524
|
refreshing?: boolean;
|
|
516
|
-
renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
525
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
517
526
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
518
527
|
suggestEstimatedItemSize?: boolean;
|
|
519
528
|
viewabilityConfig?: ViewabilityConfig;
|
|
@@ -528,6 +537,6 @@ declare function useViewability(callback: ViewabilityCallback, configId?: string
|
|
|
528
537
|
declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
|
|
529
538
|
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
530
539
|
declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT | null, Dispatch<SetStateAction<ItemT>>];
|
|
531
|
-
declare function useIsLastItem():
|
|
540
|
+
declare function useIsLastItem(): boolean;
|
|
532
541
|
|
|
533
542
|
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, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
package/index.d.ts
CHANGED
|
@@ -180,10 +180,13 @@ type LegendListPropsBase<ItemT, TScrollView extends ComponentProps<typeof Scroll
|
|
|
180
180
|
*/
|
|
181
181
|
refreshing?: boolean;
|
|
182
182
|
/**
|
|
183
|
-
* Function to render each item in the list.
|
|
183
|
+
* Function or React component to render each item in the list.
|
|
184
|
+
* Can be either:
|
|
185
|
+
* - A function: (props: LegendListRenderItemProps<ItemT>) => ReactNode
|
|
186
|
+
* - A React component: React.ComponentType<LegendListRenderItemProps<ItemT>>
|
|
184
187
|
* @required
|
|
185
188
|
*/
|
|
186
|
-
renderItem?: (props: LegendListRenderItemProps<ItemT>) => ReactNode
|
|
189
|
+
renderItem?: ((props: LegendListRenderItemProps<ItemT>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<ItemT>>;
|
|
187
190
|
/**
|
|
188
191
|
* Render custom ScrollView component.
|
|
189
192
|
* @default (props) => <ScrollView {...props} />
|
|
@@ -237,8 +240,8 @@ interface InternalState {
|
|
|
237
240
|
pendingAdjust: number;
|
|
238
241
|
isStartReached: boolean;
|
|
239
242
|
isEndReached: boolean;
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
isAtEnd: boolean;
|
|
244
|
+
isAtStart: boolean;
|
|
242
245
|
data: readonly any[];
|
|
243
246
|
hasScrolled?: boolean;
|
|
244
247
|
scrollLength: number;
|
|
@@ -262,7 +265,7 @@ interface InternalState {
|
|
|
262
265
|
nativeMarginTop: number;
|
|
263
266
|
indexByKey: Map<string, number>;
|
|
264
267
|
viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs | undefined;
|
|
265
|
-
renderItem: (props: LegendListRenderItemProps<any>) => ReactNode
|
|
268
|
+
renderItem: ((props: LegendListRenderItemProps<any>) => ReactNode) | React.ComponentType<LegendListRenderItemProps<any>>;
|
|
266
269
|
scrollHistory: Array<{
|
|
267
270
|
scroll: number;
|
|
268
271
|
time: number;
|
|
@@ -281,7 +284,13 @@ interface InternalState {
|
|
|
281
284
|
lastBatchingAction: number;
|
|
282
285
|
ignoreScrollFromCalcTotal?: boolean;
|
|
283
286
|
disableScrollJumpsFrom?: number;
|
|
284
|
-
|
|
287
|
+
scrollingTo?: {
|
|
288
|
+
offset: number;
|
|
289
|
+
index?: number;
|
|
290
|
+
viewOffset?: number;
|
|
291
|
+
viewPosition?: number;
|
|
292
|
+
animated?: boolean;
|
|
293
|
+
} | undefined;
|
|
285
294
|
previousTotalSize?: number;
|
|
286
295
|
needsOtherAxisSize?: boolean;
|
|
287
296
|
averageSizes: Record<string, {
|
|
@@ -468,7 +477,7 @@ type TypedMemo = <T extends React.ComponentType<any>>(Component: T, propsAreEqua
|
|
|
468
477
|
};
|
|
469
478
|
declare const typedMemo: TypedMemo;
|
|
470
479
|
|
|
471
|
-
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "
|
|
480
|
+
declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "scrollEventThrottle">, "contentOffset" | "contentInset" | "maintainVisibleContentPosition" | "stickyHeaderIndices" | "removeClippedSubviews"> & {
|
|
472
481
|
alignItemsAtEnd?: boolean;
|
|
473
482
|
columnWrapperStyle?: ColumnWrapperStyle;
|
|
474
483
|
data: readonly T[];
|
|
@@ -513,7 +522,7 @@ declare const LegendList: <T>(props: Omit<Omit<react_native.ScrollViewProps, "sc
|
|
|
513
522
|
recycleItems?: boolean;
|
|
514
523
|
refScrollView?: React$1.Ref<ScrollView>;
|
|
515
524
|
refreshing?: boolean;
|
|
516
|
-
renderItem?: ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
525
|
+
renderItem?: React$1.ComponentType<LegendListRenderItemProps<T>> | ((props: LegendListRenderItemProps<T>) => React$1.ReactNode) | undefined;
|
|
517
526
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React$1.ReactElement<react_native.ScrollViewProps>;
|
|
518
527
|
suggestEstimatedItemSize?: boolean;
|
|
519
528
|
viewabilityConfig?: ViewabilityConfig;
|
|
@@ -528,6 +537,6 @@ declare function useViewability(callback: ViewabilityCallback, configId?: string
|
|
|
528
537
|
declare function useViewabilityAmount(callback: ViewabilityAmountCallback): void;
|
|
529
538
|
declare function useRecyclingEffect(effect: (info: LegendListRecyclingState<unknown>) => void | (() => void)): void;
|
|
530
539
|
declare function useRecyclingState<ItemT>(valueOrFun: ((info: LegendListRecyclingState<ItemT>) => ItemT) | ItemT): readonly [ItemT | null, Dispatch<SetStateAction<ItemT>>];
|
|
531
|
-
declare function useIsLastItem():
|
|
540
|
+
declare function useIsLastItem(): boolean;
|
|
532
541
|
|
|
533
542
|
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, useRecyclingEffect, useRecyclingState, useViewability, useViewabilityAmount };
|
package/index.js
CHANGED
|
@@ -173,7 +173,7 @@ var DebugView = React2__namespace.memo(function DebugView2({ state }) {
|
|
|
173
173
|
},
|
|
174
174
|
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "TotalSize:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, totalSize.toFixed(2))),
|
|
175
175
|
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "ContentSize:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, contentSize.toFixed(2))),
|
|
176
|
-
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "At end:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, String(state.
|
|
176
|
+
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "At end:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, String(state.isAtEnd))),
|
|
177
177
|
/* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null),
|
|
178
178
|
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "ScrollAdjust:"), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, scrollAdjust.toFixed(2))),
|
|
179
179
|
/* @__PURE__ */ React2__namespace.createElement(DebugRow, null, /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, "TotalSizeReal: "), /* @__PURE__ */ React2__namespace.createElement(reactNative.Text, null, totalSizeWithScrollAdjust.toFixed(2))),
|
|
@@ -200,9 +200,6 @@ function warnDevOnce(id, text) {
|
|
|
200
200
|
console.warn(`[legend-list] ${text}`);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function roundSize(size) {
|
|
204
|
-
return Math.floor(size * 8) / 8;
|
|
205
|
-
}
|
|
206
203
|
function isNullOrUndefined(value) {
|
|
207
204
|
return value === null || value === void 0;
|
|
208
205
|
}
|
|
@@ -565,11 +562,14 @@ function ListHeaderComponentContainer({
|
|
|
565
562
|
horizontal,
|
|
566
563
|
waitForInitialLayout
|
|
567
564
|
}) {
|
|
568
|
-
|
|
565
|
+
var _a;
|
|
566
|
+
const hasData = ((_a = peek$(ctx, "lastItemKeys")) == null ? void 0 : _a.length) > 0;
|
|
567
|
+
const scrollAdjust = useValue$("scrollAdjust", (v) => v != null ? v : 0, true);
|
|
569
568
|
const animOpacity = waitForInitialLayout ? useValue$("containersDidLayout", (value) => value ? 1 : 0) : void 0;
|
|
570
569
|
const additionalSize = {
|
|
571
570
|
transform: [{ translateY: reactNative.Animated.multiply(scrollAdjust, -1) }],
|
|
572
|
-
|
|
571
|
+
// Header should show if there's no data yet, but containersDidLayout will be false until it has some data
|
|
572
|
+
opacity: hasData ? animOpacity : 1
|
|
573
573
|
};
|
|
574
574
|
return /* @__PURE__ */ React2__namespace.createElement(
|
|
575
575
|
reactNative.Animated.View,
|
|
@@ -666,9 +666,6 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
666
666
|
refScrollView,
|
|
667
667
|
maintainVisibleContentPosition,
|
|
668
668
|
renderScrollComponent,
|
|
669
|
-
onRefresh,
|
|
670
|
-
refreshing,
|
|
671
|
-
progressViewOffset,
|
|
672
669
|
...rest
|
|
673
670
|
}) {
|
|
674
671
|
const ctx = useStateContext();
|
|
@@ -694,7 +691,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
694
691
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
695
692
|
ref: refScrollView
|
|
696
693
|
},
|
|
697
|
-
|
|
694
|
+
ENABLE_DEVMODE ? /* @__PURE__ */ React2__namespace.createElement(PaddingAndAdjustDevMode, null) : /* @__PURE__ */ React2__namespace.createElement(PaddingAndAdjust, null),
|
|
698
695
|
ListHeaderComponent && /* @__PURE__ */ React2__namespace.createElement(
|
|
699
696
|
ListHeaderComponentContainer,
|
|
700
697
|
{
|
|
@@ -1024,6 +1021,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1024
1021
|
estimatedItemSize: estimatedItemSizeProp,
|
|
1025
1022
|
getEstimatedItemSize,
|
|
1026
1023
|
suggestEstimatedItemSize,
|
|
1024
|
+
ListHeaderComponent,
|
|
1027
1025
|
ListEmptyComponent,
|
|
1028
1026
|
onItemSizeChanged,
|
|
1029
1027
|
refScrollView,
|
|
@@ -1077,20 +1075,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1077
1075
|
};
|
|
1078
1076
|
const getItemSize = (key, index, data, useAverageSize = false) => {
|
|
1079
1077
|
const state = refState.current;
|
|
1080
|
-
|
|
1078
|
+
state.sizesKnown.get(key);
|
|
1081
1079
|
const sizePrevious = state.sizes.get(key);
|
|
1082
1080
|
let size;
|
|
1083
|
-
|
|
1084
|
-
if (sizeKnown === void 0 && !getEstimatedItemSize && numColumns === 1 && useAverageSize) {
|
|
1085
|
-
const itemType = "";
|
|
1086
|
-
const average = state.averageSizes[itemType];
|
|
1087
|
-
if (average) {
|
|
1088
|
-
size = roundSize(average.avg);
|
|
1089
|
-
if (size !== sizePrevious) {
|
|
1090
|
-
addTotalSize(key, size - sizePrevious, 0);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1081
|
+
peek$(ctx, "numColumns");
|
|
1094
1082
|
if (size === void 0 && sizePrevious !== void 0) {
|
|
1095
1083
|
return sizePrevious;
|
|
1096
1084
|
}
|
|
@@ -1111,7 +1099,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1111
1099
|
if (canGetSize || getEstimatedItemSize) {
|
|
1112
1100
|
const sizeFn = (index2) => {
|
|
1113
1101
|
if (canGetSize) {
|
|
1114
|
-
return getItemSize(getId(index2), index2, data[index2]);
|
|
1102
|
+
return getItemSize(getId(index2), index2, data[index2], true);
|
|
1115
1103
|
}
|
|
1116
1104
|
return getEstimatedItemSize(index2, data[index2]);
|
|
1117
1105
|
};
|
|
@@ -1138,8 +1126,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1138
1126
|
pendingAdjust: 0,
|
|
1139
1127
|
isStartReached: initialContentOffset < initialScrollLength * onStartReachedThreshold,
|
|
1140
1128
|
isEndReached: false,
|
|
1141
|
-
|
|
1142
|
-
|
|
1129
|
+
isAtEnd: false,
|
|
1130
|
+
isAtStart: false,
|
|
1143
1131
|
data: dataProp,
|
|
1144
1132
|
scrollLength: initialScrollLength,
|
|
1145
1133
|
startBuffered: -1,
|
|
@@ -1224,6 +1212,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1224
1212
|
index = 0;
|
|
1225
1213
|
}
|
|
1226
1214
|
const firstIndexOffset = calculateOffsetForIndex(index);
|
|
1215
|
+
const isLast = index === state.data.length - 1;
|
|
1216
|
+
if (isLast && viewPosition !== void 0) {
|
|
1217
|
+
viewPosition = 1;
|
|
1218
|
+
}
|
|
1227
1219
|
let firstIndexScrollPostion = firstIndexOffset - viewOffset;
|
|
1228
1220
|
const diff = Math.abs(state.scroll - firstIndexScrollPostion);
|
|
1229
1221
|
const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
|
|
@@ -1239,10 +1231,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1239
1231
|
state.minIndexSizeChanged = index;
|
|
1240
1232
|
firstIndexScrollPostion = firstIndexOffset - viewOffset + state.scrollAdjustHandler.getAppliedAdjust();
|
|
1241
1233
|
}
|
|
1242
|
-
|
|
1243
|
-
firstIndexScrollPostion -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1244
|
-
}
|
|
1245
|
-
scrollTo(firstIndexScrollPostion, animated);
|
|
1234
|
+
scrollTo({ offset: firstIndexScrollPostion, animated, index, viewPosition, viewOffset });
|
|
1246
1235
|
};
|
|
1247
1236
|
const setDidLayout = () => {
|
|
1248
1237
|
refState.current.queuedInitialLayout = true;
|
|
@@ -1350,7 +1339,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1350
1339
|
};
|
|
1351
1340
|
const disableScrollJumps = (timeout) => {
|
|
1352
1341
|
const state = refState.current;
|
|
1353
|
-
if (state.
|
|
1342
|
+
if (state.scrollingTo === void 0) {
|
|
1354
1343
|
state.disableScrollJumpsFrom = state.scroll - state.scrollAdjustHandler.getAppliedAdjust();
|
|
1355
1344
|
state.scrollHistory.length = 0;
|
|
1356
1345
|
setTimeout(() => {
|
|
@@ -1744,27 +1733,38 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1744
1733
|
};
|
|
1745
1734
|
const updateAlignItemsPaddingTop = () => {
|
|
1746
1735
|
if (alignItemsAtEnd) {
|
|
1747
|
-
const { scrollLength } = refState.current;
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1736
|
+
const { data, scrollLength } = refState.current;
|
|
1737
|
+
let alignItemsPaddingTop = 0;
|
|
1738
|
+
if ((data == null ? void 0 : data.length) > 0) {
|
|
1739
|
+
const contentSize = getContentSize(ctx);
|
|
1740
|
+
alignItemsPaddingTop = Math.max(0, Math.floor(scrollLength - contentSize));
|
|
1741
|
+
}
|
|
1742
|
+
setPaddingTop({ alignItemsPaddingTop });
|
|
1751
1743
|
}
|
|
1752
1744
|
};
|
|
1753
1745
|
const finishScrollTo = () => {
|
|
1754
1746
|
const state = refState.current;
|
|
1755
1747
|
if (state) {
|
|
1756
|
-
state.
|
|
1748
|
+
state.scrollingTo = void 0;
|
|
1757
1749
|
state.scrollAdjustHandler.setDisableAdjust(false);
|
|
1758
1750
|
state.scrollHistory.length = 0;
|
|
1759
1751
|
calculateItemsInView();
|
|
1760
1752
|
}
|
|
1761
1753
|
};
|
|
1762
|
-
const scrollTo = (
|
|
1754
|
+
const scrollTo = (params = {}) => {
|
|
1763
1755
|
var _a;
|
|
1764
1756
|
const state = refState.current;
|
|
1757
|
+
const { animated, index, viewPosition, viewOffset } = params;
|
|
1758
|
+
let { offset } = params;
|
|
1759
|
+
if (viewOffset) {
|
|
1760
|
+
offset -= viewOffset;
|
|
1761
|
+
}
|
|
1762
|
+
if (viewPosition !== void 0 && index !== void 0) {
|
|
1763
|
+
offset -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1764
|
+
}
|
|
1765
1765
|
state.scrollAdjustHandler.setDisableAdjust(true);
|
|
1766
1766
|
state.scrollHistory.length = 0;
|
|
1767
|
-
state.
|
|
1767
|
+
state.scrollingTo = params;
|
|
1768
1768
|
(_a = refScroller.current) == null ? void 0 : _a.scrollTo({
|
|
1769
1769
|
x: horizontal ? offset : 0,
|
|
1770
1770
|
y: horizontal ? 0 : offset,
|
|
@@ -1776,7 +1776,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1776
1776
|
};
|
|
1777
1777
|
const doMaintainScrollAtEnd = (animated) => {
|
|
1778
1778
|
const state = refState.current;
|
|
1779
|
-
if ((state == null ? void 0 : state.
|
|
1779
|
+
if ((state == null ? void 0 : state.isAtEnd) && maintainScrollAtEnd && peek$(ctx, "containersDidLayout")) {
|
|
1780
1780
|
const paddingTop = peek$(ctx, "alignItemsPaddingTop");
|
|
1781
1781
|
if (paddingTop > 0) {
|
|
1782
1782
|
state.scroll = 0;
|
|
@@ -1825,9 +1825,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1825
1825
|
const contentSize = getContentSize(ctx);
|
|
1826
1826
|
if (contentSize > 0 && queuedInitialLayout && !maintainingScrollAtEnd) {
|
|
1827
1827
|
const distanceFromEnd = contentSize - scroll - scrollLength;
|
|
1828
|
-
const distanceFromEndAbs = Math.abs(distanceFromEnd);
|
|
1829
1828
|
const isContentLess = contentSize < scrollLength;
|
|
1830
|
-
refState.current.
|
|
1829
|
+
refState.current.isAtEnd = isContentLess || distanceFromEnd < scrollLength * maintainScrollAtEndThreshold;
|
|
1831
1830
|
refState.current.isEndReached = checkThreshold(
|
|
1832
1831
|
distanceFromEnd,
|
|
1833
1832
|
isContentLess,
|
|
@@ -1850,7 +1849,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1850
1849
|
}
|
|
1851
1850
|
const { scrollLength, scroll } = refState.current;
|
|
1852
1851
|
const distanceFromTop = scroll;
|
|
1853
|
-
refState.current.
|
|
1852
|
+
refState.current.isAtStart = distanceFromTop <= 0;
|
|
1854
1853
|
refState.current.isStartReached = checkThreshold(
|
|
1855
1854
|
distanceFromTop,
|
|
1856
1855
|
false,
|
|
@@ -1945,7 +1944,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1945
1944
|
};
|
|
1946
1945
|
state.anchorElement = newAnchorElement;
|
|
1947
1946
|
(_b = state.belowAnchorElementPositions) == null ? void 0 : _b.clear();
|
|
1948
|
-
scrollTo(0, false);
|
|
1947
|
+
scrollTo({ offset: 0, animated: false });
|
|
1949
1948
|
setTimeout(() => {
|
|
1950
1949
|
calculateItemsInView(
|
|
1951
1950
|
/*reset*/
|
|
@@ -1963,7 +1962,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1963
1962
|
} else {
|
|
1964
1963
|
state.startBufferedId = void 0;
|
|
1965
1964
|
}
|
|
1966
|
-
scrollTo(0, false);
|
|
1965
|
+
scrollTo({ offset: 0, animated: false });
|
|
1967
1966
|
setTimeout(() => {
|
|
1968
1967
|
calculateItemsInView(
|
|
1969
1968
|
/*reset*/
|
|
@@ -2071,7 +2070,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2071
2070
|
const paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
2072
2071
|
if (paddingDiff && prevPaddingTop !== void 0 && reactNative.Platform.OS === "ios") {
|
|
2073
2072
|
queueMicrotask(() => {
|
|
2074
|
-
scrollTo(refState.current.scroll + paddingDiff, false);
|
|
2073
|
+
scrollTo({ offset: refState.current.scroll + paddingDiff, animated: false });
|
|
2075
2074
|
});
|
|
2076
2075
|
}
|
|
2077
2076
|
};
|
|
@@ -2091,6 +2090,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2091
2090
|
refState.current.previousTotalSize = peek$(ctx, "totalSize");
|
|
2092
2091
|
calcTotalSizesAndPositions({ forgetPositions: false });
|
|
2093
2092
|
}
|
|
2093
|
+
React2.useEffect(() => {
|
|
2094
|
+
if (initialScrollIndex && ListHeaderComponent) {
|
|
2095
|
+
const dispose = listen$(ctx, "headerSize", (size) => {
|
|
2096
|
+
if (size > 0) {
|
|
2097
|
+
scrollToIndex({ index: initialScrollIndex, animated: false });
|
|
2098
|
+
dispose == null ? void 0 : dispose();
|
|
2099
|
+
}
|
|
2100
|
+
});
|
|
2101
|
+
setTimeout(dispose, 0);
|
|
2102
|
+
return dispose;
|
|
2103
|
+
}
|
|
2104
|
+
}, []);
|
|
2094
2105
|
React2.useEffect(() => {
|
|
2095
2106
|
const didAllocateContainers = doInitialAllocateContainers();
|
|
2096
2107
|
if (!didAllocateContainers) {
|
|
@@ -2106,7 +2117,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2106
2117
|
refState.current.renderItem = renderItem;
|
|
2107
2118
|
React2.useEffect(initalizeStateVars, [memoizedLastItemKeys.join(","), numColumnsProp, stylePaddingTopState]);
|
|
2108
2119
|
const getRenderedItem = React2.useCallback((key) => {
|
|
2109
|
-
var _a, _b;
|
|
2110
2120
|
const state = refState.current;
|
|
2111
2121
|
if (!state) {
|
|
2112
2122
|
return null;
|
|
@@ -2116,11 +2126,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2116
2126
|
if (index === void 0) {
|
|
2117
2127
|
return null;
|
|
2118
2128
|
}
|
|
2119
|
-
const
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2129
|
+
const renderItemProp = refState.current.renderItem;
|
|
2130
|
+
let renderedItem = null;
|
|
2131
|
+
if (renderItemProp) {
|
|
2132
|
+
const itemProps = {
|
|
2133
|
+
item: data[index],
|
|
2134
|
+
index,
|
|
2135
|
+
extraData: peek$(ctx, "extraData")
|
|
2136
|
+
};
|
|
2137
|
+
renderedItem = isFunction(renderItemProp) ? renderItemProp(itemProps) : React2__namespace.createElement(renderItemProp, itemProps);
|
|
2138
|
+
}
|
|
2124
2139
|
return { index, item: data[index], renderedItem };
|
|
2125
2140
|
}, []);
|
|
2126
2141
|
const doInitialAllocateContainers = () => {
|
|
@@ -2259,7 +2274,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2259
2274
|
if (needsUpdateContainersDidLayout || !fromFixGaps && needsCalculate && (isInView || !queuedInitialLayout)) {
|
|
2260
2275
|
const scrollVelocity = state.scrollVelocity;
|
|
2261
2276
|
let didCalculate = false;
|
|
2262
|
-
if ((Number.isNaN(scrollVelocity) || Math.abs(scrollVelocity) < 1 || state.
|
|
2277
|
+
if ((Number.isNaN(scrollVelocity) || Math.abs(scrollVelocity) < 1 || state.scrollingTo !== void 0) && (!waitForInitialLayout || needsUpdateContainersDidLayout || queuedInitialLayout)) {
|
|
2263
2278
|
if (Date.now() - state.lastBatchingAction < 500) {
|
|
2264
2279
|
if (!state.queuedCalculateItemsInView) {
|
|
2265
2280
|
state.queuedCalculateItemsInView = requestAnimationFrame(() => {
|
|
@@ -2349,8 +2364,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2349
2364
|
);
|
|
2350
2365
|
const updateScroll = React2.useCallback((newScroll) => {
|
|
2351
2366
|
const state = refState.current;
|
|
2352
|
-
const
|
|
2353
|
-
if (
|
|
2367
|
+
const scrollingTo = state.scrollingTo;
|
|
2368
|
+
if (scrollingTo !== void 0 && Math.abs(newScroll - scrollingTo.offset) < 10) {
|
|
2354
2369
|
finishScrollTo();
|
|
2355
2370
|
}
|
|
2356
2371
|
if (state.disableScrollJumpsFrom !== void 0) {
|
|
@@ -2363,7 +2378,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2363
2378
|
state.hasScrolled = true;
|
|
2364
2379
|
state.lastBatchingAction = Date.now();
|
|
2365
2380
|
const currentTime = performance.now();
|
|
2366
|
-
if (
|
|
2381
|
+
if (scrollingTo === void 0 && !(state.scrollHistory.length === 0 && newScroll === initialContentOffset)) {
|
|
2367
2382
|
state.scrollHistory.push({ scroll: newScroll, time: currentTime });
|
|
2368
2383
|
}
|
|
2369
2384
|
if (state.scrollHistory.length > 5) {
|
|
@@ -2429,8 +2444,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2429
2444
|
contentLength: state.totalSize,
|
|
2430
2445
|
end: state.endNoBuffer,
|
|
2431
2446
|
endBuffered: state.endBuffered,
|
|
2432
|
-
isAtEnd: state.
|
|
2433
|
-
isAtStart: state.
|
|
2447
|
+
isAtEnd: state.isAtEnd,
|
|
2448
|
+
isAtStart: state.isAtStart,
|
|
2434
2449
|
scroll: state.scroll,
|
|
2435
2450
|
scrollLength: state.scrollLength,
|
|
2436
2451
|
start: state.startNoBuffer,
|
|
@@ -2453,10 +2468,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2453
2468
|
scrollToIndex({ index, ...props2 });
|
|
2454
2469
|
}
|
|
2455
2470
|
},
|
|
2456
|
-
scrollToOffset: (
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2471
|
+
scrollToOffset: (params) => scrollTo(params),
|
|
2472
|
+
scrollToEnd: (options) => {
|
|
2473
|
+
const { data } = refState.current;
|
|
2474
|
+
const index = data.length - 1;
|
|
2475
|
+
if (index !== -1) {
|
|
2476
|
+
scrollToIndex({ index, ...options });
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2460
2479
|
};
|
|
2461
2480
|
},
|
|
2462
2481
|
[]
|
|
@@ -2466,7 +2485,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2466
2485
|
var _a;
|
|
2467
2486
|
if (initialContentOffset) {
|
|
2468
2487
|
(_a = refState.current) == null ? void 0 : _a.scrollAdjustHandler.setDisableAdjust(true);
|
|
2469
|
-
scrollTo(initialContentOffset, false);
|
|
2488
|
+
scrollTo({ offset: initialContentOffset, animated: false });
|
|
2470
2489
|
setTimeout(() => {
|
|
2471
2490
|
var _a2;
|
|
2472
2491
|
(_a2 = refState.current) == null ? void 0 : _a2.scrollAdjustHandler.setDisableAdjust(false);
|
|
@@ -2486,11 +2505,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2486
2505
|
handleScroll,
|
|
2487
2506
|
onMomentumScrollEnd: (event) => {
|
|
2488
2507
|
var _a;
|
|
2489
|
-
const
|
|
2490
|
-
if (
|
|
2508
|
+
const scrollingTo = (_a = refState.current) == null ? void 0 : _a.scrollingTo;
|
|
2509
|
+
if (scrollingTo !== void 0) {
|
|
2491
2510
|
requestAnimationFrame(() => {
|
|
2492
|
-
scrollTo(
|
|
2493
|
-
refState.current.
|
|
2511
|
+
scrollTo({ ...scrollingTo, animated: false });
|
|
2512
|
+
refState.current.scrollingTo = void 0;
|
|
2494
2513
|
requestAnimationFrame(() => {
|
|
2495
2514
|
refState.current.scrollAdjustHandler.setDisableAdjust(false);
|
|
2496
2515
|
});
|
|
@@ -2510,15 +2529,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2510
2529
|
recycleItems,
|
|
2511
2530
|
alignItemsAtEnd,
|
|
2512
2531
|
ListEmptyComponent: dataProp.length === 0 ? ListEmptyComponent : void 0,
|
|
2532
|
+
ListHeaderComponent,
|
|
2513
2533
|
maintainVisibleContentPosition,
|
|
2514
2534
|
scrollEventThrottle: reactNative.Platform.OS === "web" ? 16 : void 0,
|
|
2515
2535
|
waitForInitialLayout,
|
|
2516
|
-
refreshControl: refreshControl
|
|
2536
|
+
refreshControl: refreshControl ? stylePaddingTopState > 0 ? React2__namespace.cloneElement(refreshControl, {
|
|
2537
|
+
progressViewOffset: (refreshControl.props.progressViewOffset || 0) + stylePaddingTopState
|
|
2538
|
+
}) : refreshControl : onRefresh && /* @__PURE__ */ React2__namespace.createElement(
|
|
2517
2539
|
reactNative.RefreshControl,
|
|
2518
2540
|
{
|
|
2519
2541
|
refreshing: !!refreshing,
|
|
2520
2542
|
onRefresh,
|
|
2521
|
-
progressViewOffset
|
|
2543
|
+
progressViewOffset: (progressViewOffset || 0) + stylePaddingTopState
|
|
2522
2544
|
}
|
|
2523
2545
|
),
|
|
2524
2546
|
style,
|
package/index.mjs
CHANGED
|
@@ -152,7 +152,7 @@ var DebugView = React2.memo(function DebugView2({ state }) {
|
|
|
152
152
|
},
|
|
153
153
|
/* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "TotalSize:"), /* @__PURE__ */ React2.createElement(Text, null, totalSize.toFixed(2))),
|
|
154
154
|
/* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "ContentSize:"), /* @__PURE__ */ React2.createElement(Text, null, contentSize.toFixed(2))),
|
|
155
|
-
/* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "At end:"), /* @__PURE__ */ React2.createElement(Text, null, String(state.
|
|
155
|
+
/* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "At end:"), /* @__PURE__ */ React2.createElement(Text, null, String(state.isAtEnd))),
|
|
156
156
|
/* @__PURE__ */ React2.createElement(Text, null),
|
|
157
157
|
/* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "ScrollAdjust:"), /* @__PURE__ */ React2.createElement(Text, null, scrollAdjust.toFixed(2))),
|
|
158
158
|
/* @__PURE__ */ React2.createElement(DebugRow, null, /* @__PURE__ */ React2.createElement(Text, null, "TotalSizeReal: "), /* @__PURE__ */ React2.createElement(Text, null, totalSizeWithScrollAdjust.toFixed(2))),
|
|
@@ -179,9 +179,6 @@ function warnDevOnce(id, text) {
|
|
|
179
179
|
console.warn(`[legend-list] ${text}`);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
function roundSize(size) {
|
|
183
|
-
return Math.floor(size * 8) / 8;
|
|
184
|
-
}
|
|
185
182
|
function isNullOrUndefined(value) {
|
|
186
183
|
return value === null || value === void 0;
|
|
187
184
|
}
|
|
@@ -544,11 +541,14 @@ function ListHeaderComponentContainer({
|
|
|
544
541
|
horizontal,
|
|
545
542
|
waitForInitialLayout
|
|
546
543
|
}) {
|
|
547
|
-
|
|
544
|
+
var _a;
|
|
545
|
+
const hasData = ((_a = peek$(ctx, "lastItemKeys")) == null ? void 0 : _a.length) > 0;
|
|
546
|
+
const scrollAdjust = useValue$("scrollAdjust", (v) => v != null ? v : 0, true);
|
|
548
547
|
const animOpacity = waitForInitialLayout ? useValue$("containersDidLayout", (value) => value ? 1 : 0) : void 0;
|
|
549
548
|
const additionalSize = {
|
|
550
549
|
transform: [{ translateY: Animated.multiply(scrollAdjust, -1) }],
|
|
551
|
-
|
|
550
|
+
// Header should show if there's no data yet, but containersDidLayout will be false until it has some data
|
|
551
|
+
opacity: hasData ? animOpacity : 1
|
|
552
552
|
};
|
|
553
553
|
return /* @__PURE__ */ React2.createElement(
|
|
554
554
|
Animated.View,
|
|
@@ -645,9 +645,6 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
645
645
|
refScrollView,
|
|
646
646
|
maintainVisibleContentPosition,
|
|
647
647
|
renderScrollComponent,
|
|
648
|
-
onRefresh,
|
|
649
|
-
refreshing,
|
|
650
|
-
progressViewOffset,
|
|
651
648
|
...rest
|
|
652
649
|
}) {
|
|
653
650
|
const ctx = useStateContext();
|
|
@@ -673,7 +670,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
673
670
|
contentOffset: initialContentOffset ? horizontal ? { x: initialContentOffset, y: 0 } : { x: 0, y: initialContentOffset } : void 0,
|
|
674
671
|
ref: refScrollView
|
|
675
672
|
},
|
|
676
|
-
|
|
673
|
+
ENABLE_DEVMODE ? /* @__PURE__ */ React2.createElement(PaddingAndAdjustDevMode, null) : /* @__PURE__ */ React2.createElement(PaddingAndAdjust, null),
|
|
677
674
|
ListHeaderComponent && /* @__PURE__ */ React2.createElement(
|
|
678
675
|
ListHeaderComponentContainer,
|
|
679
676
|
{
|
|
@@ -1003,6 +1000,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1003
1000
|
estimatedItemSize: estimatedItemSizeProp,
|
|
1004
1001
|
getEstimatedItemSize,
|
|
1005
1002
|
suggestEstimatedItemSize,
|
|
1003
|
+
ListHeaderComponent,
|
|
1006
1004
|
ListEmptyComponent,
|
|
1007
1005
|
onItemSizeChanged,
|
|
1008
1006
|
refScrollView,
|
|
@@ -1056,20 +1054,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1056
1054
|
};
|
|
1057
1055
|
const getItemSize = (key, index, data, useAverageSize = false) => {
|
|
1058
1056
|
const state = refState.current;
|
|
1059
|
-
|
|
1057
|
+
state.sizesKnown.get(key);
|
|
1060
1058
|
const sizePrevious = state.sizes.get(key);
|
|
1061
1059
|
let size;
|
|
1062
|
-
|
|
1063
|
-
if (sizeKnown === void 0 && !getEstimatedItemSize && numColumns === 1 && useAverageSize) {
|
|
1064
|
-
const itemType = "";
|
|
1065
|
-
const average = state.averageSizes[itemType];
|
|
1066
|
-
if (average) {
|
|
1067
|
-
size = roundSize(average.avg);
|
|
1068
|
-
if (size !== sizePrevious) {
|
|
1069
|
-
addTotalSize(key, size - sizePrevious, 0);
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1060
|
+
peek$(ctx, "numColumns");
|
|
1073
1061
|
if (size === void 0 && sizePrevious !== void 0) {
|
|
1074
1062
|
return sizePrevious;
|
|
1075
1063
|
}
|
|
@@ -1090,7 +1078,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1090
1078
|
if (canGetSize || getEstimatedItemSize) {
|
|
1091
1079
|
const sizeFn = (index2) => {
|
|
1092
1080
|
if (canGetSize) {
|
|
1093
|
-
return getItemSize(getId(index2), index2, data[index2]);
|
|
1081
|
+
return getItemSize(getId(index2), index2, data[index2], true);
|
|
1094
1082
|
}
|
|
1095
1083
|
return getEstimatedItemSize(index2, data[index2]);
|
|
1096
1084
|
};
|
|
@@ -1117,8 +1105,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1117
1105
|
pendingAdjust: 0,
|
|
1118
1106
|
isStartReached: initialContentOffset < initialScrollLength * onStartReachedThreshold,
|
|
1119
1107
|
isEndReached: false,
|
|
1120
|
-
|
|
1121
|
-
|
|
1108
|
+
isAtEnd: false,
|
|
1109
|
+
isAtStart: false,
|
|
1122
1110
|
data: dataProp,
|
|
1123
1111
|
scrollLength: initialScrollLength,
|
|
1124
1112
|
startBuffered: -1,
|
|
@@ -1203,6 +1191,10 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1203
1191
|
index = 0;
|
|
1204
1192
|
}
|
|
1205
1193
|
const firstIndexOffset = calculateOffsetForIndex(index);
|
|
1194
|
+
const isLast = index === state.data.length - 1;
|
|
1195
|
+
if (isLast && viewPosition !== void 0) {
|
|
1196
|
+
viewPosition = 1;
|
|
1197
|
+
}
|
|
1206
1198
|
let firstIndexScrollPostion = firstIndexOffset - viewOffset;
|
|
1207
1199
|
const diff = Math.abs(state.scroll - firstIndexScrollPostion);
|
|
1208
1200
|
const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
|
|
@@ -1218,10 +1210,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1218
1210
|
state.minIndexSizeChanged = index;
|
|
1219
1211
|
firstIndexScrollPostion = firstIndexOffset - viewOffset + state.scrollAdjustHandler.getAppliedAdjust();
|
|
1220
1212
|
}
|
|
1221
|
-
|
|
1222
|
-
firstIndexScrollPostion -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1223
|
-
}
|
|
1224
|
-
scrollTo(firstIndexScrollPostion, animated);
|
|
1213
|
+
scrollTo({ offset: firstIndexScrollPostion, animated, index, viewPosition, viewOffset });
|
|
1225
1214
|
};
|
|
1226
1215
|
const setDidLayout = () => {
|
|
1227
1216
|
refState.current.queuedInitialLayout = true;
|
|
@@ -1329,7 +1318,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1329
1318
|
};
|
|
1330
1319
|
const disableScrollJumps = (timeout) => {
|
|
1331
1320
|
const state = refState.current;
|
|
1332
|
-
if (state.
|
|
1321
|
+
if (state.scrollingTo === void 0) {
|
|
1333
1322
|
state.disableScrollJumpsFrom = state.scroll - state.scrollAdjustHandler.getAppliedAdjust();
|
|
1334
1323
|
state.scrollHistory.length = 0;
|
|
1335
1324
|
setTimeout(() => {
|
|
@@ -1723,27 +1712,38 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1723
1712
|
};
|
|
1724
1713
|
const updateAlignItemsPaddingTop = () => {
|
|
1725
1714
|
if (alignItemsAtEnd) {
|
|
1726
|
-
const { scrollLength } = refState.current;
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1715
|
+
const { data, scrollLength } = refState.current;
|
|
1716
|
+
let alignItemsPaddingTop = 0;
|
|
1717
|
+
if ((data == null ? void 0 : data.length) > 0) {
|
|
1718
|
+
const contentSize = getContentSize(ctx);
|
|
1719
|
+
alignItemsPaddingTop = Math.max(0, Math.floor(scrollLength - contentSize));
|
|
1720
|
+
}
|
|
1721
|
+
setPaddingTop({ alignItemsPaddingTop });
|
|
1730
1722
|
}
|
|
1731
1723
|
};
|
|
1732
1724
|
const finishScrollTo = () => {
|
|
1733
1725
|
const state = refState.current;
|
|
1734
1726
|
if (state) {
|
|
1735
|
-
state.
|
|
1727
|
+
state.scrollingTo = void 0;
|
|
1736
1728
|
state.scrollAdjustHandler.setDisableAdjust(false);
|
|
1737
1729
|
state.scrollHistory.length = 0;
|
|
1738
1730
|
calculateItemsInView();
|
|
1739
1731
|
}
|
|
1740
1732
|
};
|
|
1741
|
-
const scrollTo = (
|
|
1733
|
+
const scrollTo = (params = {}) => {
|
|
1742
1734
|
var _a;
|
|
1743
1735
|
const state = refState.current;
|
|
1736
|
+
const { animated, index, viewPosition, viewOffset } = params;
|
|
1737
|
+
let { offset } = params;
|
|
1738
|
+
if (viewOffset) {
|
|
1739
|
+
offset -= viewOffset;
|
|
1740
|
+
}
|
|
1741
|
+
if (viewPosition !== void 0 && index !== void 0) {
|
|
1742
|
+
offset -= viewPosition * (state.scrollLength - getItemSize(getId(index), index, state.data[index]));
|
|
1743
|
+
}
|
|
1744
1744
|
state.scrollAdjustHandler.setDisableAdjust(true);
|
|
1745
1745
|
state.scrollHistory.length = 0;
|
|
1746
|
-
state.
|
|
1746
|
+
state.scrollingTo = params;
|
|
1747
1747
|
(_a = refScroller.current) == null ? void 0 : _a.scrollTo({
|
|
1748
1748
|
x: horizontal ? offset : 0,
|
|
1749
1749
|
y: horizontal ? 0 : offset,
|
|
@@ -1755,7 +1755,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1755
1755
|
};
|
|
1756
1756
|
const doMaintainScrollAtEnd = (animated) => {
|
|
1757
1757
|
const state = refState.current;
|
|
1758
|
-
if ((state == null ? void 0 : state.
|
|
1758
|
+
if ((state == null ? void 0 : state.isAtEnd) && maintainScrollAtEnd && peek$(ctx, "containersDidLayout")) {
|
|
1759
1759
|
const paddingTop = peek$(ctx, "alignItemsPaddingTop");
|
|
1760
1760
|
if (paddingTop > 0) {
|
|
1761
1761
|
state.scroll = 0;
|
|
@@ -1804,9 +1804,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1804
1804
|
const contentSize = getContentSize(ctx);
|
|
1805
1805
|
if (contentSize > 0 && queuedInitialLayout && !maintainingScrollAtEnd) {
|
|
1806
1806
|
const distanceFromEnd = contentSize - scroll - scrollLength;
|
|
1807
|
-
const distanceFromEndAbs = Math.abs(distanceFromEnd);
|
|
1808
1807
|
const isContentLess = contentSize < scrollLength;
|
|
1809
|
-
refState.current.
|
|
1808
|
+
refState.current.isAtEnd = isContentLess || distanceFromEnd < scrollLength * maintainScrollAtEndThreshold;
|
|
1810
1809
|
refState.current.isEndReached = checkThreshold(
|
|
1811
1810
|
distanceFromEnd,
|
|
1812
1811
|
isContentLess,
|
|
@@ -1829,7 +1828,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1829
1828
|
}
|
|
1830
1829
|
const { scrollLength, scroll } = refState.current;
|
|
1831
1830
|
const distanceFromTop = scroll;
|
|
1832
|
-
refState.current.
|
|
1831
|
+
refState.current.isAtStart = distanceFromTop <= 0;
|
|
1833
1832
|
refState.current.isStartReached = checkThreshold(
|
|
1834
1833
|
distanceFromTop,
|
|
1835
1834
|
false,
|
|
@@ -1924,7 +1923,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1924
1923
|
};
|
|
1925
1924
|
state.anchorElement = newAnchorElement;
|
|
1926
1925
|
(_b = state.belowAnchorElementPositions) == null ? void 0 : _b.clear();
|
|
1927
|
-
scrollTo(0, false);
|
|
1926
|
+
scrollTo({ offset: 0, animated: false });
|
|
1928
1927
|
setTimeout(() => {
|
|
1929
1928
|
calculateItemsInView(
|
|
1930
1929
|
/*reset*/
|
|
@@ -1942,7 +1941,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1942
1941
|
} else {
|
|
1943
1942
|
state.startBufferedId = void 0;
|
|
1944
1943
|
}
|
|
1945
|
-
scrollTo(0, false);
|
|
1944
|
+
scrollTo({ offset: 0, animated: false });
|
|
1946
1945
|
setTimeout(() => {
|
|
1947
1946
|
calculateItemsInView(
|
|
1948
1947
|
/*reset*/
|
|
@@ -2050,7 +2049,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2050
2049
|
const paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
2051
2050
|
if (paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
|
|
2052
2051
|
queueMicrotask(() => {
|
|
2053
|
-
scrollTo(refState.current.scroll + paddingDiff, false);
|
|
2052
|
+
scrollTo({ offset: refState.current.scroll + paddingDiff, animated: false });
|
|
2054
2053
|
});
|
|
2055
2054
|
}
|
|
2056
2055
|
};
|
|
@@ -2070,6 +2069,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2070
2069
|
refState.current.previousTotalSize = peek$(ctx, "totalSize");
|
|
2071
2070
|
calcTotalSizesAndPositions({ forgetPositions: false });
|
|
2072
2071
|
}
|
|
2072
|
+
useEffect(() => {
|
|
2073
|
+
if (initialScrollIndex && ListHeaderComponent) {
|
|
2074
|
+
const dispose = listen$(ctx, "headerSize", (size) => {
|
|
2075
|
+
if (size > 0) {
|
|
2076
|
+
scrollToIndex({ index: initialScrollIndex, animated: false });
|
|
2077
|
+
dispose == null ? void 0 : dispose();
|
|
2078
|
+
}
|
|
2079
|
+
});
|
|
2080
|
+
setTimeout(dispose, 0);
|
|
2081
|
+
return dispose;
|
|
2082
|
+
}
|
|
2083
|
+
}, []);
|
|
2073
2084
|
useEffect(() => {
|
|
2074
2085
|
const didAllocateContainers = doInitialAllocateContainers();
|
|
2075
2086
|
if (!didAllocateContainers) {
|
|
@@ -2085,7 +2096,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2085
2096
|
refState.current.renderItem = renderItem;
|
|
2086
2097
|
useEffect(initalizeStateVars, [memoizedLastItemKeys.join(","), numColumnsProp, stylePaddingTopState]);
|
|
2087
2098
|
const getRenderedItem = useCallback((key) => {
|
|
2088
|
-
var _a, _b;
|
|
2089
2099
|
const state = refState.current;
|
|
2090
2100
|
if (!state) {
|
|
2091
2101
|
return null;
|
|
@@ -2095,11 +2105,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2095
2105
|
if (index === void 0) {
|
|
2096
2106
|
return null;
|
|
2097
2107
|
}
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2108
|
+
const renderItemProp = refState.current.renderItem;
|
|
2109
|
+
let renderedItem = null;
|
|
2110
|
+
if (renderItemProp) {
|
|
2111
|
+
const itemProps = {
|
|
2112
|
+
item: data[index],
|
|
2113
|
+
index,
|
|
2114
|
+
extraData: peek$(ctx, "extraData")
|
|
2115
|
+
};
|
|
2116
|
+
renderedItem = isFunction(renderItemProp) ? renderItemProp(itemProps) : React2.createElement(renderItemProp, itemProps);
|
|
2117
|
+
}
|
|
2103
2118
|
return { index, item: data[index], renderedItem };
|
|
2104
2119
|
}, []);
|
|
2105
2120
|
const doInitialAllocateContainers = () => {
|
|
@@ -2238,7 +2253,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2238
2253
|
if (needsUpdateContainersDidLayout || !fromFixGaps && needsCalculate && (isInView || !queuedInitialLayout)) {
|
|
2239
2254
|
const scrollVelocity = state.scrollVelocity;
|
|
2240
2255
|
let didCalculate = false;
|
|
2241
|
-
if ((Number.isNaN(scrollVelocity) || Math.abs(scrollVelocity) < 1 || state.
|
|
2256
|
+
if ((Number.isNaN(scrollVelocity) || Math.abs(scrollVelocity) < 1 || state.scrollingTo !== void 0) && (!waitForInitialLayout || needsUpdateContainersDidLayout || queuedInitialLayout)) {
|
|
2242
2257
|
if (Date.now() - state.lastBatchingAction < 500) {
|
|
2243
2258
|
if (!state.queuedCalculateItemsInView) {
|
|
2244
2259
|
state.queuedCalculateItemsInView = requestAnimationFrame(() => {
|
|
@@ -2328,8 +2343,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2328
2343
|
);
|
|
2329
2344
|
const updateScroll = useCallback((newScroll) => {
|
|
2330
2345
|
const state = refState.current;
|
|
2331
|
-
const
|
|
2332
|
-
if (
|
|
2346
|
+
const scrollingTo = state.scrollingTo;
|
|
2347
|
+
if (scrollingTo !== void 0 && Math.abs(newScroll - scrollingTo.offset) < 10) {
|
|
2333
2348
|
finishScrollTo();
|
|
2334
2349
|
}
|
|
2335
2350
|
if (state.disableScrollJumpsFrom !== void 0) {
|
|
@@ -2342,7 +2357,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2342
2357
|
state.hasScrolled = true;
|
|
2343
2358
|
state.lastBatchingAction = Date.now();
|
|
2344
2359
|
const currentTime = performance.now();
|
|
2345
|
-
if (
|
|
2360
|
+
if (scrollingTo === void 0 && !(state.scrollHistory.length === 0 && newScroll === initialContentOffset)) {
|
|
2346
2361
|
state.scrollHistory.push({ scroll: newScroll, time: currentTime });
|
|
2347
2362
|
}
|
|
2348
2363
|
if (state.scrollHistory.length > 5) {
|
|
@@ -2408,8 +2423,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2408
2423
|
contentLength: state.totalSize,
|
|
2409
2424
|
end: state.endNoBuffer,
|
|
2410
2425
|
endBuffered: state.endBuffered,
|
|
2411
|
-
isAtEnd: state.
|
|
2412
|
-
isAtStart: state.
|
|
2426
|
+
isAtEnd: state.isAtEnd,
|
|
2427
|
+
isAtStart: state.isAtStart,
|
|
2413
2428
|
scroll: state.scroll,
|
|
2414
2429
|
scrollLength: state.scrollLength,
|
|
2415
2430
|
start: state.startNoBuffer,
|
|
@@ -2432,10 +2447,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2432
2447
|
scrollToIndex({ index, ...props2 });
|
|
2433
2448
|
}
|
|
2434
2449
|
},
|
|
2435
|
-
scrollToOffset: (
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2450
|
+
scrollToOffset: (params) => scrollTo(params),
|
|
2451
|
+
scrollToEnd: (options) => {
|
|
2452
|
+
const { data } = refState.current;
|
|
2453
|
+
const index = data.length - 1;
|
|
2454
|
+
if (index !== -1) {
|
|
2455
|
+
scrollToIndex({ index, ...options });
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2439
2458
|
};
|
|
2440
2459
|
},
|
|
2441
2460
|
[]
|
|
@@ -2445,7 +2464,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2445
2464
|
var _a;
|
|
2446
2465
|
if (initialContentOffset) {
|
|
2447
2466
|
(_a = refState.current) == null ? void 0 : _a.scrollAdjustHandler.setDisableAdjust(true);
|
|
2448
|
-
scrollTo(initialContentOffset, false);
|
|
2467
|
+
scrollTo({ offset: initialContentOffset, animated: false });
|
|
2449
2468
|
setTimeout(() => {
|
|
2450
2469
|
var _a2;
|
|
2451
2470
|
(_a2 = refState.current) == null ? void 0 : _a2.scrollAdjustHandler.setDisableAdjust(false);
|
|
@@ -2465,11 +2484,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2465
2484
|
handleScroll,
|
|
2466
2485
|
onMomentumScrollEnd: (event) => {
|
|
2467
2486
|
var _a;
|
|
2468
|
-
const
|
|
2469
|
-
if (
|
|
2487
|
+
const scrollingTo = (_a = refState.current) == null ? void 0 : _a.scrollingTo;
|
|
2488
|
+
if (scrollingTo !== void 0) {
|
|
2470
2489
|
requestAnimationFrame(() => {
|
|
2471
|
-
scrollTo(
|
|
2472
|
-
refState.current.
|
|
2490
|
+
scrollTo({ ...scrollingTo, animated: false });
|
|
2491
|
+
refState.current.scrollingTo = void 0;
|
|
2473
2492
|
requestAnimationFrame(() => {
|
|
2474
2493
|
refState.current.scrollAdjustHandler.setDisableAdjust(false);
|
|
2475
2494
|
});
|
|
@@ -2489,15 +2508,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2489
2508
|
recycleItems,
|
|
2490
2509
|
alignItemsAtEnd,
|
|
2491
2510
|
ListEmptyComponent: dataProp.length === 0 ? ListEmptyComponent : void 0,
|
|
2511
|
+
ListHeaderComponent,
|
|
2492
2512
|
maintainVisibleContentPosition,
|
|
2493
2513
|
scrollEventThrottle: Platform.OS === "web" ? 16 : void 0,
|
|
2494
2514
|
waitForInitialLayout,
|
|
2495
|
-
refreshControl: refreshControl
|
|
2515
|
+
refreshControl: refreshControl ? stylePaddingTopState > 0 ? React2.cloneElement(refreshControl, {
|
|
2516
|
+
progressViewOffset: (refreshControl.props.progressViewOffset || 0) + stylePaddingTopState
|
|
2517
|
+
}) : refreshControl : onRefresh && /* @__PURE__ */ React2.createElement(
|
|
2496
2518
|
RefreshControl,
|
|
2497
2519
|
{
|
|
2498
2520
|
refreshing: !!refreshing,
|
|
2499
2521
|
onRefresh,
|
|
2500
|
-
progressViewOffset
|
|
2522
|
+
progressViewOffset: (progressViewOffset || 0) + stylePaddingTopState
|
|
2501
2523
|
}
|
|
2502
2524
|
),
|
|
2503
2525
|
style,
|
|
@@ -52,7 +52,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
52
52
|
recycleItems?: boolean;
|
|
53
53
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
54
54
|
refreshing?: boolean;
|
|
55
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | undefined;
|
|
55
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
|
|
56
56
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
57
57
|
suggestEstimatedItemSize?: boolean;
|
|
58
58
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
@@ -106,7 +106,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
106
106
|
recycleItems?: boolean;
|
|
107
107
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
108
108
|
refreshing?: boolean;
|
|
109
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | undefined;
|
|
109
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
|
|
110
110
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
111
111
|
suggestEstimatedItemSize?: boolean;
|
|
112
112
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
@@ -128,7 +128,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
128
128
|
itemKey: string;
|
|
129
129
|
itemData: ItemT_1;
|
|
130
130
|
}) => void) | undefined;
|
|
131
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT_1>) => React.ReactNode) | undefined;
|
|
131
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT_1>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<ItemT_1>> | undefined;
|
|
132
132
|
animatedProps?: Partial<{
|
|
133
133
|
contentOffset?: react_native.PointProp | react_native_reanimated.SharedValue<react_native.PointProp | undefined> | undefined;
|
|
134
134
|
contentInset?: Insets | react_native_reanimated.SharedValue<Insets | undefined> | undefined;
|
|
@@ -343,7 +343,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
343
343
|
recycleItems?: boolean;
|
|
344
344
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
345
345
|
refreshing?: boolean;
|
|
346
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | undefined;
|
|
346
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
|
|
347
347
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
348
348
|
suggestEstimatedItemSize?: boolean;
|
|
349
349
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
@@ -397,7 +397,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
397
397
|
recycleItems?: boolean;
|
|
398
398
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
399
399
|
refreshing?: boolean;
|
|
400
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT>) => React.ReactNode) | undefined;
|
|
400
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<ItemT>> | undefined;
|
|
401
401
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
402
402
|
suggestEstimatedItemSize?: boolean;
|
|
403
403
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
package/keyboard-controller.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
52
52
|
recycleItems?: boolean;
|
|
53
53
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
54
54
|
refreshing?: boolean;
|
|
55
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | undefined;
|
|
55
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
|
|
56
56
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
57
57
|
suggestEstimatedItemSize?: boolean;
|
|
58
58
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
@@ -106,7 +106,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
106
106
|
recycleItems?: boolean;
|
|
107
107
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
108
108
|
refreshing?: boolean;
|
|
109
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | undefined;
|
|
109
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
|
|
110
110
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
111
111
|
suggestEstimatedItemSize?: boolean;
|
|
112
112
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
@@ -128,7 +128,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
128
128
|
itemKey: string;
|
|
129
129
|
itemData: ItemT_1;
|
|
130
130
|
}) => void) | undefined;
|
|
131
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT_1>) => React.ReactNode) | undefined;
|
|
131
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT_1>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<ItemT_1>> | undefined;
|
|
132
132
|
animatedProps?: Partial<{
|
|
133
133
|
contentOffset?: react_native.PointProp | react_native_reanimated.SharedValue<react_native.PointProp | undefined> | undefined;
|
|
134
134
|
contentInset?: Insets | react_native_reanimated.SharedValue<Insets | undefined> | undefined;
|
|
@@ -343,7 +343,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
343
343
|
recycleItems?: boolean;
|
|
344
344
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
345
345
|
refreshing?: boolean;
|
|
346
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | undefined;
|
|
346
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<T>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<T>> | undefined;
|
|
347
347
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
348
348
|
suggestEstimatedItemSize?: boolean;
|
|
349
349
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
|
@@ -397,7 +397,7 @@ declare const LegendList: <ItemT, ListT extends (<T>(props: Omit<Omit<react_nati
|
|
|
397
397
|
recycleItems?: boolean;
|
|
398
398
|
refScrollView?: React.Ref<react_native.ScrollView>;
|
|
399
399
|
refreshing?: boolean;
|
|
400
|
-
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT>) => React.ReactNode) | undefined;
|
|
400
|
+
renderItem?: ((props: _legendapp_list.LegendListRenderItemProps<ItemT>) => React.ReactNode) | React.ComponentType<_legendapp_list.LegendListRenderItemProps<ItemT>> | undefined;
|
|
401
401
|
renderScrollComponent?: (props: react_native.ScrollViewProps) => React.ReactElement<react_native.ScrollViewProps>;
|
|
402
402
|
suggestEstimatedItemSize?: boolean;
|
|
403
403
|
viewabilityConfig?: _legendapp_list.ViewabilityConfig;
|
package/package.json
CHANGED