@legendapp/list 3.0.0-beta.47 → 3.0.0-beta.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/index.js +96 -36
- package/index.mjs +96 -36
- package/index.native.js +127 -64
- package/index.native.mjs +127 -64
- package/package.json +1 -1
- package/react-native.js +127 -64
- package/react-native.mjs +127 -64
- package/react-native.web.js +96 -36
- package/react-native.web.mjs +96 -36
- package/react.js +96 -36
- package/react.mjs +96 -36
package/react-native.mjs
CHANGED
|
@@ -834,6 +834,35 @@ var Container = typedMemo(function Container2({
|
|
|
834
834
|
});
|
|
835
835
|
|
|
836
836
|
// src/components/Containers.native.tsx
|
|
837
|
+
var ContainersLayer = typedMemo(function ContainersLayer2({ children, horizontal }) {
|
|
838
|
+
const ctx = useStateContext();
|
|
839
|
+
const columnWrapperStyle = ctx.columnWrapperStyle;
|
|
840
|
+
const animSize = useValue$("totalSize");
|
|
841
|
+
const otherAxisSize = useValue$("otherAxisSize");
|
|
842
|
+
const [readyToRender, numColumns] = useArr$(["readyToRender", "numColumns"]);
|
|
843
|
+
const style = horizontal ? { minHeight: otherAxisSize, opacity: readyToRender ? 1 : 0, width: animSize } : { height: animSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0 };
|
|
844
|
+
if (columnWrapperStyle) {
|
|
845
|
+
const { columnGap, rowGap, gap } = columnWrapperStyle;
|
|
846
|
+
const gapX = columnGap || gap || 0;
|
|
847
|
+
const gapY = rowGap || gap || 0;
|
|
848
|
+
if (horizontal) {
|
|
849
|
+
if (gapY && numColumns > 1) {
|
|
850
|
+
style.marginVertical = -gapY / 2;
|
|
851
|
+
}
|
|
852
|
+
if (gapX) {
|
|
853
|
+
style.marginRight = -gapX;
|
|
854
|
+
}
|
|
855
|
+
} else {
|
|
856
|
+
if (gapX && numColumns > 1) {
|
|
857
|
+
style.marginHorizontal = -gapX;
|
|
858
|
+
}
|
|
859
|
+
if (gapY) {
|
|
860
|
+
style.marginBottom = -gapY;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return /* @__PURE__ */ React2.createElement(Animated.View, { style }, children);
|
|
865
|
+
});
|
|
837
866
|
var Containers = typedMemo(function Containers2({
|
|
838
867
|
horizontal,
|
|
839
868
|
recycleItems,
|
|
@@ -842,12 +871,7 @@ var Containers = typedMemo(function Containers2({
|
|
|
842
871
|
updateItemSize: updateItemSize2,
|
|
843
872
|
getRenderedItem: getRenderedItem2
|
|
844
873
|
}) {
|
|
845
|
-
const
|
|
846
|
-
const columnWrapperStyle = ctx.columnWrapperStyle;
|
|
847
|
-
const [numContainers, numColumns] = useArr$(["numContainersPooled", "numColumns"]);
|
|
848
|
-
const animSize = useValue$("totalSize");
|
|
849
|
-
const otherAxisSize = useValue$("otherAxisSize");
|
|
850
|
-
const animOpacity = useValue$("readyToRender", { getValue: (value) => value ? 1 : 0 });
|
|
874
|
+
const [numContainers] = useArr$(["numContainersPooled"]);
|
|
851
875
|
const containers = [];
|
|
852
876
|
for (let i = 0; i < numContainers; i++) {
|
|
853
877
|
containers.push(
|
|
@@ -866,28 +890,7 @@ var Containers = typedMemo(function Containers2({
|
|
|
866
890
|
)
|
|
867
891
|
);
|
|
868
892
|
}
|
|
869
|
-
|
|
870
|
-
if (columnWrapperStyle) {
|
|
871
|
-
const { columnGap, rowGap, gap } = columnWrapperStyle;
|
|
872
|
-
const gapX = columnGap || gap || 0;
|
|
873
|
-
const gapY = rowGap || gap || 0;
|
|
874
|
-
if (horizontal) {
|
|
875
|
-
if (gapY && numColumns > 1) {
|
|
876
|
-
style.marginVertical = -gapY / 2;
|
|
877
|
-
}
|
|
878
|
-
if (gapX) {
|
|
879
|
-
style.marginRight = -gapX;
|
|
880
|
-
}
|
|
881
|
-
} else {
|
|
882
|
-
if (gapX && numColumns > 1) {
|
|
883
|
-
style.marginHorizontal = -gapX;
|
|
884
|
-
}
|
|
885
|
-
if (gapY) {
|
|
886
|
-
style.marginBottom = -gapY;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
return /* @__PURE__ */ React2.createElement(Animated.View, { style }, containers);
|
|
893
|
+
return /* @__PURE__ */ React2.createElement(ContainersLayer, { horizontal }, containers);
|
|
891
894
|
});
|
|
892
895
|
var ListComponentScrollView = Animated.ScrollView;
|
|
893
896
|
function ScrollAdjust() {
|
|
@@ -1533,7 +1536,7 @@ function getId(state, index) {
|
|
|
1533
1536
|
}
|
|
1534
1537
|
|
|
1535
1538
|
// src/core/addTotalSize.ts
|
|
1536
|
-
function addTotalSize(ctx, key, add) {
|
|
1539
|
+
function addTotalSize(ctx, key, add, notifyTotalSize = true) {
|
|
1537
1540
|
const state = ctx.state;
|
|
1538
1541
|
const prevTotalSize = state.totalSize;
|
|
1539
1542
|
let totalSize = state.totalSize;
|
|
@@ -1552,25 +1555,29 @@ function addTotalSize(ctx, key, add) {
|
|
|
1552
1555
|
} else {
|
|
1553
1556
|
state.pendingTotalSize = void 0;
|
|
1554
1557
|
state.totalSize = totalSize;
|
|
1555
|
-
|
|
1558
|
+
if (notifyTotalSize) {
|
|
1559
|
+
set$(ctx, "totalSize", totalSize);
|
|
1560
|
+
}
|
|
1556
1561
|
}
|
|
1562
|
+
} else if (notifyTotalSize && ctx.values.get("totalSize") !== totalSize) {
|
|
1563
|
+
set$(ctx, "totalSize", totalSize);
|
|
1557
1564
|
}
|
|
1558
1565
|
}
|
|
1559
1566
|
|
|
1560
1567
|
// src/core/setSize.ts
|
|
1561
|
-
function setSize(ctx, itemKey, size) {
|
|
1568
|
+
function setSize(ctx, itemKey, size, notifyTotalSize = true) {
|
|
1562
1569
|
const state = ctx.state;
|
|
1563
1570
|
const { sizes } = state;
|
|
1564
1571
|
const previousSize = sizes.get(itemKey);
|
|
1565
1572
|
const diff = previousSize !== void 0 ? size - previousSize : size;
|
|
1566
1573
|
if (diff !== 0) {
|
|
1567
|
-
addTotalSize(ctx, itemKey, diff);
|
|
1574
|
+
addTotalSize(ctx, itemKey, diff, notifyTotalSize);
|
|
1568
1575
|
}
|
|
1569
1576
|
sizes.set(itemKey, size);
|
|
1570
1577
|
}
|
|
1571
1578
|
|
|
1572
1579
|
// src/utils/getItemSize.ts
|
|
1573
|
-
function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize) {
|
|
1580
|
+
function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize, notifyTotalSize) {
|
|
1574
1581
|
var _a3, _b, _c;
|
|
1575
1582
|
const state = ctx.state;
|
|
1576
1583
|
const {
|
|
@@ -1616,7 +1623,7 @@ function getItemSize(ctx, key, index, data, useAverageSize, preferCachedSize) {
|
|
|
1616
1623
|
if (size === void 0) {
|
|
1617
1624
|
size = getEstimatedItemSize ? getEstimatedItemSize(data, index, itemType) : estimatedItemSize;
|
|
1618
1625
|
}
|
|
1619
|
-
setSize(ctx, key, size);
|
|
1626
|
+
setSize(ctx, key, size, notifyTotalSize);
|
|
1620
1627
|
return size;
|
|
1621
1628
|
}
|
|
1622
1629
|
function getItemSizeAtIndex(ctx, index) {
|
|
@@ -2139,10 +2146,10 @@ function getMountedBufferedIndices(state) {
|
|
|
2139
2146
|
function getMountedNoBufferIndices(state) {
|
|
2140
2147
|
return getMountedIndicesInRange(state, state.startNoBuffer, state.endNoBuffer);
|
|
2141
2148
|
}
|
|
2142
|
-
function checkAllSizesKnown(state, indices
|
|
2149
|
+
function checkAllSizesKnown(state, indices) {
|
|
2143
2150
|
return indices.length > 0 && indices.every((index) => {
|
|
2144
2151
|
const key = getId(state, index);
|
|
2145
|
-
return state.sizesKnown.has(key);
|
|
2152
|
+
return key !== void 0 && state.sizesKnown.has(key);
|
|
2146
2153
|
});
|
|
2147
2154
|
}
|
|
2148
2155
|
|
|
@@ -3361,6 +3368,7 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
|
|
|
3361
3368
|
const maxVisibleArea = scrollBottomBuffered + 1e3;
|
|
3362
3369
|
const useAverageSize = !getEstimatedItemSize;
|
|
3363
3370
|
const preferCachedSize = !doMVCP || dataChanged || state.scrollAdjustHandler.getAdjust() !== 0 || ((_b = peek$(ctx, "scrollAdjustPending")) != null ? _b : 0) !== 0;
|
|
3371
|
+
const notifyTotalSizeWhileCachingSizes = false;
|
|
3364
3372
|
let currentRowTop = 0;
|
|
3365
3373
|
let column = 1;
|
|
3366
3374
|
let maxSizeInRow = 0;
|
|
@@ -3388,7 +3396,15 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
|
|
|
3388
3396
|
const prevIndex = startIndex - 1;
|
|
3389
3397
|
const prevId = getId(state, prevIndex);
|
|
3390
3398
|
const prevPosition = (_c = positions[prevIndex]) != null ? _c : 0;
|
|
3391
|
-
const prevSize = (_d = sizesKnown.get(prevId)) != null ? _d : getItemSize(
|
|
3399
|
+
const prevSize = (_d = sizesKnown.get(prevId)) != null ? _d : getItemSize(
|
|
3400
|
+
ctx,
|
|
3401
|
+
prevId,
|
|
3402
|
+
prevIndex,
|
|
3403
|
+
data[prevIndex],
|
|
3404
|
+
useAverageSize,
|
|
3405
|
+
preferCachedSize,
|
|
3406
|
+
notifyTotalSizeWhileCachingSizes
|
|
3407
|
+
);
|
|
3392
3408
|
currentRowTop = prevPosition + prevSize;
|
|
3393
3409
|
}
|
|
3394
3410
|
}
|
|
@@ -3421,7 +3437,7 @@ function updateItemPositions(ctx, dataChanged, { startIndex, scrollBottomBuffere
|
|
|
3421
3437
|
maxSizeInRow = 0;
|
|
3422
3438
|
}
|
|
3423
3439
|
const knownSize = sizesKnown.get(id);
|
|
3424
|
-
const size = knownSize !== void 0 ? knownSize : getItemSize(ctx, id, i, data[i], useAverageSize, preferCachedSize);
|
|
3440
|
+
const size = knownSize !== void 0 ? knownSize : getItemSize(ctx, id, i, data[i], useAverageSize, preferCachedSize, notifyTotalSizeWhileCachingSizes);
|
|
3425
3441
|
if (IS_DEV && needsIndexByKey) {
|
|
3426
3442
|
if (indexByKeyForChecking.has(id)) {
|
|
3427
3443
|
console.error(
|
|
@@ -3677,7 +3693,7 @@ function computeViewability(state, ctx, viewabilityConfig, containerId, key, scr
|
|
|
3677
3693
|
}
|
|
3678
3694
|
function checkIsViewable(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index) {
|
|
3679
3695
|
let value = ctx.mapViewabilityAmountValues.get(containerId);
|
|
3680
|
-
if (!value || value.key !== key) {
|
|
3696
|
+
if (!value || value.key !== key || value.index !== index) {
|
|
3681
3697
|
value = computeViewability(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index);
|
|
3682
3698
|
}
|
|
3683
3699
|
return value.isViewable;
|
|
@@ -3692,7 +3708,7 @@ var unstableBatchedUpdates = ReactNative.unstable_batchedUpdates;
|
|
|
3692
3708
|
var batchedUpdates = typeof unstableBatchedUpdates === "function" ? unstableBatchedUpdates : (fn) => fn();
|
|
3693
3709
|
|
|
3694
3710
|
// src/utils/findAvailableContainers.ts
|
|
3695
|
-
function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers) {
|
|
3711
|
+
function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers, protectedKeys) {
|
|
3696
3712
|
const numContainers = peek$(ctx, "numContainers");
|
|
3697
3713
|
const state = ctx.state;
|
|
3698
3714
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
@@ -3760,6 +3776,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
3760
3776
|
}
|
|
3761
3777
|
const key = peek$(ctx, `containerItemKey${u}`);
|
|
3762
3778
|
if (key === void 0) continue;
|
|
3779
|
+
if ((protectedKeys == null ? void 0 : protectedKeys.has(key)) && state.indexByKey.has(key)) continue;
|
|
3763
3780
|
const index = state.indexByKey.get(key);
|
|
3764
3781
|
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
3765
3782
|
if (isOutOfView) {
|
|
@@ -3895,7 +3912,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, drawDistance, currentSt
|
|
|
3895
3912
|
function calculateItemsInView(ctx, params = {}) {
|
|
3896
3913
|
const state = ctx.state;
|
|
3897
3914
|
batchedUpdates(() => {
|
|
3898
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3915
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
3899
3916
|
const {
|
|
3900
3917
|
columns,
|
|
3901
3918
|
columnSpans,
|
|
@@ -3997,17 +4014,31 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
3997
4014
|
if (minIndexSizeChanged !== void 0) {
|
|
3998
4015
|
state.minIndexSizeChanged = void 0;
|
|
3999
4016
|
}
|
|
4017
|
+
let protectedContainerKeys;
|
|
4018
|
+
if (dataChanged && doMVCP && state.props.maintainVisibleContentPosition.data && state.didContainersLayout && state.idsInView.length > 0) {
|
|
4019
|
+
const shouldRestorePosition = state.props.maintainVisibleContentPosition.shouldRestorePosition;
|
|
4020
|
+
protectedContainerKeys = /* @__PURE__ */ new Set();
|
|
4021
|
+
for (const id of state.idsInView) {
|
|
4022
|
+
const index = indexByKey.get(id);
|
|
4023
|
+
if (index === void 0) continue;
|
|
4024
|
+
if (shouldRestorePosition && !shouldRestorePosition(data[index], index, data)) continue;
|
|
4025
|
+
protectedContainerKeys.add(id);
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
const scrollBeforeMVCP = state.scroll;
|
|
4029
|
+
const scrollAdjustPendingBeforeMVCP = (_e = peek$(ctx, "scrollAdjustPending")) != null ? _e : 0;
|
|
4000
4030
|
checkMVCP == null ? void 0 : checkMVCP();
|
|
4031
|
+
const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0) !== scrollAdjustPendingBeforeMVCP);
|
|
4001
4032
|
let startNoBuffer = null;
|
|
4002
4033
|
let startBuffered = null;
|
|
4003
4034
|
let startBufferedId = null;
|
|
4004
4035
|
let endNoBuffer = null;
|
|
4005
4036
|
let endBuffered = null;
|
|
4006
|
-
let loopStart = (
|
|
4037
|
+
let loopStart = (_g = suppressInitialScrollSideEffects ? bootstrapInitialScrollState == null ? void 0 : bootstrapInitialScrollState.targetIndexSeed : void 0) != null ? _g : !dataChanged && startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
|
|
4007
4038
|
for (let i = loopStart; i >= 0; i--) {
|
|
4008
|
-
const id = (
|
|
4039
|
+
const id = (_h = idCache[i]) != null ? _h : getId(state, i);
|
|
4009
4040
|
const top = positions[i];
|
|
4010
|
-
const size = (
|
|
4041
|
+
const size = (_i = sizes.get(id)) != null ? _i : getItemSize(ctx, id, i, data[i]);
|
|
4011
4042
|
const bottom = top + size;
|
|
4012
4043
|
if (bottom > scroll - scrollBufferTop) {
|
|
4013
4044
|
loopStart = i;
|
|
@@ -4038,8 +4069,8 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4038
4069
|
let firstFullyOnScreenIndex;
|
|
4039
4070
|
const dataLength = data.length;
|
|
4040
4071
|
for (let i = Math.max(0, loopStart); i < dataLength && (!foundEnd || i <= maxIndexRendered); i++) {
|
|
4041
|
-
const id = (
|
|
4042
|
-
const size = (
|
|
4072
|
+
const id = (_j = idCache[i]) != null ? _j : getId(state, i);
|
|
4073
|
+
const size = (_k = sizes.get(id)) != null ? _k : getItemSize(ctx, id, i, data[i]);
|
|
4043
4074
|
const top = positions[i];
|
|
4044
4075
|
if (!foundEnd) {
|
|
4045
4076
|
if (startNoBuffer === null && top + size > scroll) {
|
|
@@ -4078,7 +4109,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4078
4109
|
const firstVisibleAnchorIndex = firstFullyOnScreenIndex != null ? firstFullyOnScreenIndex : startNoBuffer;
|
|
4079
4110
|
if (firstVisibleAnchorIndex !== null && firstVisibleAnchorIndex !== void 0 && endNoBuffer !== null) {
|
|
4080
4111
|
for (let i = firstVisibleAnchorIndex; i <= endNoBuffer; i++) {
|
|
4081
|
-
const id = (
|
|
4112
|
+
const id = (_l = idCache[i]) != null ? _l : getId(state, i);
|
|
4082
4113
|
idsInView.push(id);
|
|
4083
4114
|
}
|
|
4084
4115
|
}
|
|
@@ -4111,7 +4142,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4111
4142
|
const needNewContainers = [];
|
|
4112
4143
|
const needNewContainersSet = /* @__PURE__ */ new Set();
|
|
4113
4144
|
for (let i = startBuffered; i <= endBuffered; i++) {
|
|
4114
|
-
const id = (
|
|
4145
|
+
const id = (_m = idCache[i]) != null ? _m : getId(state, i);
|
|
4115
4146
|
if (!containerItemKeys.has(id)) {
|
|
4116
4147
|
needNewContainersSet.add(i);
|
|
4117
4148
|
needNewContainers.push(i);
|
|
@@ -4120,7 +4151,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4120
4151
|
if (alwaysRenderArr.length > 0) {
|
|
4121
4152
|
for (const index of alwaysRenderArr) {
|
|
4122
4153
|
if (index < 0 || index >= dataLength) continue;
|
|
4123
|
-
const id = (
|
|
4154
|
+
const id = (_n = idCache[index]) != null ? _n : getId(state, index);
|
|
4124
4155
|
if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
|
|
4125
4156
|
needNewContainersSet.add(index);
|
|
4126
4157
|
needNewContainers.push(index);
|
|
@@ -4153,12 +4184,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4153
4184
|
endBuffered,
|
|
4154
4185
|
pendingRemoval,
|
|
4155
4186
|
requiredItemTypes,
|
|
4156
|
-
needNewContainers
|
|
4187
|
+
needNewContainers,
|
|
4188
|
+
protectedContainerKeys
|
|
4157
4189
|
);
|
|
4158
4190
|
for (let idx = 0; idx < needNewContainers.length; idx++) {
|
|
4159
4191
|
const i = needNewContainers[idx];
|
|
4160
4192
|
const containerIndex = availableContainers[idx];
|
|
4161
|
-
const id = (
|
|
4193
|
+
const id = (_o = idCache[i]) != null ? _o : getId(state, i);
|
|
4162
4194
|
const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
4163
4195
|
if (oldKey && oldKey !== id) {
|
|
4164
4196
|
containerItemKeys.delete(oldKey);
|
|
@@ -4169,6 +4201,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4169
4201
|
state.containerItemTypes.set(containerIndex, requiredItemTypes[idx]);
|
|
4170
4202
|
}
|
|
4171
4203
|
containerItemKeys.set(id, containerIndex);
|
|
4204
|
+
(_p = state.userScrollAnchorResetKeys) == null ? void 0 : _p.add(id);
|
|
4172
4205
|
const containerSticky = `containerSticky${containerIndex}`;
|
|
4173
4206
|
const isSticky = stickyIndicesSet.has(i);
|
|
4174
4207
|
const isAlwaysRender = alwaysRenderSet.has(i);
|
|
@@ -4196,10 +4229,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4196
4229
|
}
|
|
4197
4230
|
}
|
|
4198
4231
|
}
|
|
4232
|
+
if (((_q = state.userScrollAnchorResetKeys) == null ? void 0 : _q.size) === 0) {
|
|
4233
|
+
state.userScrollAnchorResetKeys = void 0;
|
|
4234
|
+
}
|
|
4199
4235
|
if (alwaysRenderArr.length > 0) {
|
|
4200
4236
|
for (const index of alwaysRenderArr) {
|
|
4201
4237
|
if (index < 0 || index >= dataLength) continue;
|
|
4202
|
-
const id = (
|
|
4238
|
+
const id = (_r = idCache[index]) != null ? _r : getId(state, index);
|
|
4203
4239
|
const containerIndex = containerItemKeys.get(id);
|
|
4204
4240
|
if (containerIndex !== void 0) {
|
|
4205
4241
|
state.stickyContainerPool.add(containerIndex);
|
|
@@ -4260,16 +4296,18 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4260
4296
|
handleInitialScrollLayoutReady(ctx);
|
|
4261
4297
|
}
|
|
4262
4298
|
if (viewabilityConfigCallbackPairs && startNoBuffer !== null && endNoBuffer !== null) {
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4299
|
+
if (!didMVCPAdjustScroll) {
|
|
4300
|
+
updateViewableItems(
|
|
4301
|
+
ctx.state,
|
|
4302
|
+
ctx,
|
|
4303
|
+
viewabilityConfigCallbackPairs,
|
|
4304
|
+
scrollLength,
|
|
4305
|
+
startNoBuffer,
|
|
4306
|
+
endNoBuffer,
|
|
4307
|
+
startBuffered != null ? startBuffered : startNoBuffer,
|
|
4308
|
+
endBuffered != null ? endBuffered : endNoBuffer
|
|
4309
|
+
);
|
|
4310
|
+
}
|
|
4273
4311
|
}
|
|
4274
4312
|
if (onStickyHeaderChange && stickyIndicesArr.length > 0 && nextActiveStickyIndex !== void 0 && nextActiveStickyIndex !== previousStickyIndex) {
|
|
4275
4313
|
const item = data[nextActiveStickyIndex];
|
|
@@ -4559,7 +4597,14 @@ function updateScroll(ctx, newScroll, forceUpdate) {
|
|
|
4559
4597
|
(_a4 = state.triggerCalculateItemsInView) == null ? void 0 : _a4.call(state, { doMVCP: scrollingTo !== void 0 });
|
|
4560
4598
|
checkThresholds(ctx);
|
|
4561
4599
|
};
|
|
4562
|
-
if (
|
|
4600
|
+
if (scrollLength > 0 && scrollingTo === void 0 && scrollDelta > scrollLength && !state.pendingNativeMVCPAdjust) {
|
|
4601
|
+
state.mvcpAnchorLock = void 0;
|
|
4602
|
+
state.pendingNativeMVCPAdjust = void 0;
|
|
4603
|
+
state.userScrollAnchorResetKeys = /* @__PURE__ */ new Set();
|
|
4604
|
+
if (state.queuedMVCPRecalculate !== void 0) {
|
|
4605
|
+
cancelAnimationFrame(state.queuedMVCPRecalculate);
|
|
4606
|
+
state.queuedMVCPRecalculate = void 0;
|
|
4607
|
+
}
|
|
4563
4608
|
flushSync(runCalculateItems);
|
|
4564
4609
|
} else {
|
|
4565
4610
|
runCalculateItems();
|
|
@@ -4742,6 +4787,20 @@ function maybeUpdateAnchoredEndSpace(ctx) {
|
|
|
4742
4787
|
// src/core/updateItemSize.ts
|
|
4743
4788
|
function runOrScheduleMVCPRecalculate(ctx) {
|
|
4744
4789
|
const state = ctx.state;
|
|
4790
|
+
if (state.userScrollAnchorResetKeys !== void 0) {
|
|
4791
|
+
if (state.queuedMVCPRecalculate !== void 0) {
|
|
4792
|
+
return;
|
|
4793
|
+
}
|
|
4794
|
+
state.queuedMVCPRecalculate = requestAnimationFrame(() => {
|
|
4795
|
+
var _a3;
|
|
4796
|
+
state.queuedMVCPRecalculate = void 0;
|
|
4797
|
+
calculateItemsInView(ctx);
|
|
4798
|
+
if (((_a3 = state.userScrollAnchorResetKeys) == null ? void 0 : _a3.size) === 0) {
|
|
4799
|
+
state.userScrollAnchorResetKeys = void 0;
|
|
4800
|
+
}
|
|
4801
|
+
});
|
|
4802
|
+
return;
|
|
4803
|
+
}
|
|
4745
4804
|
if (Platform.OS === "web") {
|
|
4746
4805
|
if (!state.mvcpAnchorLock) {
|
|
4747
4806
|
if (state.queuedMVCPRecalculate !== void 0) {
|
|
@@ -4765,6 +4824,8 @@ function runOrScheduleMVCPRecalculate(ctx) {
|
|
|
4765
4824
|
function updateItemSize(ctx, itemKey, sizeObj) {
|
|
4766
4825
|
var _a3;
|
|
4767
4826
|
const state = ctx.state;
|
|
4827
|
+
const userScrollAnchorResetKeys = state.userScrollAnchorResetKeys;
|
|
4828
|
+
const didMeasureUserScrollAnchorResetItem = !!(userScrollAnchorResetKeys == null ? void 0 : userScrollAnchorResetKeys.delete(itemKey));
|
|
4768
4829
|
const {
|
|
4769
4830
|
didContainersLayout,
|
|
4770
4831
|
sizesKnown,
|
|
@@ -4843,10 +4904,12 @@ function updateItemSize(ctx, itemKey, sizeObj) {
|
|
|
4843
4904
|
if (!cur || maxOtherAxisSize > cur) {
|
|
4844
4905
|
set$(ctx, "otherAxisSize", maxOtherAxisSize);
|
|
4845
4906
|
}
|
|
4846
|
-
if (didContainersLayout || checkAllSizesKnown(state)) {
|
|
4907
|
+
if (didContainersLayout || checkAllSizesKnown(state, getMountedBufferedIndices(state))) {
|
|
4847
4908
|
if (needsRecalculate) {
|
|
4848
4909
|
state.scrollForNextCalculateItemsInView = void 0;
|
|
4849
4910
|
runOrScheduleMVCPRecalculate(ctx);
|
|
4911
|
+
} else if (didMeasureUserScrollAnchorResetItem && (userScrollAnchorResetKeys == null ? void 0 : userScrollAnchorResetKeys.size) === 0) {
|
|
4912
|
+
state.userScrollAnchorResetKeys = void 0;
|
|
4850
4913
|
}
|
|
4851
4914
|
if (shouldMaintainScrollAtEnd) {
|
|
4852
4915
|
if (maintainScrollAtEnd == null ? void 0 : maintainScrollAtEnd.onItemLayout) {
|