@legendapp/list 3.0.0-beta.45 → 3.0.0-beta.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +15 -12
- package/index.mjs +15 -12
- package/index.native.js +57 -56
- package/index.native.mjs +58 -57
- package/package.json +1 -1
- package/react-native.js +57 -56
- package/react-native.mjs +58 -57
- package/react-native.web.js +15 -12
- package/react-native.web.mjs +15 -12
- package/react.js +15 -12
- package/react.mjs +15 -12
- package/reanimated.js +4 -4
- package/reanimated.mjs +4 -4
package/react-native.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React2 from 'react';
|
|
2
2
|
import React2__default, { useReducer, useEffect, createContext, useRef, useState, useMemo, useCallback, useLayoutEffect, useImperativeHandle, useContext } from 'react';
|
|
3
3
|
import * as ReactNative from 'react-native';
|
|
4
|
-
import { Animated, View as View$1, Text as Text$1, Platform, StyleSheet as StyleSheet$1, RefreshControl, Dimensions } from 'react-native';
|
|
4
|
+
import { Animated, View as View$1, Text as Text$1, Platform as Platform$1, StyleSheet as StyleSheet$1, RefreshControl, Dimensions } from 'react-native';
|
|
5
5
|
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
6
6
|
|
|
7
7
|
// src/components/LegendList.tsx
|
|
@@ -327,12 +327,7 @@ var PositionViewAnimated = typedMemo(function PositionViewAnimated2({
|
|
|
327
327
|
const position$ = useValue$(`containerPosition${id}`, {
|
|
328
328
|
getValue: (v) => v != null ? v : POSITION_OUT_OF_VIEW
|
|
329
329
|
});
|
|
330
|
-
|
|
331
|
-
if (Platform.OS === "ios" || Platform.OS === "android") {
|
|
332
|
-
position = horizontal ? { transform: [{ translateX: position$ }] } : { transform: [{ translateY: position$ }] };
|
|
333
|
-
} else {
|
|
334
|
-
position = horizontal ? { left: position$ } : { top: position$ };
|
|
335
|
-
}
|
|
330
|
+
const position = horizontal ? { left: position$ } : { top: position$ };
|
|
336
331
|
return /* @__PURE__ */ React2.createElement(Animated.View, { ref: refView, style: [style, position], ...rest });
|
|
337
332
|
});
|
|
338
333
|
var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
@@ -358,17 +353,17 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
358
353
|
() => getStickyPushLimit(ctx.state, index, itemKey),
|
|
359
354
|
[ctx.state, index, itemKey, _totalSize]
|
|
360
355
|
);
|
|
361
|
-
const
|
|
356
|
+
const stickyPosition = React2.useMemo(() => {
|
|
362
357
|
var _a3;
|
|
363
358
|
if (animatedScrollY) {
|
|
364
359
|
const stickyConfigOffset = (_a3 = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a3 : 0;
|
|
365
360
|
const stickyStart = position + headerSize + stylePaddingTop - stickyConfigOffset;
|
|
366
|
-
let
|
|
361
|
+
let nextStickyPosition;
|
|
367
362
|
if (pushLimit !== void 0) {
|
|
368
363
|
if (pushLimit <= position) {
|
|
369
|
-
|
|
364
|
+
nextStickyPosition = pushLimit;
|
|
370
365
|
} else {
|
|
371
|
-
|
|
366
|
+
nextStickyPosition = animatedScrollY.interpolate({
|
|
372
367
|
extrapolateLeft: "clamp",
|
|
373
368
|
extrapolateRight: "clamp",
|
|
374
369
|
inputRange: [stickyStart, stickyStart + (pushLimit - position)],
|
|
@@ -376,17 +371,20 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
376
371
|
});
|
|
377
372
|
}
|
|
378
373
|
} else {
|
|
379
|
-
|
|
374
|
+
nextStickyPosition = animatedScrollY.interpolate({
|
|
380
375
|
extrapolateLeft: "clamp",
|
|
381
376
|
extrapolateRight: "extend",
|
|
382
377
|
inputRange: [stickyStart, stickyStart + 5e3],
|
|
383
378
|
outputRange: [position, position + 5e3]
|
|
384
379
|
});
|
|
385
380
|
}
|
|
386
|
-
return
|
|
381
|
+
return nextStickyPosition;
|
|
387
382
|
}
|
|
388
|
-
}, [animatedScrollY, headerSize,
|
|
389
|
-
const viewStyle = React2.useMemo(
|
|
383
|
+
}, [animatedScrollY, headerSize, position, pushLimit, stylePaddingTop, stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset]);
|
|
384
|
+
const viewStyle = React2.useMemo(
|
|
385
|
+
() => [style, { zIndex: index + 1e3 }, horizontal ? { left: stickyPosition } : { top: stickyPosition }],
|
|
386
|
+
[horizontal, index, stickyPosition, style]
|
|
387
|
+
);
|
|
390
388
|
const renderStickyHeaderBackdrop = React2.useMemo(() => {
|
|
391
389
|
if (!(stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.backdropComponent)) {
|
|
392
390
|
return null;
|
|
@@ -642,8 +640,8 @@ function useOnLayoutSync({
|
|
|
642
640
|
}
|
|
643
641
|
return { onLayout };
|
|
644
642
|
}
|
|
645
|
-
var
|
|
646
|
-
var PlatformAdjustBreaksScroll =
|
|
643
|
+
var Platform = Platform$1;
|
|
644
|
+
var PlatformAdjustBreaksScroll = Platform.OS === "android";
|
|
647
645
|
|
|
648
646
|
// src/utils/isInMVCPActiveMode.native.ts
|
|
649
647
|
function isInMVCPActiveMode(state) {
|
|
@@ -764,7 +762,7 @@ var Container = typedMemo(function Container2({
|
|
|
764
762
|
updateItemSizeFn(currentItemKey, layout);
|
|
765
763
|
itemLayoutRef.current.didLayout = true;
|
|
766
764
|
};
|
|
767
|
-
const shouldDeferWebShrinkLayoutUpdate =
|
|
765
|
+
const shouldDeferWebShrinkLayoutUpdate = Platform.OS === "web" && !isInMVCPActiveMode(ctx.state) && prevSize !== void 0 && size + 1 < prevSize;
|
|
768
766
|
if (shouldDeferWebShrinkLayoutUpdate) {
|
|
769
767
|
const token = pendingShrinkToken + 1;
|
|
770
768
|
itemLayoutRef.current.pendingShrinkToken = token;
|
|
@@ -1034,7 +1032,7 @@ var ListComponent = typedMemo(function ListComponent2({
|
|
|
1034
1032
|
}
|
|
1035
1033
|
),
|
|
1036
1034
|
ListFooterComponent && /* @__PURE__ */ React2.createElement(LayoutView, { onLayoutChange: onLayoutFooterInternal, style: ListFooterComponentStyle }, getComponent(ListFooterComponent)),
|
|
1037
|
-
|
|
1035
|
+
Platform.OS === "web" && /* @__PURE__ */ React2.createElement(WebAnchoredEndSpace, { horizontal }),
|
|
1038
1036
|
IS_DEV && ENABLE_DEVMODE
|
|
1039
1037
|
);
|
|
1040
1038
|
});
|
|
@@ -1072,7 +1070,7 @@ function useDevChecksImpl(props) {
|
|
|
1072
1070
|
const state = ctx.state;
|
|
1073
1071
|
const dataLength = state.props.data.length;
|
|
1074
1072
|
const useWindowScrollResolved = state.props.useWindowScroll;
|
|
1075
|
-
if (
|
|
1073
|
+
if (Platform.OS !== "web" || useWindowScrollResolved || dataLength < WEB_UNBOUNDED_HEIGHT_MIN_DATA_LENGTH) {
|
|
1076
1074
|
return;
|
|
1077
1075
|
}
|
|
1078
1076
|
const warnIfUnboundedOuterSize = () => {
|
|
@@ -1478,7 +1476,7 @@ function finishInitialScroll(ctx, options) {
|
|
|
1478
1476
|
}
|
|
1479
1477
|
const complete = () => {
|
|
1480
1478
|
var _a4, _b2, _c2, _d, _e;
|
|
1481
|
-
const shouldReleaseDeferredPublicOnScroll =
|
|
1479
|
+
const shouldReleaseDeferredPublicOnScroll = Platform.OS === "web" && ((_a4 = state.initialScrollSession) == null ? void 0 : _a4.kind) === "bootstrap";
|
|
1482
1480
|
const finalScrollOffset = (_d = (_c2 = (_b2 = options == null ? void 0 : options.resolvedOffset) != null ? _b2 : state.scrollPending) != null ? _c2 : state.scroll) != null ? _d : 0;
|
|
1483
1481
|
initialScrollWatchdog.clear(state);
|
|
1484
1482
|
if ((options == null ? void 0 : options.preserveTarget) && state.initialScroll) {
|
|
@@ -1670,7 +1668,7 @@ function clampScrollOffset(ctx, offset, scrollTarget) {
|
|
|
1670
1668
|
const state = ctx.state;
|
|
1671
1669
|
const contentSize = getContentSize(ctx);
|
|
1672
1670
|
let clampedOffset = offset;
|
|
1673
|
-
if (Number.isFinite(contentSize) && Number.isFinite(state.scrollLength) && (
|
|
1671
|
+
if (Number.isFinite(contentSize) && Number.isFinite(state.scrollLength) && (Platform.OS !== "android" || state.lastLayout)) {
|
|
1674
1672
|
const baseMaxOffset = Math.max(0, contentSize - state.scrollLength);
|
|
1675
1673
|
const viewOffset = scrollTarget == null ? void 0 : scrollTarget.viewOffset;
|
|
1676
1674
|
const extraEndOffset = typeof viewOffset === "number" && viewOffset < 0 ? -viewOffset : 0;
|
|
@@ -1837,7 +1835,7 @@ function checkFinishedScrollFallback(ctx) {
|
|
|
1837
1835
|
);
|
|
1838
1836
|
const completionState = getResolvedScrollCompletionState(ctx, isStillScrollingTo);
|
|
1839
1837
|
const canFinishAfterSilentNativeDispatch = silentInitialDispatch && completionState.isAtResolvedTarget && numChecks >= 1;
|
|
1840
|
-
const shouldRetrySilentInitialNativeScroll =
|
|
1838
|
+
const shouldRetrySilentInitialNativeScroll = Platform.OS === "android" && canFinishAfterSilentNativeDispatch && !initialScrollCompletion.didRetrySilentInitialScroll(state);
|
|
1841
1839
|
if (shouldRetrySilentInitialNativeScroll) {
|
|
1842
1840
|
const targetOffset = (_b = (_a3 = getInitialScrollWatchdogTargetOffset(state)) != null ? _a3 : isStillScrollingTo.targetOffset) != null ? _b : 0;
|
|
1843
1841
|
const jiggleOffset = targetOffset >= SILENT_INITIAL_SCROLL_TARGET_EPSILON ? targetOffset - SILENT_INITIAL_SCROLL_TARGET_EPSILON : targetOffset + SILENT_INITIAL_SCROLL_TARGET_EPSILON;
|
|
@@ -1955,7 +1953,7 @@ function scrollTo(ctx, params) {
|
|
|
1955
1953
|
}
|
|
1956
1954
|
state.scrollPending = targetOffset;
|
|
1957
1955
|
syncInitialScrollNativeWatchdog(state, { isInitialScroll, requestedOffset: offset, targetOffset });
|
|
1958
|
-
if (forceScroll || !isInitialScroll ||
|
|
1956
|
+
if (forceScroll || !isInitialScroll || Platform.OS === "android") {
|
|
1959
1957
|
doScrollTo(ctx, { animated, horizontal, isInitialScroll, offset });
|
|
1960
1958
|
} else {
|
|
1961
1959
|
state.scroll = offset;
|
|
@@ -2432,7 +2430,7 @@ function startBootstrapInitialScrollOnMount(ctx, options) {
|
|
|
2432
2430
|
} else {
|
|
2433
2431
|
startBootstrapInitialScrollSession(state, {
|
|
2434
2432
|
scroll: offset,
|
|
2435
|
-
seedContentOffset:
|
|
2433
|
+
seedContentOffset: Platform.OS === "web" ? 0 : offset,
|
|
2436
2434
|
targetIndexSeed: target.index
|
|
2437
2435
|
});
|
|
2438
2436
|
ensureBootstrapInitialScrollFrameTicker(ctx);
|
|
@@ -2629,7 +2627,7 @@ function evaluateBootstrapInitialScroll(ctx) {
|
|
|
2629
2627
|
queueBootstrapInitialScrollReevaluation(state);
|
|
2630
2628
|
return;
|
|
2631
2629
|
}
|
|
2632
|
-
if (
|
|
2630
|
+
if (Platform.OS !== "web" && Platform.OS !== "android" && Math.abs(bootstrapInitialScroll.seedContentOffset - resolvedOffset) <= 1 && Math.abs(getObservedBootstrapInitialScrollOffset(state) - resolvedOffset) <= 1) {
|
|
2633
2631
|
finishBootstrapInitialScrollWithoutScroll(ctx, resolvedOffset);
|
|
2634
2632
|
} else {
|
|
2635
2633
|
clearBootstrapInitialScrollSession(state);
|
|
@@ -2637,7 +2635,7 @@ function evaluateBootstrapInitialScroll(ctx) {
|
|
|
2637
2635
|
forceScroll: true,
|
|
2638
2636
|
resolvedOffset,
|
|
2639
2637
|
target: initialScroll,
|
|
2640
|
-
waitForCompletionFrame:
|
|
2638
|
+
waitForCompletionFrame: Platform.OS === "web"
|
|
2641
2639
|
});
|
|
2642
2640
|
}
|
|
2643
2641
|
}
|
|
@@ -2664,7 +2662,7 @@ function abortBootstrapInitialScroll(ctx) {
|
|
|
2664
2662
|
forceScroll: true,
|
|
2665
2663
|
resolvedOffset: bootstrapInitialScroll.scroll,
|
|
2666
2664
|
target: initialScroll,
|
|
2667
|
-
waitForCompletionFrame:
|
|
2665
|
+
waitForCompletionFrame: Platform.OS === "web"
|
|
2668
2666
|
});
|
|
2669
2667
|
} else {
|
|
2670
2668
|
finishBootstrapInitialScrollWithoutScroll(
|
|
@@ -2752,7 +2750,7 @@ function handleInitialScrollDataChange(ctx, options) {
|
|
|
2752
2750
|
function requestAdjust(ctx, positionDiff, dataChanged) {
|
|
2753
2751
|
const state = ctx.state;
|
|
2754
2752
|
if (Math.abs(positionDiff) > 0.1) {
|
|
2755
|
-
const needsScrollWorkaround =
|
|
2753
|
+
const needsScrollWorkaround = Platform.OS === "android" && !IsNewArchitecture && dataChanged && state.scroll <= positionDiff;
|
|
2756
2754
|
const doit = () => {
|
|
2757
2755
|
if (needsScrollWorkaround) {
|
|
2758
2756
|
scrollTo(ctx, {
|
|
@@ -2771,7 +2769,7 @@ function requestAdjust(ctx, positionDiff, dataChanged) {
|
|
|
2771
2769
|
const readyToRender = peek$(ctx, "readyToRender");
|
|
2772
2770
|
if (readyToRender) {
|
|
2773
2771
|
doit();
|
|
2774
|
-
if (
|
|
2772
|
+
if (Platform.OS !== "web") {
|
|
2775
2773
|
const threshold = state.scroll - positionDiff / 2;
|
|
2776
2774
|
if (!state.ignoreScrollFromMVCP) {
|
|
2777
2775
|
state.ignoreScrollFromMVCP = {};
|
|
@@ -2826,7 +2824,7 @@ function resolveAnchorLock(state, enableMVCPAnchorLock, mvcpData, now) {
|
|
|
2826
2824
|
return lock;
|
|
2827
2825
|
}
|
|
2828
2826
|
function updateAnchorLock(state, params) {
|
|
2829
|
-
if (
|
|
2827
|
+
if (Platform.OS === "web") {
|
|
2830
2828
|
const { anchorId, anchorPosition, dataChanged, now, positionDiff } = params;
|
|
2831
2829
|
const enableMVCPAnchorLock = !!dataChanged || !!state.mvcpAnchorLock;
|
|
2832
2830
|
const mvcpData = state.props.maintainVisibleContentPosition.data;
|
|
@@ -2848,7 +2846,7 @@ function updateAnchorLock(state, params) {
|
|
|
2848
2846
|
}
|
|
2849
2847
|
}
|
|
2850
2848
|
function shouldQueueNativeMVCPAdjust(dataChanged, state, positionDiff, prevTotalSize, prevScroll, scrollTarget) {
|
|
2851
|
-
if (!dataChanged ||
|
|
2849
|
+
if (!dataChanged || Platform.OS === "web" || !state.props.maintainVisibleContentPosition.data || scrollTarget !== void 0 || positionDiff >= -MVCP_POSITION_EPSILON) {
|
|
2852
2850
|
return false;
|
|
2853
2851
|
}
|
|
2854
2852
|
const distanceFromEnd = prevTotalSize - prevScroll - state.scrollLength;
|
|
@@ -2947,7 +2945,7 @@ function prepareMVCP(ctx, dataChanged) {
|
|
|
2947
2945
|
const {
|
|
2948
2946
|
maintainVisibleContentPosition: { data: mvcpData, size: mvcpScroll, shouldRestorePosition }
|
|
2949
2947
|
} = props;
|
|
2950
|
-
const isWeb =
|
|
2948
|
+
const isWeb = Platform.OS === "web";
|
|
2951
2949
|
const now = Date.now();
|
|
2952
2950
|
const enableMVCPAnchorLock = isWeb && (!!dataChanged || !!state.mvcpAnchorLock);
|
|
2953
2951
|
const scrollingTo = state.scrollingTo;
|
|
@@ -3362,7 +3360,7 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
|
|
|
3362
3360
|
const layoutConfig = overrideItemLayout ? { span: 1 } : void 0;
|
|
3363
3361
|
const lastScrollDelta = state.lastScrollDelta;
|
|
3364
3362
|
const velocity = getScrollVelocity(state);
|
|
3365
|
-
const shouldOptimize = !forceFullUpdate && !dataChanged && (optimizeForVisibleWindow || Math.abs(velocity) > 0 ||
|
|
3363
|
+
const shouldOptimize = !forceFullUpdate && !dataChanged && (optimizeForVisibleWindow || Math.abs(velocity) > 0 || Platform.OS === "web" && state.scrollLength > 0 && lastScrollDelta > state.scrollLength);
|
|
3366
3364
|
const maxVisibleArea = scrollBottomBuffered + 1e3;
|
|
3367
3365
|
const useAverageSize = !getEstimatedItemSize;
|
|
3368
3366
|
const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_b = peek$(ctx, "scrollAdjustPending")) != null ? _b : 0) !== 0;
|
|
@@ -3701,6 +3699,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
3701
3699
|
const numContainers = peek$(ctx, "numContainers");
|
|
3702
3700
|
const state = ctx.state;
|
|
3703
3701
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
3702
|
+
const shouldAvoidAssignedContainerReuse = state.props.recycleItems && !!state.props.positionComponentInternal;
|
|
3704
3703
|
const result = [];
|
|
3705
3704
|
const availableContainers = [];
|
|
3706
3705
|
const pendingRemovalSet = new Set(pendingRemoval);
|
|
@@ -3757,18 +3756,20 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
3757
3756
|
}
|
|
3758
3757
|
}
|
|
3759
3758
|
}
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3759
|
+
if (!shouldAvoidAssignedContainerReuse) {
|
|
3760
|
+
for (let u = 0; u < numContainers && result.length < numNeeded; u++) {
|
|
3761
|
+
if (stickyContainerPool.has(u)) {
|
|
3762
|
+
continue;
|
|
3763
|
+
}
|
|
3764
|
+
const key = peek$(ctx, `containerItemKey${u}`);
|
|
3765
|
+
if (key === void 0) continue;
|
|
3766
|
+
const index = state.indexByKey.get(key);
|
|
3767
|
+
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
3768
|
+
if (isOutOfView) {
|
|
3769
|
+
const distance = index < startBuffered ? startBuffered - index : index - endBuffered;
|
|
3770
|
+
if (!requiredItemTypes || typeIndex < neededTypes.length && canReuseContainer(u, neededTypes[typeIndex])) {
|
|
3771
|
+
availableContainers.push({ distance, index: u });
|
|
3772
|
+
}
|
|
3772
3773
|
}
|
|
3773
3774
|
}
|
|
3774
3775
|
}
|
|
@@ -3973,7 +3974,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
3973
3974
|
if (top === null && bottom === null) {
|
|
3974
3975
|
state.scrollForNextCalculateItemsInView = void 0;
|
|
3975
3976
|
} else if ((top === null || scrollTopBuffered > top) && (bottom === null || scrollBottomBuffered < bottom)) {
|
|
3976
|
-
if (
|
|
3977
|
+
if (Platform.OS !== "web" || !isInMVCPActiveMode(state)) {
|
|
3977
3978
|
return;
|
|
3978
3979
|
}
|
|
3979
3980
|
}
|
|
@@ -4247,7 +4248,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4247
4248
|
}
|
|
4248
4249
|
}
|
|
4249
4250
|
}
|
|
4250
|
-
if (
|
|
4251
|
+
if (Platform.OS === "web" && didChangePositions) {
|
|
4251
4252
|
set$(ctx, "lastPositionUpdate", Date.now());
|
|
4252
4253
|
}
|
|
4253
4254
|
if (suppressInitialScrollSideEffects) {
|
|
@@ -4561,7 +4562,7 @@ function updateScroll(ctx, newScroll, forceUpdate) {
|
|
|
4561
4562
|
(_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state, { doMVCP: scrollingTo !== void 0 });
|
|
4562
4563
|
checkThresholds(ctx);
|
|
4563
4564
|
};
|
|
4564
|
-
if (
|
|
4565
|
+
if (Platform.OS === "web" && scrollLength > 0 && scrollingTo === void 0 && scrollDelta > scrollLength) {
|
|
4565
4566
|
flushSync(runCalculateItems);
|
|
4566
4567
|
} else {
|
|
4567
4568
|
runCalculateItems();
|
|
@@ -4594,7 +4595,7 @@ function trackInitialScrollNativeProgress(state, newScroll) {
|
|
|
4594
4595
|
}
|
|
4595
4596
|
function shouldDeferPublicOnScroll(state) {
|
|
4596
4597
|
var _a3;
|
|
4597
|
-
return
|
|
4598
|
+
return Platform.OS === "web" && !!state.initialScroll && ((_a3 = state.initialScrollSession) == null ? void 0 : _a3.kind) === "bootstrap" && !state.didFinishInitialScroll;
|
|
4598
4599
|
}
|
|
4599
4600
|
function cloneScrollEvent(event) {
|
|
4600
4601
|
return {
|
|
@@ -4744,7 +4745,7 @@ function maybeUpdateAnchoredEndSpace(ctx) {
|
|
|
4744
4745
|
// src/core/updateItemSize.ts
|
|
4745
4746
|
function runOrScheduleMVCPRecalculate(ctx) {
|
|
4746
4747
|
const state = ctx.state;
|
|
4747
|
-
if (
|
|
4748
|
+
if (Platform.OS === "web") {
|
|
4748
4749
|
if (!state.mvcpAnchorLock) {
|
|
4749
4750
|
if (state.queuedMVCPRecalculate !== void 0) {
|
|
4750
4751
|
cancelAnimationFrame(state.queuedMVCPRecalculate);
|
|
@@ -4870,7 +4871,7 @@ function updateOneItemSize(ctx, itemKey, sizeObj) {
|
|
|
4870
4871
|
const index = indexByKey.get(itemKey);
|
|
4871
4872
|
const prevSize = getItemSize(ctx, itemKey, index, data[index]);
|
|
4872
4873
|
const rawSize = horizontal ? sizeObj.width : sizeObj.height;
|
|
4873
|
-
const size =
|
|
4874
|
+
const size = Platform.OS === "web" ? Math.round(rawSize) : roundSize(rawSize);
|
|
4874
4875
|
const prevSizeKnown = sizesKnown.get(itemKey);
|
|
4875
4876
|
sizesKnown.set(itemKey, size);
|
|
4876
4877
|
if (!getEstimatedItemSize && !getFixedItemSize && size > 0) {
|
|
@@ -5494,7 +5495,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5494
5495
|
dataVersion,
|
|
5495
5496
|
keyExtractor
|
|
5496
5497
|
]);
|
|
5497
|
-
const useWindowScrollResolved =
|
|
5498
|
+
const useWindowScrollResolved = Platform.OS === "web" && !!useWindowScroll && !renderScrollComponent;
|
|
5498
5499
|
const refState = useRef(void 0);
|
|
5499
5500
|
const hasOverrideItemLayout = !!overrideItemLayout;
|
|
5500
5501
|
const prevHasOverrideItemLayout = useRef(hasOverrideItemLayout);
|
|
@@ -5590,7 +5591,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5590
5591
|
}
|
|
5591
5592
|
const throttledOnScroll = useThrottledOnScroll(onScrollProp != null ? onScrollProp : noopOnScroll, scrollEventThrottle != null ? scrollEventThrottle : 0);
|
|
5592
5593
|
const throttleScrollFn = scrollEventThrottle && onScrollProp ? throttledOnScroll : onScrollProp;
|
|
5593
|
-
const anchoredEndSpaceResolved =
|
|
5594
|
+
const anchoredEndSpaceResolved = Platform.OS === "web" && anchoredEndSpace ? { ...anchoredEndSpace, includeInEndInset: true } : anchoredEndSpace;
|
|
5594
5595
|
state.props = {
|
|
5595
5596
|
alignItemsAtEnd,
|
|
5596
5597
|
alwaysRender,
|
|
@@ -5650,7 +5651,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5650
5651
|
setPaddingTop(ctx, { stylePaddingTop: stylePaddingTopState });
|
|
5651
5652
|
refState.current.props.stylePaddingBottom = stylePaddingBottomState;
|
|
5652
5653
|
let paddingDiff = stylePaddingTopState - prevPaddingTop;
|
|
5653
|
-
if (shouldAdjustPadding && maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 &&
|
|
5654
|
+
if (shouldAdjustPadding && maintainVisibleContentPositionConfig.size && paddingDiff && prevPaddingTop !== void 0 && Platform.OS === "ios") {
|
|
5654
5655
|
if (state.scroll < 0) {
|
|
5655
5656
|
paddingDiff += state.scroll;
|
|
5656
5657
|
}
|
|
@@ -5672,7 +5673,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5672
5673
|
return void 0;
|
|
5673
5674
|
}
|
|
5674
5675
|
const resolvedOffset = (_a4 = initialScroll.contentOffset) != null ? _a4 : resolveInitialScrollOffset(ctx, initialScroll);
|
|
5675
|
-
return usesBootstrapInitialScroll && ((_b2 = state.initialScrollSession) == null ? void 0 : _b2.kind) === "bootstrap" &&
|
|
5676
|
+
return usesBootstrapInitialScroll && ((_b2 = state.initialScrollSession) == null ? void 0 : _b2.kind) === "bootstrap" && Platform.OS === "web" ? void 0 : resolvedOffset;
|
|
5676
5677
|
}, [usesBootstrapInitialScroll]);
|
|
5677
5678
|
useLayoutEffect(() => {
|
|
5678
5679
|
initializeInitialScrollOnMount(ctx, {
|
|
@@ -5827,7 +5828,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
5827
5828
|
});
|
|
5828
5829
|
useImperativeHandle(forwardedRef, () => createImperativeHandle(ctx), []);
|
|
5829
5830
|
useEffect(() => {
|
|
5830
|
-
if (
|
|
5831
|
+
if (Platform.OS !== "web" || usesBootstrapInitialScroll) {
|
|
5831
5832
|
return;
|
|
5832
5833
|
}
|
|
5833
5834
|
advanceCurrentInitialScrollSession(ctx);
|
package/react-native.web.js
CHANGED
|
@@ -4251,6 +4251,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4251
4251
|
const numContainers = peek$(ctx, "numContainers");
|
|
4252
4252
|
const state = ctx.state;
|
|
4253
4253
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
4254
|
+
const shouldAvoidAssignedContainerReuse = state.props.recycleItems && !!state.props.positionComponentInternal;
|
|
4254
4255
|
const result = [];
|
|
4255
4256
|
const availableContainers = [];
|
|
4256
4257
|
const pendingRemovalSet = new Set(pendingRemoval);
|
|
@@ -4307,18 +4308,20 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4307
4308
|
}
|
|
4308
4309
|
}
|
|
4309
4310
|
}
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4311
|
+
if (!shouldAvoidAssignedContainerReuse) {
|
|
4312
|
+
for (let u = 0; u < numContainers && result.length < numNeeded; u++) {
|
|
4313
|
+
if (stickyContainerPool.has(u)) {
|
|
4314
|
+
continue;
|
|
4315
|
+
}
|
|
4316
|
+
const key = peek$(ctx, `containerItemKey${u}`);
|
|
4317
|
+
if (key === void 0) continue;
|
|
4318
|
+
const index = state.indexByKey.get(key);
|
|
4319
|
+
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
4320
|
+
if (isOutOfView) {
|
|
4321
|
+
const distance = index < startBuffered ? startBuffered - index : index - endBuffered;
|
|
4322
|
+
if (!requiredItemTypes || typeIndex < neededTypes.length && canReuseContainer(u, neededTypes[typeIndex])) {
|
|
4323
|
+
availableContainers.push({ distance, index: u });
|
|
4324
|
+
}
|
|
4322
4325
|
}
|
|
4323
4326
|
}
|
|
4324
4327
|
}
|
package/react-native.web.mjs
CHANGED
|
@@ -4230,6 +4230,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4230
4230
|
const numContainers = peek$(ctx, "numContainers");
|
|
4231
4231
|
const state = ctx.state;
|
|
4232
4232
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
4233
|
+
const shouldAvoidAssignedContainerReuse = state.props.recycleItems && !!state.props.positionComponentInternal;
|
|
4233
4234
|
const result = [];
|
|
4234
4235
|
const availableContainers = [];
|
|
4235
4236
|
const pendingRemovalSet = new Set(pendingRemoval);
|
|
@@ -4286,18 +4287,20 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4286
4287
|
}
|
|
4287
4288
|
}
|
|
4288
4289
|
}
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4290
|
+
if (!shouldAvoidAssignedContainerReuse) {
|
|
4291
|
+
for (let u = 0; u < numContainers && result.length < numNeeded; u++) {
|
|
4292
|
+
if (stickyContainerPool.has(u)) {
|
|
4293
|
+
continue;
|
|
4294
|
+
}
|
|
4295
|
+
const key = peek$(ctx, `containerItemKey${u}`);
|
|
4296
|
+
if (key === void 0) continue;
|
|
4297
|
+
const index = state.indexByKey.get(key);
|
|
4298
|
+
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
4299
|
+
if (isOutOfView) {
|
|
4300
|
+
const distance = index < startBuffered ? startBuffered - index : index - endBuffered;
|
|
4301
|
+
if (!requiredItemTypes || typeIndex < neededTypes.length && canReuseContainer(u, neededTypes[typeIndex])) {
|
|
4302
|
+
availableContainers.push({ distance, index: u });
|
|
4303
|
+
}
|
|
4301
4304
|
}
|
|
4302
4305
|
}
|
|
4303
4306
|
}
|
package/react.js
CHANGED
|
@@ -4251,6 +4251,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4251
4251
|
const numContainers = peek$(ctx, "numContainers");
|
|
4252
4252
|
const state = ctx.state;
|
|
4253
4253
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
4254
|
+
const shouldAvoidAssignedContainerReuse = state.props.recycleItems && !!state.props.positionComponentInternal;
|
|
4254
4255
|
const result = [];
|
|
4255
4256
|
const availableContainers = [];
|
|
4256
4257
|
const pendingRemovalSet = new Set(pendingRemoval);
|
|
@@ -4307,18 +4308,20 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4307
4308
|
}
|
|
4308
4309
|
}
|
|
4309
4310
|
}
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4311
|
+
if (!shouldAvoidAssignedContainerReuse) {
|
|
4312
|
+
for (let u = 0; u < numContainers && result.length < numNeeded; u++) {
|
|
4313
|
+
if (stickyContainerPool.has(u)) {
|
|
4314
|
+
continue;
|
|
4315
|
+
}
|
|
4316
|
+
const key = peek$(ctx, `containerItemKey${u}`);
|
|
4317
|
+
if (key === void 0) continue;
|
|
4318
|
+
const index = state.indexByKey.get(key);
|
|
4319
|
+
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
4320
|
+
if (isOutOfView) {
|
|
4321
|
+
const distance = index < startBuffered ? startBuffered - index : index - endBuffered;
|
|
4322
|
+
if (!requiredItemTypes || typeIndex < neededTypes.length && canReuseContainer(u, neededTypes[typeIndex])) {
|
|
4323
|
+
availableContainers.push({ distance, index: u });
|
|
4324
|
+
}
|
|
4322
4325
|
}
|
|
4323
4326
|
}
|
|
4324
4327
|
}
|
package/react.mjs
CHANGED
|
@@ -4230,6 +4230,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4230
4230
|
const numContainers = peek$(ctx, "numContainers");
|
|
4231
4231
|
const state = ctx.state;
|
|
4232
4232
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
4233
|
+
const shouldAvoidAssignedContainerReuse = state.props.recycleItems && !!state.props.positionComponentInternal;
|
|
4233
4234
|
const result = [];
|
|
4234
4235
|
const availableContainers = [];
|
|
4235
4236
|
const pendingRemovalSet = new Set(pendingRemoval);
|
|
@@ -4286,18 +4287,20 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
4286
4287
|
}
|
|
4287
4288
|
}
|
|
4288
4289
|
}
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4290
|
+
if (!shouldAvoidAssignedContainerReuse) {
|
|
4291
|
+
for (let u = 0; u < numContainers && result.length < numNeeded; u++) {
|
|
4292
|
+
if (stickyContainerPool.has(u)) {
|
|
4293
|
+
continue;
|
|
4294
|
+
}
|
|
4295
|
+
const key = peek$(ctx, `containerItemKey${u}`);
|
|
4296
|
+
if (key === void 0) continue;
|
|
4297
|
+
const index = state.indexByKey.get(key);
|
|
4298
|
+
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
4299
|
+
if (isOutOfView) {
|
|
4300
|
+
const distance = index < startBuffered ? startBuffered - index : index - endBuffered;
|
|
4301
|
+
if (!requiredItemTypes || typeIndex < neededTypes.length && canReuseContainer(u, neededTypes[typeIndex])) {
|
|
4302
|
+
availableContainers.push({ distance, index: u });
|
|
4303
|
+
}
|
|
4301
4304
|
}
|
|
4302
4305
|
}
|
|
4303
4306
|
}
|
package/reanimated.js
CHANGED
|
@@ -89,15 +89,15 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
|
|
|
89
89
|
);
|
|
90
90
|
const stickyOffset = (_a = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a : 0;
|
|
91
91
|
const stickyStart = position + headerSize + stylePaddingTop - stickyOffset;
|
|
92
|
-
const
|
|
92
|
+
const stickyPositionStyle = Reanimated.useAnimatedStyle(() => {
|
|
93
93
|
const delta = Math.max(0, stickyScrollOffset.value - stickyStart);
|
|
94
94
|
const stickyPosition = position + delta;
|
|
95
95
|
const resolvedPosition = pushLimit !== void 0 ? Math.min(stickyPosition, pushLimit) : stickyPosition;
|
|
96
|
-
return horizontal ? {
|
|
96
|
+
return horizontal ? { left: resolvedPosition } : { top: resolvedPosition };
|
|
97
97
|
}, [horizontal, position, pushLimit, stickyStart]);
|
|
98
98
|
const viewStyle = React__namespace.useMemo(
|
|
99
|
-
() => [style, { zIndex: index + 1e3 },
|
|
100
|
-
[index,
|
|
99
|
+
() => [style, { zIndex: index + 1e3 }, stickyPositionStyle],
|
|
100
|
+
[index, stickyPositionStyle, style]
|
|
101
101
|
);
|
|
102
102
|
return /* @__PURE__ */ React__namespace.createElement(Reanimated__default.default.View, { ref: refView, style: viewStyle, ...rest }, /* @__PURE__ */ React__namespace.createElement(StickyOverlay, { stickyHeaderConfig }), children);
|
|
103
103
|
});
|
package/reanimated.mjs
CHANGED
|
@@ -65,15 +65,15 @@ var ReanimatedPositionViewSticky = typedMemo(function ReanimatedPositionViewStic
|
|
|
65
65
|
);
|
|
66
66
|
const stickyOffset = (_a = stickyHeaderConfig == null ? void 0 : stickyHeaderConfig.offset) != null ? _a : 0;
|
|
67
67
|
const stickyStart = position + headerSize + stylePaddingTop - stickyOffset;
|
|
68
|
-
const
|
|
68
|
+
const stickyPositionStyle = useAnimatedStyle(() => {
|
|
69
69
|
const delta = Math.max(0, stickyScrollOffset.value - stickyStart);
|
|
70
70
|
const stickyPosition = position + delta;
|
|
71
71
|
const resolvedPosition = pushLimit !== void 0 ? Math.min(stickyPosition, pushLimit) : stickyPosition;
|
|
72
|
-
return horizontal ? {
|
|
72
|
+
return horizontal ? { left: resolvedPosition } : { top: resolvedPosition };
|
|
73
73
|
}, [horizontal, position, pushLimit, stickyStart]);
|
|
74
74
|
const viewStyle = React.useMemo(
|
|
75
|
-
() => [style, { zIndex: index + 1e3 },
|
|
76
|
-
[index,
|
|
75
|
+
() => [style, { zIndex: index + 1e3 }, stickyPositionStyle],
|
|
76
|
+
[index, stickyPositionStyle, style]
|
|
77
77
|
);
|
|
78
78
|
return /* @__PURE__ */ React.createElement(Reanimated.View, { ref: refView, style: viewStyle, ...rest }, /* @__PURE__ */ React.createElement(StickyOverlay, { stickyHeaderConfig }), children);
|
|
79
79
|
});
|