@legendapp/list 3.3.2 → 3.3.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/CHANGELOG.md +22 -0
- package/animated.d.ts +16 -9
- package/keyboard-legacy.d.ts +10 -8
- package/keyboard.d.ts +16 -13
- package/keyboard.js +1 -1
- package/keyboard.mjs +1 -1
- package/package.json +1 -1
- package/react-native.d.ts +17 -10
- package/react-native.js +1468 -1112
- package/react-native.mjs +1469 -1113
- package/react-native.web.d.ts +19 -14
- package/react-native.web.js +1523 -1156
- package/react-native.web.mjs +1524 -1157
- package/react.d.ts +19 -14
- package/react.js +1523 -1156
- package/react.mjs +1524 -1157
- package/reanimated.d.ts +16 -9
- package/reanimated.js +19 -11
- package/reanimated.mjs +20 -12
- package/section-list.d.ts +16 -9
package/reanimated.d.ts
CHANGED
|
@@ -9,12 +9,13 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
|
|
|
9
9
|
shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `
|
|
12
|
+
type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
13
13
|
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
14
14
|
type ListenerTypeValueMap = {
|
|
15
15
|
activeStickyIndex: number;
|
|
16
16
|
alignItemsAtEndPadding: number;
|
|
17
17
|
anchoredEndSpaceSize: number;
|
|
18
|
+
containerLayoutEpoch: number;
|
|
18
19
|
animatedScrollY: any;
|
|
19
20
|
debugComputedScroll: number;
|
|
20
21
|
debugRawScroll: number;
|
|
@@ -50,7 +51,7 @@ type ListenerTypeValueMap = {
|
|
|
50
51
|
} & {
|
|
51
52
|
[K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
|
|
52
53
|
} & {
|
|
53
|
-
[K in ListenerType as K extends `
|
|
54
|
+
[K in ListenerType as K extends `containerItemIndex${number}` ? K : never]: number;
|
|
54
55
|
} & {
|
|
55
56
|
[K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
|
|
56
57
|
} & {
|
|
@@ -60,11 +61,6 @@ type ListenerTypeValueMap = {
|
|
|
60
61
|
} & {
|
|
61
62
|
[K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
|
|
62
63
|
};
|
|
63
|
-
interface ContainerItemInfo {
|
|
64
|
-
index: number;
|
|
65
|
-
itemKey: string;
|
|
66
|
-
value: any;
|
|
67
|
-
}
|
|
68
64
|
|
|
69
65
|
interface Insets {
|
|
70
66
|
top: number;
|
|
@@ -460,11 +456,15 @@ interface ScrollToEndOptions {
|
|
|
460
456
|
viewOffset?: number;
|
|
461
457
|
}
|
|
462
458
|
interface AnchoredEndSpaceConfig {
|
|
459
|
+
/** Index of the item whose row should remain anchored when trailing space is added. */
|
|
463
460
|
anchorIndex: number;
|
|
461
|
+
/** Desired distance from the viewport's start edge to the anchored row. */
|
|
464
462
|
anchorOffset?: number;
|
|
463
|
+
/** Optional cap for the anchor item's contribution to its row size. */
|
|
465
464
|
anchorMaxSize?: number;
|
|
466
|
-
|
|
465
|
+
/** Called whenever the resolved trailing space changes. */
|
|
467
466
|
onSizeChanged?: (size: number) => void;
|
|
467
|
+
/** Called once the anchor and every row after it have authoritative sizes. */
|
|
468
468
|
onReady?: (info: AnchoredEndSpaceReadyInfo) => void;
|
|
469
469
|
}
|
|
470
470
|
interface StickyHeaderConfig {
|
|
@@ -539,6 +539,7 @@ type LegendListState = {
|
|
|
539
539
|
isStartReached: boolean;
|
|
540
540
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
541
541
|
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
542
|
+
indexByKey: (key: string) => number | undefined;
|
|
542
543
|
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
543
544
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
544
545
|
positionAtIndex: (index: number) => number;
|
|
@@ -568,6 +569,10 @@ type LegendListRef$1 = {
|
|
|
568
569
|
* Returns the native ScrollView component reference.
|
|
569
570
|
*/
|
|
570
571
|
getNativeScrollRef(): any;
|
|
572
|
+
/**
|
|
573
|
+
* Returns the underlying animatable scroll component reference.
|
|
574
|
+
*/
|
|
575
|
+
getAnimatableRef(): any;
|
|
571
576
|
/**
|
|
572
577
|
* Returns the scroll responder instance for handling scroll events.
|
|
573
578
|
*/
|
|
@@ -720,6 +725,7 @@ interface ViewabilityConfig {
|
|
|
720
725
|
}
|
|
721
726
|
|
|
722
727
|
type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "anchoredEndSpace" | "contentInsetEndAdjustment" | "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
|
|
728
|
+
anchoredEndSpace?: AnchoredEndSpaceConfig;
|
|
723
729
|
onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
|
|
724
730
|
refScrollView?: React.Ref<ScrollView>;
|
|
725
731
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
@@ -727,7 +733,8 @@ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omi
|
|
|
727
733
|
ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
|
|
728
734
|
};
|
|
729
735
|
type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
|
|
730
|
-
type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
|
|
736
|
+
type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
|
|
737
|
+
getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
731
738
|
getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
732
739
|
getScrollResponder(): ScrollResponderMixin;
|
|
733
740
|
reportContentInset(inset?: Partial<Insets$1> | null): void;
|
package/reanimated.js
CHANGED
|
@@ -41,6 +41,13 @@ var {
|
|
|
41
41
|
getComponent
|
|
42
42
|
} = reactNative.internal;
|
|
43
43
|
var { peek$, useStateContext } = reactNative.internal;
|
|
44
|
+
var ReanimatedScrollOffsetTracker = ({
|
|
45
|
+
animatedScrollRef,
|
|
46
|
+
scrollOffset
|
|
47
|
+
}) => {
|
|
48
|
+
Reanimated.useScrollViewOffset(animatedScrollRef, scrollOffset);
|
|
49
|
+
return null;
|
|
50
|
+
};
|
|
44
51
|
var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent({
|
|
45
52
|
forwardedRef,
|
|
46
53
|
scrollOffset,
|
|
@@ -48,7 +55,6 @@ var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent(
|
|
|
48
55
|
...props
|
|
49
56
|
}) {
|
|
50
57
|
const animatedScrollRef = Reanimated.useAnimatedRef();
|
|
51
|
-
Reanimated.useScrollViewOffset(animatedScrollRef, scrollOffset);
|
|
52
58
|
const combinedRef = useCombinedRef(animatedScrollRef, forwardedRef);
|
|
53
59
|
const CustomScrollComponent = useStableRenderComponent(renderScrollComponent, (scrollViewProps, ref) => ({
|
|
54
60
|
...scrollViewProps,
|
|
@@ -56,7 +62,7 @@ var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent(
|
|
|
56
62
|
scrollEventThrottle: 1
|
|
57
63
|
}));
|
|
58
64
|
const ScrollComponent = renderScrollComponent ? CustomScrollComponent : Reanimated__default.default.ScrollView;
|
|
59
|
-
return /* @__PURE__ */ React__namespace.createElement(ScrollComponent, { ...props, ref: combinedRef });
|
|
65
|
+
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, scrollOffset && /* @__PURE__ */ React__namespace.createElement(ReanimatedScrollOffsetTracker, { animatedScrollRef, scrollOffset }), /* @__PURE__ */ React__namespace.createElement(ScrollComponent, { ...props, ref: combinedRef }));
|
|
60
66
|
});
|
|
61
67
|
var StickyOverlay = typedMemo(function StickyOverlayComponent({ stickyHeaderConfig }) {
|
|
62
68
|
if (!(stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.backdropComponent)) {
|
|
@@ -77,17 +83,18 @@ var StickyOverlay = typedMemo(function StickyOverlayComponent({ stickyHeaderConf
|
|
|
77
83
|
var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStickyComponent(props) {
|
|
78
84
|
var _a;
|
|
79
85
|
const ctx = useStateContext();
|
|
80
|
-
const { id, horizontal, style, refView, stickyScrollOffset, stickyHeaderConfig,
|
|
81
|
-
const [position = POSITION_OUT_OF_VIEW, headerSize = 0, stylePaddingTop = 0, itemKey, _totalSize = 0] = useArr$([
|
|
86
|
+
const { id, horizontal, style, refView, stickyScrollOffset, stickyHeaderConfig, children, ...rest } = props;
|
|
87
|
+
const [position = POSITION_OUT_OF_VIEW, headerSize = 0, stylePaddingTop = 0, itemKey, itemIndex, _totalSize = 0] = useArr$([
|
|
82
88
|
`containerPosition${id}`,
|
|
83
89
|
"headerSize",
|
|
84
90
|
"stylePaddingTop",
|
|
85
91
|
`containerItemKey${id}`,
|
|
92
|
+
`containerItemIndex${id}`,
|
|
86
93
|
"totalSize"
|
|
87
94
|
]);
|
|
88
95
|
const pushLimit = React__namespace.useMemo(
|
|
89
|
-
() => getStickyPushLimit(ctx.state,
|
|
90
|
-
[ctx.state,
|
|
96
|
+
() => getStickyPushLimit(ctx.state, itemIndex, itemKey),
|
|
97
|
+
[ctx.state, itemIndex, itemKey, _totalSize]
|
|
91
98
|
);
|
|
92
99
|
const stickyOffset = (_a = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a : 0;
|
|
93
100
|
const stickyStart = position + headerSize + stylePaddingTop - stickyOffset;
|
|
@@ -98,8 +105,8 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
|
|
|
98
105
|
return horizontal ? { transform: [{ translateX: resolvedPosition }] } : { transform: [{ translateY: resolvedPosition }] };
|
|
99
106
|
}, [horizontal, position, pushLimit, stickyStart]);
|
|
100
107
|
const viewStyle = React__namespace.useMemo(
|
|
101
|
-
() => [style, { zIndex:
|
|
102
|
-
[
|
|
108
|
+
() => [style, { zIndex: itemIndex + 1e3 }, stickyPositionStyle],
|
|
109
|
+
[itemIndex, stickyPositionStyle, style]
|
|
103
110
|
);
|
|
104
111
|
return /* @__PURE__ */ React__namespace.createElement(Reanimated__default.default.View, { ref: refView, style: viewStyle, ...rest }, /* @__PURE__ */ React__namespace.createElement(StickyOverlay, { stickyHeaderConfig }), children);
|
|
105
112
|
});
|
|
@@ -185,7 +192,7 @@ function useAnimatedLegendListSharedValuesSync(legendList, sharedValues) {
|
|
|
185
192
|
var LegendListForwardedRef = typedMemo(
|
|
186
193
|
// biome-ignore lint/nursery/noShadow: const function name shadowing is intentional
|
|
187
194
|
React__namespace.forwardRef(function LegendListForwardedRef2(props, ref) {
|
|
188
|
-
var _a;
|
|
195
|
+
var _a, _b;
|
|
189
196
|
const { itemLayoutAnimation, recycleItems, refLegendList, renderScrollComponent, sharedValues, ...rest } = props;
|
|
190
197
|
const refFn = React.useCallback(
|
|
191
198
|
(r) => {
|
|
@@ -195,6 +202,7 @@ var LegendListForwardedRef = typedMemo(
|
|
|
195
202
|
);
|
|
196
203
|
const internalScrollOffset = Reanimated.useSharedValue(0);
|
|
197
204
|
const scrollOffset = (_a = sharedValues == null ? void 0 : sharedValues.scrollOffset) != null ? _a : internalScrollOffset;
|
|
205
|
+
const trackedScrollOffset = (sharedValues == null ? void 0 : sharedValues.scrollOffset) !== void 0 || ((_b = rest.stickyHeaderIndices) == null ? void 0 : _b.length) ? scrollOffset : void 0;
|
|
198
206
|
const renderScrollComponentForBridge = React__namespace.useMemo(
|
|
199
207
|
() => renderScrollComponent ? (scrollViewProps) => renderScrollComponent(scrollViewProps) : void 0,
|
|
200
208
|
[renderScrollComponent]
|
|
@@ -208,11 +216,11 @@ var LegendListForwardedRef = typedMemo(
|
|
|
208
216
|
...restScrollViewProps,
|
|
209
217
|
forwardedRef,
|
|
210
218
|
renderScrollComponent: renderScrollComponentForBridge,
|
|
211
|
-
scrollOffset
|
|
219
|
+
scrollOffset: trackedScrollOffset
|
|
212
220
|
}
|
|
213
221
|
);
|
|
214
222
|
},
|
|
215
|
-
[renderScrollComponentForBridge,
|
|
223
|
+
[renderScrollComponentForBridge, trackedScrollOffset]
|
|
216
224
|
);
|
|
217
225
|
const stickyPositionComponentInternal = React__namespace.useMemo(
|
|
218
226
|
() => function StickyPositionComponent(stickyProps) {
|
package/reanimated.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
|
-
import Reanimated, { useAnimatedRef,
|
|
4
|
+
import Reanimated, { useAnimatedRef, useAnimatedStyle, useSharedValue, useScrollViewOffset } from 'react-native-reanimated';
|
|
5
5
|
import { internal, LegendList } from '@legendapp/list/react-native';
|
|
6
6
|
|
|
7
7
|
// src/integrations/reanimated.tsx
|
|
@@ -17,6 +17,13 @@ var {
|
|
|
17
17
|
getComponent
|
|
18
18
|
} = internal;
|
|
19
19
|
var { peek$, useStateContext } = internal;
|
|
20
|
+
var ReanimatedScrollOffsetTracker = ({
|
|
21
|
+
animatedScrollRef,
|
|
22
|
+
scrollOffset
|
|
23
|
+
}) => {
|
|
24
|
+
useScrollViewOffset(animatedScrollRef, scrollOffset);
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
20
27
|
var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent({
|
|
21
28
|
forwardedRef,
|
|
22
29
|
scrollOffset,
|
|
@@ -24,7 +31,6 @@ var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent(
|
|
|
24
31
|
...props
|
|
25
32
|
}) {
|
|
26
33
|
const animatedScrollRef = useAnimatedRef();
|
|
27
|
-
useScrollViewOffset(animatedScrollRef, scrollOffset);
|
|
28
34
|
const combinedRef = useCombinedRef(animatedScrollRef, forwardedRef);
|
|
29
35
|
const CustomScrollComponent = useStableRenderComponent(renderScrollComponent, (scrollViewProps, ref) => ({
|
|
30
36
|
...scrollViewProps,
|
|
@@ -32,7 +38,7 @@ var ReanimatedScrollBridge = typedMemo(function ReanimatedScrollBridgeComponent(
|
|
|
32
38
|
scrollEventThrottle: 1
|
|
33
39
|
}));
|
|
34
40
|
const ScrollComponent = renderScrollComponent ? CustomScrollComponent : Reanimated.ScrollView;
|
|
35
|
-
return /* @__PURE__ */ React.createElement(ScrollComponent, { ...props, ref: combinedRef });
|
|
41
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, scrollOffset && /* @__PURE__ */ React.createElement(ReanimatedScrollOffsetTracker, { animatedScrollRef, scrollOffset }), /* @__PURE__ */ React.createElement(ScrollComponent, { ...props, ref: combinedRef }));
|
|
36
42
|
});
|
|
37
43
|
var StickyOverlay = typedMemo(function StickyOverlayComponent({ stickyHeaderConfig }) {
|
|
38
44
|
if (!(stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.backdropComponent)) {
|
|
@@ -53,17 +59,18 @@ var StickyOverlay = typedMemo(function StickyOverlayComponent({ stickyHeaderConf
|
|
|
53
59
|
var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStickyComponent(props) {
|
|
54
60
|
var _a;
|
|
55
61
|
const ctx = useStateContext();
|
|
56
|
-
const { id, horizontal, style, refView, stickyScrollOffset, stickyHeaderConfig,
|
|
57
|
-
const [position = POSITION_OUT_OF_VIEW, headerSize = 0, stylePaddingTop = 0, itemKey, _totalSize = 0] = useArr$([
|
|
62
|
+
const { id, horizontal, style, refView, stickyScrollOffset, stickyHeaderConfig, children, ...rest } = props;
|
|
63
|
+
const [position = POSITION_OUT_OF_VIEW, headerSize = 0, stylePaddingTop = 0, itemKey, itemIndex, _totalSize = 0] = useArr$([
|
|
58
64
|
`containerPosition${id}`,
|
|
59
65
|
"headerSize",
|
|
60
66
|
"stylePaddingTop",
|
|
61
67
|
`containerItemKey${id}`,
|
|
68
|
+
`containerItemIndex${id}`,
|
|
62
69
|
"totalSize"
|
|
63
70
|
]);
|
|
64
71
|
const pushLimit = React.useMemo(
|
|
65
|
-
() => getStickyPushLimit(ctx.state,
|
|
66
|
-
[ctx.state,
|
|
72
|
+
() => getStickyPushLimit(ctx.state, itemIndex, itemKey),
|
|
73
|
+
[ctx.state, itemIndex, itemKey, _totalSize]
|
|
67
74
|
);
|
|
68
75
|
const stickyOffset = (_a = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a : 0;
|
|
69
76
|
const stickyStart = position + headerSize + stylePaddingTop - stickyOffset;
|
|
@@ -74,8 +81,8 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
|
|
|
74
81
|
return horizontal ? { transform: [{ translateX: resolvedPosition }] } : { transform: [{ translateY: resolvedPosition }] };
|
|
75
82
|
}, [horizontal, position, pushLimit, stickyStart]);
|
|
76
83
|
const viewStyle = React.useMemo(
|
|
77
|
-
() => [style, { zIndex:
|
|
78
|
-
[
|
|
84
|
+
() => [style, { zIndex: itemIndex + 1e3 }, stickyPositionStyle],
|
|
85
|
+
[itemIndex, stickyPositionStyle, style]
|
|
79
86
|
);
|
|
80
87
|
return /* @__PURE__ */ React.createElement(Reanimated.View, { ref: refView, style: viewStyle, ...rest }, /* @__PURE__ */ React.createElement(StickyOverlay, { stickyHeaderConfig }), children);
|
|
81
88
|
});
|
|
@@ -161,7 +168,7 @@ function useAnimatedLegendListSharedValuesSync(legendList, sharedValues) {
|
|
|
161
168
|
var LegendListForwardedRef = typedMemo(
|
|
162
169
|
// biome-ignore lint/nursery/noShadow: const function name shadowing is intentional
|
|
163
170
|
React.forwardRef(function LegendListForwardedRef2(props, ref) {
|
|
164
|
-
var _a;
|
|
171
|
+
var _a, _b;
|
|
165
172
|
const { itemLayoutAnimation, recycleItems, refLegendList, renderScrollComponent, sharedValues, ...rest } = props;
|
|
166
173
|
const refFn = useCallback(
|
|
167
174
|
(r) => {
|
|
@@ -171,6 +178,7 @@ var LegendListForwardedRef = typedMemo(
|
|
|
171
178
|
);
|
|
172
179
|
const internalScrollOffset = useSharedValue(0);
|
|
173
180
|
const scrollOffset = (_a = sharedValues == null ? void 0 : sharedValues.scrollOffset) != null ? _a : internalScrollOffset;
|
|
181
|
+
const trackedScrollOffset = (sharedValues == null ? void 0 : sharedValues.scrollOffset) !== void 0 || ((_b = rest.stickyHeaderIndices) == null ? void 0 : _b.length) ? scrollOffset : void 0;
|
|
174
182
|
const renderScrollComponentForBridge = React.useMemo(
|
|
175
183
|
() => renderScrollComponent ? (scrollViewProps) => renderScrollComponent(scrollViewProps) : void 0,
|
|
176
184
|
[renderScrollComponent]
|
|
@@ -184,11 +192,11 @@ var LegendListForwardedRef = typedMemo(
|
|
|
184
192
|
...restScrollViewProps,
|
|
185
193
|
forwardedRef,
|
|
186
194
|
renderScrollComponent: renderScrollComponentForBridge,
|
|
187
|
-
scrollOffset
|
|
195
|
+
scrollOffset: trackedScrollOffset
|
|
188
196
|
}
|
|
189
197
|
);
|
|
190
198
|
},
|
|
191
|
-
[renderScrollComponentForBridge,
|
|
199
|
+
[renderScrollComponentForBridge, trackedScrollOffset]
|
|
192
200
|
);
|
|
193
201
|
const stickyPositionComponentInternal = React.useMemo(
|
|
194
202
|
() => function StickyPositionComponent(stickyProps) {
|
package/section-list.d.ts
CHANGED
|
@@ -65,12 +65,13 @@ interface MaintainVisibleContentPositionNormalized<ItemT = any> {
|
|
|
65
65
|
shouldRestorePosition?: (item: ItemT, index: number, data: readonly ItemT[]) => boolean;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `
|
|
68
|
+
type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
69
69
|
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
70
70
|
type ListenerTypeValueMap = {
|
|
71
71
|
activeStickyIndex: number;
|
|
72
72
|
alignItemsAtEndPadding: number;
|
|
73
73
|
anchoredEndSpaceSize: number;
|
|
74
|
+
containerLayoutEpoch: number;
|
|
74
75
|
animatedScrollY: any;
|
|
75
76
|
debugComputedScroll: number;
|
|
76
77
|
debugRawScroll: number;
|
|
@@ -106,7 +107,7 @@ type ListenerTypeValueMap = {
|
|
|
106
107
|
} & {
|
|
107
108
|
[K in ListenerType as K extends `containerItemData${number}` ? K : never]: any;
|
|
108
109
|
} & {
|
|
109
|
-
[K in ListenerType as K extends `
|
|
110
|
+
[K in ListenerType as K extends `containerItemIndex${number}` ? K : never]: number;
|
|
110
111
|
} & {
|
|
111
112
|
[K in ListenerType as K extends `containerPosition${number}` ? K : never]: number;
|
|
112
113
|
} & {
|
|
@@ -116,11 +117,6 @@ type ListenerTypeValueMap = {
|
|
|
116
117
|
} & {
|
|
117
118
|
[K in ListenerType as K extends `containerSticky${number}` ? K : never]: boolean;
|
|
118
119
|
};
|
|
119
|
-
interface ContainerItemInfo {
|
|
120
|
-
index: number;
|
|
121
|
-
itemKey: string;
|
|
122
|
-
value: any;
|
|
123
|
-
}
|
|
124
120
|
|
|
125
121
|
interface Insets {
|
|
126
122
|
top: number;
|
|
@@ -516,11 +512,15 @@ interface ScrollToEndOptions {
|
|
|
516
512
|
viewOffset?: number;
|
|
517
513
|
}
|
|
518
514
|
interface AnchoredEndSpaceConfig {
|
|
515
|
+
/** Index of the item whose row should remain anchored when trailing space is added. */
|
|
519
516
|
anchorIndex: number;
|
|
517
|
+
/** Desired distance from the viewport's start edge to the anchored row. */
|
|
520
518
|
anchorOffset?: number;
|
|
519
|
+
/** Optional cap for the anchor item's contribution to its row size. */
|
|
521
520
|
anchorMaxSize?: number;
|
|
522
|
-
|
|
521
|
+
/** Called whenever the resolved trailing space changes. */
|
|
523
522
|
onSizeChanged?: (size: number) => void;
|
|
523
|
+
/** Called once the anchor and every row after it have authoritative sizes. */
|
|
524
524
|
onReady?: (info: AnchoredEndSpaceReadyInfo) => void;
|
|
525
525
|
}
|
|
526
526
|
interface StickyHeaderConfig {
|
|
@@ -595,6 +595,7 @@ type LegendListState = {
|
|
|
595
595
|
isStartReached: boolean;
|
|
596
596
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
597
597
|
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
598
|
+
indexByKey: (key: string) => number | undefined;
|
|
598
599
|
listen: <T extends LegendListListenerType>(listenerType: T, callback: (value: ListenerTypeValueMap[T]) => void) => () => void;
|
|
599
600
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
600
601
|
positionAtIndex: (index: number) => number;
|
|
@@ -624,6 +625,10 @@ type LegendListRef$1 = {
|
|
|
624
625
|
* Returns the native ScrollView component reference.
|
|
625
626
|
*/
|
|
626
627
|
getNativeScrollRef(): any;
|
|
628
|
+
/**
|
|
629
|
+
* Returns the underlying animatable scroll component reference.
|
|
630
|
+
*/
|
|
631
|
+
getAnimatableRef(): any;
|
|
627
632
|
/**
|
|
628
633
|
* Returns the scroll responder instance for handling scroll events.
|
|
629
634
|
*/
|
|
@@ -776,6 +781,7 @@ interface ViewabilityConfig {
|
|
|
776
781
|
}
|
|
777
782
|
|
|
778
783
|
type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omit<LegendListPropsBase<ItemT, ScrollViewProps, TItemType>, "anchoredEndSpace" | "contentInsetEndAdjustment" | "onScroll" | "refScrollView" | "renderScrollComponent" | "ListHeaderComponentStyle" | "ListFooterComponentStyle"> & {
|
|
784
|
+
anchoredEndSpace?: AnchoredEndSpaceConfig;
|
|
779
785
|
onScroll?: (event: NativeSyntheticEvent$1<NativeScrollEvent$1>) => void;
|
|
780
786
|
refScrollView?: React.Ref<ScrollView>;
|
|
781
787
|
renderScrollComponent?: (props: ScrollViewProps) => React.ReactElement<ScrollViewProps>;
|
|
@@ -783,7 +789,8 @@ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omi
|
|
|
783
789
|
ListFooterComponentStyle?: StyleProp$1<ViewStyle$1> | undefined;
|
|
784
790
|
};
|
|
785
791
|
type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
|
|
786
|
-
type LegendListRef = Omit<LegendListRef$1, "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
|
|
792
|
+
type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
|
|
793
|
+
getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
787
794
|
getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
788
795
|
getScrollResponder(): ScrollResponderMixin;
|
|
789
796
|
reportContentInset(inset?: Partial<Insets$1> | null): void;
|