@legendapp/list 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +4 -3
- package/animated.d.ts +95 -9
- package/keyboard-legacy.d.ts +62 -4
- package/keyboard.d.ts +63 -7
- package/keyboard.js +193 -13
- package/keyboard.mjs +196 -16
- package/package.json +1 -1
- package/react-native.d.ts +101 -9
- package/react-native.js +2384 -1816
- package/react-native.mjs +2385 -1817
- package/react-native.web.d.ts +100 -9
- package/react-native.web.js +2113 -1370
- package/react-native.web.mjs +2113 -1370
- package/react.d.ts +100 -9
- package/react.js +2113 -1370
- package/react.mjs +2113 -1370
- package/reanimated.d.ts +95 -9
- package/reanimated.js +17 -29
- package/reanimated.mjs +17 -29
- package/section-list.d.ts +107 -10
- package/section-list.js +10 -2
- package/section-list.mjs +10 -2
- package/.DS_Store +0 -0
package/reanimated.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ 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" | "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}` | `containerLayoutReady${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
13
|
-
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | "lastItemKeys" | "lastPositionUpdate" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "snapToOffsets" | "totalSize">;
|
|
12
|
+
type ListenerType = "activeStickyIndex" | "alignItemsAtEndPadding" | "anchoredEndSpaceSize" | "containerLayoutEpoch" | "debugComputedScroll" | "debugRawScroll" | "extraData" | "footerSize" | "headerSize" | "lastItemKeys" | "lastPositionUpdate" | "maintainVisibleContentPosition" | "numColumns" | "numContainers" | "numContainersPooled" | "otherAxisSize" | "readyToRender" | "isScrollActive" | "scrollAdjust" | "scrollAdjustPending" | "scrollAdjustUserOffset" | "scrollSize" | "snapToOffsets" | "stylePaddingTop" | "totalSize" | "isFollowingEnd" | "isAtEnd" | "isAtStart" | "isNearEnd" | "isNearStart" | "isWithinMaintainScrollAtEndThreshold" | "adaptiveRender" | `containerColumn${number}` | `containerSpan${number}` | `containerItemData${number}` | `containerItemIndex${number}` | `containerItemKey${number}` | `containerLayoutReady${number}` | `containerPosition${number}` | `containerSticky${number}`;
|
|
13
|
+
type LegendListListenerType = Extract<ListenerType, "activeStickyIndex" | "anchoredEndSpaceSize" | "footerSize" | "headerSize" | "isFollowingEnd" | "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;
|
|
@@ -22,6 +22,7 @@ type ListenerTypeValueMap = {
|
|
|
22
22
|
extraData: any;
|
|
23
23
|
footerSize: number;
|
|
24
24
|
headerSize: number;
|
|
25
|
+
isFollowingEnd: boolean;
|
|
25
26
|
isAtEnd: boolean;
|
|
26
27
|
isAtStart: boolean;
|
|
27
28
|
isNearEnd: boolean;
|
|
@@ -35,6 +36,7 @@ type ListenerTypeValueMap = {
|
|
|
35
36
|
numContainersPooled: number;
|
|
36
37
|
otherAxisSize: number;
|
|
37
38
|
readyToRender: boolean;
|
|
39
|
+
isScrollActive: boolean;
|
|
38
40
|
scrollAdjust: number;
|
|
39
41
|
scrollAdjustPending: number;
|
|
40
42
|
scrollAdjustUserOffset: number;
|
|
@@ -200,6 +202,7 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
200
202
|
extraData?: any;
|
|
201
203
|
/**
|
|
202
204
|
* In case items always have a fixed size, you can provide a function to return it.
|
|
205
|
+
* Change extraData when the fixed sizes returned by this callback change.
|
|
203
206
|
*/
|
|
204
207
|
getFixedItemSize?: (item: ItemT, index: number, type: TItemType) => number | undefined;
|
|
205
208
|
/**
|
|
@@ -226,6 +229,8 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
226
229
|
index: number;
|
|
227
230
|
viewOffset?: number | undefined;
|
|
228
231
|
viewPosition?: number | undefined;
|
|
232
|
+
/** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
|
|
233
|
+
viewPositionFallback?: "start" | "end";
|
|
229
234
|
};
|
|
230
235
|
/**
|
|
231
236
|
* Initial scroll position in pixels.
|
|
@@ -270,6 +275,11 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
270
275
|
/**
|
|
271
276
|
* If true, auto-scrolls to end when new items are added.
|
|
272
277
|
* Use an options object to opt into specific triggers and control whether that scroll is animated.
|
|
278
|
+
* Setting false pauses maintenance while retaining end-follow intent. Re-enabling resumes
|
|
279
|
+
* that intent even if content grew beyond the threshold; user or list navigation releases it.
|
|
280
|
+
* While paused, isFollowingEnd reports the retained intent.
|
|
281
|
+
* With a native screen reader enabled, unowned accessibility scrolls toward the start
|
|
282
|
+
* release following. Assistive-tech scrolls during library animations are not detected.
|
|
273
283
|
* @default false
|
|
274
284
|
*/
|
|
275
285
|
maintainScrollAtEnd?: boolean | MaintainScrollAtEndOptions;
|
|
@@ -280,11 +290,13 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
280
290
|
maintainScrollAtEndThreshold?: number;
|
|
281
291
|
/**
|
|
282
292
|
* Maintains visibility of content.
|
|
283
|
-
* -
|
|
284
|
-
* - data (default: false) stabilizes when the data array changes
|
|
293
|
+
* - size (default: true) stabilizes during size/layout changes while scrolling.
|
|
294
|
+
* - data (default: false) stabilizes when the data array changes.
|
|
285
295
|
* - shouldRestorePosition can opt out specific items from data-change anchoring.
|
|
286
296
|
* - undefined (default) enables scroll stabilization but skips data-change anchoring.
|
|
287
|
-
* - true enables both behaviors; false disables both.
|
|
297
|
+
* - true enables both JS behaviors; false disables both.
|
|
298
|
+
* Native iOS maintainVisibleContentPosition is enabled when either size or data stabilization is enabled,
|
|
299
|
+
* and disabled when both are disabled.
|
|
288
300
|
*/
|
|
289
301
|
maintainVisibleContentPosition?: boolean | MaintainVisibleContentPositionConfig<ItemT>;
|
|
290
302
|
/**
|
|
@@ -376,8 +388,25 @@ interface LegendListSpecificProps<ItemT, TItemType extends string | undefined> {
|
|
|
376
388
|
*/
|
|
377
389
|
onRefresh?: () => void;
|
|
378
390
|
/**
|
|
379
|
-
* Called
|
|
380
|
-
|
|
391
|
+
* Called once per accepted user gesture, in either direction: native drag (including
|
|
392
|
+
* momentum), web wheel/touch movement, non-repeated scroll keydown, or scrollbar drag.
|
|
393
|
+
* Wheel input at a boundary is ignored unless navigation is active. Without wheel
|
|
394
|
+
* momentum metadata, gesture boundaries are inferred from timing, direction and force.
|
|
395
|
+
* iOS status-bar scrolling emits on native onScrollToTop unless accessibility motion
|
|
396
|
+
* already reported it during the animation.
|
|
397
|
+
* With a native screen reader enabled, otherwise unowned scroll motion with stable
|
|
398
|
+
* content/viewport size is inferred as accessibility input (including focus navigation),
|
|
399
|
+
* once per burst; motion toward the start releases end following. Library animations
|
|
400
|
+
* and controller/native-ref command windows mask assistive-tech scrolling.
|
|
401
|
+
* Native commands bypassing the list and its refs (e.g. Reanimated scrollTo worklets)
|
|
402
|
+
* cannot be distinguished from accessibility input while a screen reader is on; call
|
|
403
|
+
* cancelScroll() on the JS thread before that navigation to release end following.
|
|
404
|
+
* Layout/clamp/MVCP events and commands through the list or its refs do not emit it.
|
|
405
|
+
* @experimental Native pointer/wheel-only input without a screen reader is not detected.
|
|
406
|
+
* Web scrollbar detection requires pointer events in a measurable, non-overlay gutter.
|
|
407
|
+
*/
|
|
408
|
+
onUserScroll?: () => void;
|
|
409
|
+
/** Called when the list scrolls. */
|
|
381
410
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
382
411
|
/**
|
|
383
412
|
* Called when scrolling reaches the start within onStartReachedThreshold.
|
|
@@ -509,6 +538,8 @@ interface AlwaysRenderConfig {
|
|
|
509
538
|
keys?: string[];
|
|
510
539
|
}
|
|
511
540
|
interface MaintainScrollAtEndOnOptions {
|
|
541
|
+
/** Follow only additions that preserve every existing item key in order. */
|
|
542
|
+
dataAppend?: boolean;
|
|
512
543
|
dataChange?: boolean;
|
|
513
544
|
footerLayout?: boolean;
|
|
514
545
|
itemLayout?: boolean;
|
|
@@ -550,9 +581,13 @@ type LegendListState = {
|
|
|
550
581
|
activeStickyIndex: number;
|
|
551
582
|
contentLength: number;
|
|
552
583
|
data: readonly any[];
|
|
584
|
+
dataKey?: Key;
|
|
553
585
|
elementAtIndex: (index: number) => any;
|
|
554
586
|
end: number;
|
|
555
587
|
endBuffered: number;
|
|
588
|
+
/** Distance to the physical scroll edge, including the trailing inset. */
|
|
589
|
+
distanceFromEnd: number;
|
|
590
|
+
isFollowingEnd: boolean;
|
|
556
591
|
isAtEnd: boolean;
|
|
557
592
|
isAtStart: boolean;
|
|
558
593
|
isNearEnd: boolean;
|
|
@@ -562,7 +597,10 @@ type LegendListState = {
|
|
|
562
597
|
isWithinMaintainScrollAtEndThreshold: boolean;
|
|
563
598
|
getAverageItemSizes: () => Record<string, LegendListAverageItemSize>;
|
|
564
599
|
indexByKey: (key: string) => number | undefined;
|
|
565
|
-
listen:
|
|
600
|
+
listen: {
|
|
601
|
+
<T extends Exclude<LegendListListenerType, "isFollowingEnd">>(listenerType: T, callback: (value: Pick<ListenerTypeValueMap, LegendListListenerType>[T]) => void): () => void;
|
|
602
|
+
<T extends LegendListListenerType>(listenerType: T, callback: (value: Pick<ListenerTypeValueMap, LegendListListenerType>[T]) => void): () => void;
|
|
603
|
+
};
|
|
566
604
|
listenToPosition: (key: string, callback: (value: number) => void) => () => void;
|
|
567
605
|
positionAtIndex: (index: number) => number;
|
|
568
606
|
positionByKey: (key: string) => number | undefined;
|
|
@@ -575,6 +613,28 @@ type LegendListState = {
|
|
|
575
613
|
startBuffered: number;
|
|
576
614
|
};
|
|
577
615
|
type LegendListRef$1 = {
|
|
616
|
+
/** Cancels queued and active scrolling, settles its promise, and stops at the observed offset. */
|
|
617
|
+
cancelScroll(): void;
|
|
618
|
+
/** Scrolls by stable item identity through prepends; resolves without scrolling if the key is missing or removed. */
|
|
619
|
+
scrollToKey(params: {
|
|
620
|
+
key: string;
|
|
621
|
+
animated?: boolean;
|
|
622
|
+
viewOffset?: number;
|
|
623
|
+
viewPosition?: number;
|
|
624
|
+
}): Promise<void>;
|
|
625
|
+
/**
|
|
626
|
+
* Captures an item's key and viewport offset, holding it through layout changes by default.
|
|
627
|
+
* Omit key to use the first visible item; set hold to false to read without side effects.
|
|
628
|
+
* Returns undefined before initial placement, during dataset replacement, or if no item is found.
|
|
629
|
+
* While following at the end, returns the anchor without interrupting end following.
|
|
630
|
+
*/
|
|
631
|
+
anchorVisibleContent(options?: {
|
|
632
|
+
key?: string;
|
|
633
|
+
hold?: boolean;
|
|
634
|
+
}): {
|
|
635
|
+
key: string;
|
|
636
|
+
offset: number;
|
|
637
|
+
} | undefined;
|
|
578
638
|
/**
|
|
579
639
|
* Clears internal virtualization caches.
|
|
580
640
|
* @param options - Cache clearing options.
|
|
@@ -617,20 +677,40 @@ type LegendListRef$1 = {
|
|
|
617
677
|
* @param params - Parameters for scrolling.
|
|
618
678
|
* @param params.animated - If true, animates the scroll. Default: true.
|
|
619
679
|
* @param params.index - The index to scroll to.
|
|
680
|
+
* @param params.itemOffset - Region start measured from the item's start along the scroll axis. Default: 0 when itemLength is provided.
|
|
681
|
+
* @param params.itemLength - Region length along the scroll axis. Default: 0 when itemOffset is provided. Omit both to reveal the whole item.
|
|
682
|
+
* @param params.viewportMargin - Space to keep clear at the start and end of the viewport along the scroll axis.
|
|
683
|
+
* The region should be within the item. A visible region does not scroll; otherwise its nearest edge aligns inside the margins. A region larger than the available space aligns its start.
|
|
620
684
|
*/
|
|
621
685
|
scrollIndexIntoView(params: {
|
|
622
686
|
animated?: boolean | undefined;
|
|
623
687
|
index: number;
|
|
688
|
+
itemOffset?: number;
|
|
689
|
+
itemLength?: number;
|
|
690
|
+
viewportMargin?: {
|
|
691
|
+
start?: number;
|
|
692
|
+
end?: number;
|
|
693
|
+
};
|
|
624
694
|
}): Promise<void>;
|
|
625
695
|
/**
|
|
626
|
-
* Scrolls a specific
|
|
696
|
+
* Scrolls a specific item into view.
|
|
627
697
|
* @param params - Parameters for scrolling.
|
|
628
698
|
* @param params.animated - If true, animates the scroll. Default: true.
|
|
629
699
|
* @param params.item - The item to scroll to.
|
|
700
|
+
* @param params.itemOffset - Region start measured from the item's start along the scroll axis. Default: 0 when itemLength is provided.
|
|
701
|
+
* @param params.itemLength - Region length along the scroll axis. Default: 0 when itemOffset is provided. Omit both to reveal the whole item.
|
|
702
|
+
* @param params.viewportMargin - Space to keep clear at the start and end of the viewport along the scroll axis.
|
|
703
|
+
* The region should be within the item. A visible region does not scroll; otherwise its nearest edge aligns inside the margins. A region larger than the available space aligns its start.
|
|
630
704
|
*/
|
|
631
705
|
scrollItemIntoView(params: {
|
|
632
706
|
animated?: boolean | undefined;
|
|
633
707
|
item: any;
|
|
708
|
+
itemOffset?: number;
|
|
709
|
+
itemLength?: number;
|
|
710
|
+
viewportMargin?: {
|
|
711
|
+
start?: number;
|
|
712
|
+
end?: number;
|
|
713
|
+
};
|
|
634
714
|
}): Promise<void>;
|
|
635
715
|
/**
|
|
636
716
|
* Scrolls to the end of the list.
|
|
@@ -652,6 +732,8 @@ type LegendListRef$1 = {
|
|
|
652
732
|
index: number;
|
|
653
733
|
viewOffset?: number | undefined;
|
|
654
734
|
viewPosition?: number | undefined;
|
|
735
|
+
/** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
|
|
736
|
+
viewPositionFallback?: "start" | "end";
|
|
655
737
|
}): Promise<void>;
|
|
656
738
|
/**
|
|
657
739
|
* Scrolls to a specific item in the list.
|
|
@@ -666,6 +748,8 @@ type LegendListRef$1 = {
|
|
|
666
748
|
item: any;
|
|
667
749
|
viewOffset?: number | undefined;
|
|
668
750
|
viewPosition?: number | undefined;
|
|
751
|
+
/** Alignment used only when the item exceeds the viewport. Omit to preserve viewPosition. */
|
|
752
|
+
viewPositionFallback?: "start" | "end";
|
|
669
753
|
}): Promise<void>;
|
|
670
754
|
/**
|
|
671
755
|
* Scrolls to a specific offset in pixels.
|
|
@@ -756,7 +840,9 @@ type LegendListPropsOverrides<ItemT, TItemType extends string | undefined> = Omi
|
|
|
756
840
|
};
|
|
757
841
|
type LegendListProps<ItemT = any, TItemType extends string | undefined = string | undefined> = LegendListPropsOverrides<ItemT, TItemType>;
|
|
758
842
|
type LegendListRef = Omit<LegendListRef$1, "getAnimatableRef" | "getNativeScrollRef" | "getScrollResponder" | "reportContentInset"> & {
|
|
843
|
+
/** Call cancelScroll() before scrolling it directly so end following and list scrolling stop first. */
|
|
759
844
|
getAnimatableRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
845
|
+
/** Call cancelScroll() before scrolling it directly so end following and list scrolling stop first. */
|
|
760
846
|
getNativeScrollRef(): React.ElementRef<typeof ScrollViewComponent>;
|
|
761
847
|
getScrollResponder(): ScrollResponderMixin;
|
|
762
848
|
reportContentInset(inset?: Partial<Insets$1> | null): void;
|
package/reanimated.js
CHANGED
|
@@ -112,16 +112,16 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
|
|
|
112
112
|
});
|
|
113
113
|
var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(props) {
|
|
114
114
|
const ctx = useStateContext();
|
|
115
|
-
const { id, horizontal, style, refView, children,
|
|
116
|
-
const [positionValue = POSITION_OUT_OF_VIEW, layoutReady = true] = useArr$([
|
|
115
|
+
const { id, horizontal, style, refView, children, layoutTransition, ...rest } = props;
|
|
116
|
+
const [positionValue = POSITION_OUT_OF_VIEW, layoutReady = true, isScrollActive] = useArr$([
|
|
117
117
|
`containerPosition${id}`,
|
|
118
|
-
`containerLayoutReady${id}
|
|
118
|
+
`containerLayoutReady${id}`,
|
|
119
|
+
"isScrollActive"
|
|
119
120
|
]);
|
|
120
121
|
const prevItemKeyRef = React__namespace.useRef(void 0);
|
|
121
122
|
let shouldSkipTransitionForRecycleReuse = false;
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
const itemKey = peek$(ctx, itemKeySignal);
|
|
123
|
+
if (layoutTransition) {
|
|
124
|
+
const itemKey = peek$(ctx, `containerItemKey${id}`);
|
|
125
125
|
shouldSkipTransitionForRecycleReuse = itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;
|
|
126
126
|
if (itemKey !== void 0) {
|
|
127
127
|
prevItemKeyRef.current = itemKey;
|
|
@@ -129,6 +129,10 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(
|
|
|
129
129
|
} else {
|
|
130
130
|
prevItemKeyRef.current = void 0;
|
|
131
131
|
}
|
|
132
|
+
const previousAdjustment = React__namespace.useRef(ctx.state.layoutAdjustmentEpoch);
|
|
133
|
+
const wasAdjusted = previousAdjustment.current !== ctx.state.layoutAdjustmentEpoch;
|
|
134
|
+
previousAdjustment.current = ctx.state.layoutAdjustmentEpoch;
|
|
135
|
+
const shouldSkipLayoutTransition = wasAdjusted || isScrollActive || !!ctx.state.scrollingTo;
|
|
132
136
|
const viewStyle = React__namespace.useMemo(
|
|
133
137
|
() => [style, horizontal ? { left: positionValue } : { top: positionValue }, !layoutReady && { opacity: 0 }],
|
|
134
138
|
[horizontal, layoutReady, positionValue, style]
|
|
@@ -136,7 +140,7 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(
|
|
|
136
140
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
137
141
|
Reanimated__default.default.View,
|
|
138
142
|
{
|
|
139
|
-
layout: shouldSkipTransitionForRecycleReuse ? void 0 : layoutTransition,
|
|
143
|
+
layout: shouldSkipTransitionForRecycleReuse || shouldSkipLayoutTransition ? void 0 : layoutTransition,
|
|
140
144
|
ref: refView,
|
|
141
145
|
style: viewStyle,
|
|
142
146
|
...rest,
|
|
@@ -197,13 +201,7 @@ var LegendListForwardedRef = typedMemo(
|
|
|
197
201
|
// biome-ignore lint/nursery/noShadow: const function name shadowing is intentional
|
|
198
202
|
React__namespace.forwardRef(function LegendListForwardedRef2(props, ref) {
|
|
199
203
|
var _a, _b;
|
|
200
|
-
const { itemLayoutAnimation,
|
|
201
|
-
const refFn = React.useCallback(
|
|
202
|
-
(r) => {
|
|
203
|
-
refLegendList(r);
|
|
204
|
-
},
|
|
205
|
-
[refLegendList]
|
|
206
|
-
);
|
|
204
|
+
const { itemLayoutAnimation, refLegendList, renderScrollComponent, sharedValues, ...rest } = props;
|
|
207
205
|
const internalScrollOffset = Reanimated.useSharedValue(0);
|
|
208
206
|
const scrollOffset = (_a = sharedValues == null ? void 0 : sharedValues.scrollOffset) != null ? _a : internalScrollOffset;
|
|
209
207
|
const trackedScrollOffset = (sharedValues == null ? void 0 : sharedValues.scrollOffset) !== void 0 || ((_b = rest.stickyHeaderIndices) == null ? void 0 : _b.length) ? scrollOffset : void 0;
|
|
@@ -239,26 +237,16 @@ var LegendListForwardedRef = typedMemo(
|
|
|
239
237
|
return void 0;
|
|
240
238
|
}
|
|
241
239
|
return function PositionComponent(positionProps) {
|
|
242
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
243
|
-
ReanimatedPositionView,
|
|
244
|
-
{
|
|
245
|
-
...positionProps,
|
|
246
|
-
layoutTransition: itemLayoutAnimationRef.current,
|
|
247
|
-
recycleItems
|
|
248
|
-
}
|
|
249
|
-
);
|
|
240
|
+
return /* @__PURE__ */ React__namespace.createElement(ReanimatedPositionView, { ...positionProps, layoutTransition: itemLayoutAnimationRef.current });
|
|
250
241
|
};
|
|
251
|
-
}, [hasItemLayoutAnimation
|
|
242
|
+
}, [hasItemLayoutAnimation]);
|
|
252
243
|
const legendListProps = {
|
|
253
244
|
...rest,
|
|
254
245
|
positionComponentInternal,
|
|
255
|
-
|
|
256
|
-
...{
|
|
257
|
-
renderScrollComponent: renderReanimatedScrollComponent,
|
|
258
|
-
...IsNewArchitecture ? { stickyPositionComponentInternal } : {}
|
|
259
|
-
}
|
|
246
|
+
renderScrollComponent: renderReanimatedScrollComponent,
|
|
247
|
+
...IsNewArchitecture ? { stickyPositionComponentInternal } : {}
|
|
260
248
|
};
|
|
261
|
-
return /* @__PURE__ */ React__namespace.createElement(reactNative.LegendList, { ref:
|
|
249
|
+
return /* @__PURE__ */ React__namespace.createElement(reactNative.LegendList, { ref: refLegendList, refScrollView: ref, ...legendListProps });
|
|
262
250
|
})
|
|
263
251
|
);
|
|
264
252
|
var AnimatedLegendListComponent = Reanimated__default.default.createAnimatedComponent(LegendListForwardedRef);
|
package/reanimated.mjs
CHANGED
|
@@ -88,16 +88,16 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
|
|
|
88
88
|
});
|
|
89
89
|
var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(props) {
|
|
90
90
|
const ctx = useStateContext();
|
|
91
|
-
const { id, horizontal, style, refView, children,
|
|
92
|
-
const [positionValue = POSITION_OUT_OF_VIEW, layoutReady = true] = useArr$([
|
|
91
|
+
const { id, horizontal, style, refView, children, layoutTransition, ...rest } = props;
|
|
92
|
+
const [positionValue = POSITION_OUT_OF_VIEW, layoutReady = true, isScrollActive] = useArr$([
|
|
93
93
|
`containerPosition${id}`,
|
|
94
|
-
`containerLayoutReady${id}
|
|
94
|
+
`containerLayoutReady${id}`,
|
|
95
|
+
"isScrollActive"
|
|
95
96
|
]);
|
|
96
97
|
const prevItemKeyRef = React.useRef(void 0);
|
|
97
98
|
let shouldSkipTransitionForRecycleReuse = false;
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
const itemKey = peek$(ctx, itemKeySignal);
|
|
99
|
+
if (layoutTransition) {
|
|
100
|
+
const itemKey = peek$(ctx, `containerItemKey${id}`);
|
|
101
101
|
shouldSkipTransitionForRecycleReuse = itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;
|
|
102
102
|
if (itemKey !== void 0) {
|
|
103
103
|
prevItemKeyRef.current = itemKey;
|
|
@@ -105,6 +105,10 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(
|
|
|
105
105
|
} else {
|
|
106
106
|
prevItemKeyRef.current = void 0;
|
|
107
107
|
}
|
|
108
|
+
const previousAdjustment = React.useRef(ctx.state.layoutAdjustmentEpoch);
|
|
109
|
+
const wasAdjusted = previousAdjustment.current !== ctx.state.layoutAdjustmentEpoch;
|
|
110
|
+
previousAdjustment.current = ctx.state.layoutAdjustmentEpoch;
|
|
111
|
+
const shouldSkipLayoutTransition = wasAdjusted || isScrollActive || !!ctx.state.scrollingTo;
|
|
108
112
|
const viewStyle = React.useMemo(
|
|
109
113
|
() => [style, horizontal ? { left: positionValue } : { top: positionValue }, !layoutReady && { opacity: 0 }],
|
|
110
114
|
[horizontal, layoutReady, positionValue, style]
|
|
@@ -112,7 +116,7 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(
|
|
|
112
116
|
return /* @__PURE__ */ React.createElement(
|
|
113
117
|
Reanimated.View,
|
|
114
118
|
{
|
|
115
|
-
layout: shouldSkipTransitionForRecycleReuse ? void 0 : layoutTransition,
|
|
119
|
+
layout: shouldSkipTransitionForRecycleReuse || shouldSkipLayoutTransition ? void 0 : layoutTransition,
|
|
116
120
|
ref: refView,
|
|
117
121
|
style: viewStyle,
|
|
118
122
|
...rest,
|
|
@@ -173,13 +177,7 @@ var LegendListForwardedRef = typedMemo(
|
|
|
173
177
|
// biome-ignore lint/nursery/noShadow: const function name shadowing is intentional
|
|
174
178
|
React.forwardRef(function LegendListForwardedRef2(props, ref) {
|
|
175
179
|
var _a, _b;
|
|
176
|
-
const { itemLayoutAnimation,
|
|
177
|
-
const refFn = useCallback(
|
|
178
|
-
(r) => {
|
|
179
|
-
refLegendList(r);
|
|
180
|
-
},
|
|
181
|
-
[refLegendList]
|
|
182
|
-
);
|
|
180
|
+
const { itemLayoutAnimation, refLegendList, renderScrollComponent, sharedValues, ...rest } = props;
|
|
183
181
|
const internalScrollOffset = useSharedValue(0);
|
|
184
182
|
const scrollOffset = (_a = sharedValues == null ? void 0 : sharedValues.scrollOffset) != null ? _a : internalScrollOffset;
|
|
185
183
|
const trackedScrollOffset = (sharedValues == null ? void 0 : sharedValues.scrollOffset) !== void 0 || ((_b = rest.stickyHeaderIndices) == null ? void 0 : _b.length) ? scrollOffset : void 0;
|
|
@@ -215,26 +213,16 @@ var LegendListForwardedRef = typedMemo(
|
|
|
215
213
|
return void 0;
|
|
216
214
|
}
|
|
217
215
|
return function PositionComponent(positionProps) {
|
|
218
|
-
return /* @__PURE__ */ React.createElement(
|
|
219
|
-
ReanimatedPositionView,
|
|
220
|
-
{
|
|
221
|
-
...positionProps,
|
|
222
|
-
layoutTransition: itemLayoutAnimationRef.current,
|
|
223
|
-
recycleItems
|
|
224
|
-
}
|
|
225
|
-
);
|
|
216
|
+
return /* @__PURE__ */ React.createElement(ReanimatedPositionView, { ...positionProps, layoutTransition: itemLayoutAnimationRef.current });
|
|
226
217
|
};
|
|
227
|
-
}, [hasItemLayoutAnimation
|
|
218
|
+
}, [hasItemLayoutAnimation]);
|
|
228
219
|
const legendListProps = {
|
|
229
220
|
...rest,
|
|
230
221
|
positionComponentInternal,
|
|
231
|
-
|
|
232
|
-
...{
|
|
233
|
-
renderScrollComponent: renderReanimatedScrollComponent,
|
|
234
|
-
...IsNewArchitecture ? { stickyPositionComponentInternal } : {}
|
|
235
|
-
}
|
|
222
|
+
renderScrollComponent: renderReanimatedScrollComponent,
|
|
223
|
+
...IsNewArchitecture ? { stickyPositionComponentInternal } : {}
|
|
236
224
|
};
|
|
237
|
-
return /* @__PURE__ */ React.createElement(LegendList, { ref:
|
|
225
|
+
return /* @__PURE__ */ React.createElement(LegendList, { ref: refLegendList, refScrollView: ref, ...legendListProps });
|
|
238
226
|
})
|
|
239
227
|
);
|
|
240
228
|
var AnimatedLegendListComponent = Reanimated.createAnimatedComponent(LegendListForwardedRef);
|