@legendapp/list 3.0.0-beta.47 → 3.0.0-beta.48
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 +42 -24
- package/index.mjs +42 -24
- package/index.native.js +73 -52
- package/index.native.mjs +73 -52
- package/package.json +1 -1
- package/react-native.js +73 -52
- package/react-native.mjs +73 -52
- package/react-native.web.js +42 -24
- package/react-native.web.mjs +42 -24
- package/react.js +42 -24
- package/react.mjs +42 -24
package/index.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() {
|
|
@@ -3677,7 +3680,7 @@ function computeViewability(state, ctx, viewabilityConfig, containerId, key, scr
|
|
|
3677
3680
|
}
|
|
3678
3681
|
function checkIsViewable(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index) {
|
|
3679
3682
|
let value = ctx.mapViewabilityAmountValues.get(containerId);
|
|
3680
|
-
if (!value || value.key !== key) {
|
|
3683
|
+
if (!value || value.key !== key || value.index !== index) {
|
|
3681
3684
|
value = computeViewability(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index);
|
|
3682
3685
|
}
|
|
3683
3686
|
return value.isViewable;
|
|
@@ -3692,7 +3695,7 @@ var unstableBatchedUpdates = ReactNative.unstable_batchedUpdates;
|
|
|
3692
3695
|
var batchedUpdates = typeof unstableBatchedUpdates === "function" ? unstableBatchedUpdates : (fn) => fn();
|
|
3693
3696
|
|
|
3694
3697
|
// src/utils/findAvailableContainers.ts
|
|
3695
|
-
function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers) {
|
|
3698
|
+
function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers, protectedKeys) {
|
|
3696
3699
|
const numContainers = peek$(ctx, "numContainers");
|
|
3697
3700
|
const state = ctx.state;
|
|
3698
3701
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
@@ -3760,6 +3763,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
3760
3763
|
}
|
|
3761
3764
|
const key = peek$(ctx, `containerItemKey${u}`);
|
|
3762
3765
|
if (key === void 0) continue;
|
|
3766
|
+
if ((protectedKeys == null ? void 0 : protectedKeys.has(key)) && state.indexByKey.has(key)) continue;
|
|
3763
3767
|
const index = state.indexByKey.get(key);
|
|
3764
3768
|
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
3765
3769
|
if (isOutOfView) {
|
|
@@ -3895,7 +3899,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, drawDistance, currentSt
|
|
|
3895
3899
|
function calculateItemsInView(ctx, params = {}) {
|
|
3896
3900
|
const state = ctx.state;
|
|
3897
3901
|
batchedUpdates(() => {
|
|
3898
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3902
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
3899
3903
|
const {
|
|
3900
3904
|
columns,
|
|
3901
3905
|
columnSpans,
|
|
@@ -3997,17 +4001,31 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
3997
4001
|
if (minIndexSizeChanged !== void 0) {
|
|
3998
4002
|
state.minIndexSizeChanged = void 0;
|
|
3999
4003
|
}
|
|
4004
|
+
let protectedContainerKeys;
|
|
4005
|
+
if (dataChanged && doMVCP && state.props.maintainVisibleContentPosition.data && state.didContainersLayout && state.idsInView.length > 0) {
|
|
4006
|
+
const shouldRestorePosition = state.props.maintainVisibleContentPosition.shouldRestorePosition;
|
|
4007
|
+
protectedContainerKeys = /* @__PURE__ */ new Set();
|
|
4008
|
+
for (const id of state.idsInView) {
|
|
4009
|
+
const index = indexByKey.get(id);
|
|
4010
|
+
if (index === void 0) continue;
|
|
4011
|
+
if (shouldRestorePosition && !shouldRestorePosition(data[index], index, data)) continue;
|
|
4012
|
+
protectedContainerKeys.add(id);
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
const scrollBeforeMVCP = state.scroll;
|
|
4016
|
+
const scrollAdjustPendingBeforeMVCP = (_e = peek$(ctx, "scrollAdjustPending")) != null ? _e : 0;
|
|
4000
4017
|
checkMVCP == null ? void 0 : checkMVCP();
|
|
4018
|
+
const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0) !== scrollAdjustPendingBeforeMVCP);
|
|
4001
4019
|
let startNoBuffer = null;
|
|
4002
4020
|
let startBuffered = null;
|
|
4003
4021
|
let startBufferedId = null;
|
|
4004
4022
|
let endNoBuffer = null;
|
|
4005
4023
|
let endBuffered = null;
|
|
4006
|
-
let loopStart = (
|
|
4024
|
+
let loopStart = (_g = suppressInitialScrollSideEffects ? bootstrapInitialScrollState == null ? void 0 : bootstrapInitialScrollState.targetIndexSeed : void 0) != null ? _g : !dataChanged && startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
|
|
4007
4025
|
for (let i = loopStart; i >= 0; i--) {
|
|
4008
|
-
const id = (
|
|
4026
|
+
const id = (_h = idCache[i]) != null ? _h : getId(state, i);
|
|
4009
4027
|
const top = positions[i];
|
|
4010
|
-
const size = (
|
|
4028
|
+
const size = (_i = sizes.get(id)) != null ? _i : getItemSize(ctx, id, i, data[i]);
|
|
4011
4029
|
const bottom = top + size;
|
|
4012
4030
|
if (bottom > scroll - scrollBufferTop) {
|
|
4013
4031
|
loopStart = i;
|
|
@@ -4038,8 +4056,8 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4038
4056
|
let firstFullyOnScreenIndex;
|
|
4039
4057
|
const dataLength = data.length;
|
|
4040
4058
|
for (let i = Math.max(0, loopStart); i < dataLength && (!foundEnd || i <= maxIndexRendered); i++) {
|
|
4041
|
-
const id = (
|
|
4042
|
-
const size = (
|
|
4059
|
+
const id = (_j = idCache[i]) != null ? _j : getId(state, i);
|
|
4060
|
+
const size = (_k = sizes.get(id)) != null ? _k : getItemSize(ctx, id, i, data[i]);
|
|
4043
4061
|
const top = positions[i];
|
|
4044
4062
|
if (!foundEnd) {
|
|
4045
4063
|
if (startNoBuffer === null && top + size > scroll) {
|
|
@@ -4078,7 +4096,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4078
4096
|
const firstVisibleAnchorIndex = firstFullyOnScreenIndex != null ? firstFullyOnScreenIndex : startNoBuffer;
|
|
4079
4097
|
if (firstVisibleAnchorIndex !== null && firstVisibleAnchorIndex !== void 0 && endNoBuffer !== null) {
|
|
4080
4098
|
for (let i = firstVisibleAnchorIndex; i <= endNoBuffer; i++) {
|
|
4081
|
-
const id = (
|
|
4099
|
+
const id = (_l = idCache[i]) != null ? _l : getId(state, i);
|
|
4082
4100
|
idsInView.push(id);
|
|
4083
4101
|
}
|
|
4084
4102
|
}
|
|
@@ -4111,7 +4129,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4111
4129
|
const needNewContainers = [];
|
|
4112
4130
|
const needNewContainersSet = /* @__PURE__ */ new Set();
|
|
4113
4131
|
for (let i = startBuffered; i <= endBuffered; i++) {
|
|
4114
|
-
const id = (
|
|
4132
|
+
const id = (_m = idCache[i]) != null ? _m : getId(state, i);
|
|
4115
4133
|
if (!containerItemKeys.has(id)) {
|
|
4116
4134
|
needNewContainersSet.add(i);
|
|
4117
4135
|
needNewContainers.push(i);
|
|
@@ -4120,7 +4138,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4120
4138
|
if (alwaysRenderArr.length > 0) {
|
|
4121
4139
|
for (const index of alwaysRenderArr) {
|
|
4122
4140
|
if (index < 0 || index >= dataLength) continue;
|
|
4123
|
-
const id = (
|
|
4141
|
+
const id = (_n = idCache[index]) != null ? _n : getId(state, index);
|
|
4124
4142
|
if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
|
|
4125
4143
|
needNewContainersSet.add(index);
|
|
4126
4144
|
needNewContainers.push(index);
|
|
@@ -4153,12 +4171,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4153
4171
|
endBuffered,
|
|
4154
4172
|
pendingRemoval,
|
|
4155
4173
|
requiredItemTypes,
|
|
4156
|
-
needNewContainers
|
|
4174
|
+
needNewContainers,
|
|
4175
|
+
protectedContainerKeys
|
|
4157
4176
|
);
|
|
4158
4177
|
for (let idx = 0; idx < needNewContainers.length; idx++) {
|
|
4159
4178
|
const i = needNewContainers[idx];
|
|
4160
4179
|
const containerIndex = availableContainers[idx];
|
|
4161
|
-
const id = (
|
|
4180
|
+
const id = (_o = idCache[i]) != null ? _o : getId(state, i);
|
|
4162
4181
|
const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
4163
4182
|
if (oldKey && oldKey !== id) {
|
|
4164
4183
|
containerItemKeys.delete(oldKey);
|
|
@@ -4199,7 +4218,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4199
4218
|
if (alwaysRenderArr.length > 0) {
|
|
4200
4219
|
for (const index of alwaysRenderArr) {
|
|
4201
4220
|
if (index < 0 || index >= dataLength) continue;
|
|
4202
|
-
const id = (
|
|
4221
|
+
const id = (_p = idCache[index]) != null ? _p : getId(state, index);
|
|
4203
4222
|
const containerIndex = containerItemKeys.get(id);
|
|
4204
4223
|
if (containerIndex !== void 0) {
|
|
4205
4224
|
state.stickyContainerPool.add(containerIndex);
|
|
@@ -4260,16 +4279,18 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4260
4279
|
handleInitialScrollLayoutReady(ctx);
|
|
4261
4280
|
}
|
|
4262
4281
|
if (viewabilityConfigCallbackPairs && startNoBuffer !== null && endNoBuffer !== null) {
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4282
|
+
if (!didMVCPAdjustScroll) {
|
|
4283
|
+
updateViewableItems(
|
|
4284
|
+
ctx.state,
|
|
4285
|
+
ctx,
|
|
4286
|
+
viewabilityConfigCallbackPairs,
|
|
4287
|
+
scrollLength,
|
|
4288
|
+
startNoBuffer,
|
|
4289
|
+
endNoBuffer,
|
|
4290
|
+
startBuffered != null ? startBuffered : startNoBuffer,
|
|
4291
|
+
endBuffered != null ? endBuffered : endNoBuffer
|
|
4292
|
+
);
|
|
4293
|
+
}
|
|
4273
4294
|
}
|
|
4274
4295
|
if (onStickyHeaderChange && stickyIndicesArr.length > 0 && nextActiveStickyIndex !== void 0 && nextActiveStickyIndex !== previousStickyIndex) {
|
|
4275
4296
|
const item = data[nextActiveStickyIndex];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/list",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.48",
|
|
4
4
|
"description": "Legend List is a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|
package/react-native.js
CHANGED
|
@@ -855,6 +855,35 @@ var Container = typedMemo(function Container2({
|
|
|
855
855
|
});
|
|
856
856
|
|
|
857
857
|
// src/components/Containers.native.tsx
|
|
858
|
+
var ContainersLayer = typedMemo(function ContainersLayer2({ children, horizontal }) {
|
|
859
|
+
const ctx = useStateContext();
|
|
860
|
+
const columnWrapperStyle = ctx.columnWrapperStyle;
|
|
861
|
+
const animSize = useValue$("totalSize");
|
|
862
|
+
const otherAxisSize = useValue$("otherAxisSize");
|
|
863
|
+
const [readyToRender, numColumns] = useArr$(["readyToRender", "numColumns"]);
|
|
864
|
+
const style = horizontal ? { minHeight: otherAxisSize, opacity: readyToRender ? 1 : 0, width: animSize } : { height: animSize, minWidth: otherAxisSize, opacity: readyToRender ? 1 : 0 };
|
|
865
|
+
if (columnWrapperStyle) {
|
|
866
|
+
const { columnGap, rowGap, gap } = columnWrapperStyle;
|
|
867
|
+
const gapX = columnGap || gap || 0;
|
|
868
|
+
const gapY = rowGap || gap || 0;
|
|
869
|
+
if (horizontal) {
|
|
870
|
+
if (gapY && numColumns > 1) {
|
|
871
|
+
style.marginVertical = -gapY / 2;
|
|
872
|
+
}
|
|
873
|
+
if (gapX) {
|
|
874
|
+
style.marginRight = -gapX;
|
|
875
|
+
}
|
|
876
|
+
} else {
|
|
877
|
+
if (gapX && numColumns > 1) {
|
|
878
|
+
style.marginHorizontal = -gapX;
|
|
879
|
+
}
|
|
880
|
+
if (gapY) {
|
|
881
|
+
style.marginBottom = -gapY;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return /* @__PURE__ */ React2__namespace.createElement(ReactNative.Animated.View, { style }, children);
|
|
886
|
+
});
|
|
858
887
|
var Containers = typedMemo(function Containers2({
|
|
859
888
|
horizontal,
|
|
860
889
|
recycleItems,
|
|
@@ -863,12 +892,7 @@ var Containers = typedMemo(function Containers2({
|
|
|
863
892
|
updateItemSize: updateItemSize2,
|
|
864
893
|
getRenderedItem: getRenderedItem2
|
|
865
894
|
}) {
|
|
866
|
-
const
|
|
867
|
-
const columnWrapperStyle = ctx.columnWrapperStyle;
|
|
868
|
-
const [numContainers, numColumns] = useArr$(["numContainersPooled", "numColumns"]);
|
|
869
|
-
const animSize = useValue$("totalSize");
|
|
870
|
-
const otherAxisSize = useValue$("otherAxisSize");
|
|
871
|
-
const animOpacity = useValue$("readyToRender", { getValue: (value) => value ? 1 : 0 });
|
|
895
|
+
const [numContainers] = useArr$(["numContainersPooled"]);
|
|
872
896
|
const containers = [];
|
|
873
897
|
for (let i = 0; i < numContainers; i++) {
|
|
874
898
|
containers.push(
|
|
@@ -887,28 +911,7 @@ var Containers = typedMemo(function Containers2({
|
|
|
887
911
|
)
|
|
888
912
|
);
|
|
889
913
|
}
|
|
890
|
-
|
|
891
|
-
if (columnWrapperStyle) {
|
|
892
|
-
const { columnGap, rowGap, gap } = columnWrapperStyle;
|
|
893
|
-
const gapX = columnGap || gap || 0;
|
|
894
|
-
const gapY = rowGap || gap || 0;
|
|
895
|
-
if (horizontal) {
|
|
896
|
-
if (gapY && numColumns > 1) {
|
|
897
|
-
style.marginVertical = -gapY / 2;
|
|
898
|
-
}
|
|
899
|
-
if (gapX) {
|
|
900
|
-
style.marginRight = -gapX;
|
|
901
|
-
}
|
|
902
|
-
} else {
|
|
903
|
-
if (gapX && numColumns > 1) {
|
|
904
|
-
style.marginHorizontal = -gapX;
|
|
905
|
-
}
|
|
906
|
-
if (gapY) {
|
|
907
|
-
style.marginBottom = -gapY;
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
return /* @__PURE__ */ React2__namespace.createElement(ReactNative.Animated.View, { style }, containers);
|
|
914
|
+
return /* @__PURE__ */ React2__namespace.createElement(ContainersLayer, { horizontal }, containers);
|
|
912
915
|
});
|
|
913
916
|
var ListComponentScrollView = ReactNative.Animated.ScrollView;
|
|
914
917
|
function ScrollAdjust() {
|
|
@@ -3698,7 +3701,7 @@ function computeViewability(state, ctx, viewabilityConfig, containerId, key, scr
|
|
|
3698
3701
|
}
|
|
3699
3702
|
function checkIsViewable(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index) {
|
|
3700
3703
|
let value = ctx.mapViewabilityAmountValues.get(containerId);
|
|
3701
|
-
if (!value || value.key !== key) {
|
|
3704
|
+
if (!value || value.key !== key || value.index !== index) {
|
|
3702
3705
|
value = computeViewability(state, ctx, viewabilityConfig, containerId, key, scrollSize, item, index);
|
|
3703
3706
|
}
|
|
3704
3707
|
return value.isViewable;
|
|
@@ -3713,7 +3716,7 @@ var unstableBatchedUpdates = ReactNative__namespace.unstable_batchedUpdates;
|
|
|
3713
3716
|
var batchedUpdates = typeof unstableBatchedUpdates === "function" ? unstableBatchedUpdates : (fn) => fn();
|
|
3714
3717
|
|
|
3715
3718
|
// src/utils/findAvailableContainers.ts
|
|
3716
|
-
function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers) {
|
|
3719
|
+
function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pendingRemoval, requiredItemTypes, needNewContainers, protectedKeys) {
|
|
3717
3720
|
const numContainers = peek$(ctx, "numContainers");
|
|
3718
3721
|
const state = ctx.state;
|
|
3719
3722
|
const { stickyContainerPool, containerItemTypes } = state;
|
|
@@ -3781,6 +3784,7 @@ function findAvailableContainers(ctx, numNeeded, startBuffered, endBuffered, pen
|
|
|
3781
3784
|
}
|
|
3782
3785
|
const key = peek$(ctx, `containerItemKey${u}`);
|
|
3783
3786
|
if (key === void 0) continue;
|
|
3787
|
+
if ((protectedKeys == null ? void 0 : protectedKeys.has(key)) && state.indexByKey.has(key)) continue;
|
|
3784
3788
|
const index = state.indexByKey.get(key);
|
|
3785
3789
|
const isOutOfView = index < startBuffered || index > endBuffered;
|
|
3786
3790
|
if (isOutOfView) {
|
|
@@ -3916,7 +3920,7 @@ function handleStickyRecycling(ctx, stickyArray, scroll, drawDistance, currentSt
|
|
|
3916
3920
|
function calculateItemsInView(ctx, params = {}) {
|
|
3917
3921
|
const state = ctx.state;
|
|
3918
3922
|
batchedUpdates(() => {
|
|
3919
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3923
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
3920
3924
|
const {
|
|
3921
3925
|
columns,
|
|
3922
3926
|
columnSpans,
|
|
@@ -4018,17 +4022,31 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4018
4022
|
if (minIndexSizeChanged !== void 0) {
|
|
4019
4023
|
state.minIndexSizeChanged = void 0;
|
|
4020
4024
|
}
|
|
4025
|
+
let protectedContainerKeys;
|
|
4026
|
+
if (dataChanged && doMVCP && state.props.maintainVisibleContentPosition.data && state.didContainersLayout && state.idsInView.length > 0) {
|
|
4027
|
+
const shouldRestorePosition = state.props.maintainVisibleContentPosition.shouldRestorePosition;
|
|
4028
|
+
protectedContainerKeys = /* @__PURE__ */ new Set();
|
|
4029
|
+
for (const id of state.idsInView) {
|
|
4030
|
+
const index = indexByKey.get(id);
|
|
4031
|
+
if (index === void 0) continue;
|
|
4032
|
+
if (shouldRestorePosition && !shouldRestorePosition(data[index], index, data)) continue;
|
|
4033
|
+
protectedContainerKeys.add(id);
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
const scrollBeforeMVCP = state.scroll;
|
|
4037
|
+
const scrollAdjustPendingBeforeMVCP = (_e = peek$(ctx, "scrollAdjustPending")) != null ? _e : 0;
|
|
4021
4038
|
checkMVCP == null ? void 0 : checkMVCP();
|
|
4039
|
+
const didMVCPAdjustScroll = !!checkMVCP && (state.scroll !== scrollBeforeMVCP || ((_f = peek$(ctx, "scrollAdjustPending")) != null ? _f : 0) !== scrollAdjustPendingBeforeMVCP);
|
|
4022
4040
|
let startNoBuffer = null;
|
|
4023
4041
|
let startBuffered = null;
|
|
4024
4042
|
let startBufferedId = null;
|
|
4025
4043
|
let endNoBuffer = null;
|
|
4026
4044
|
let endBuffered = null;
|
|
4027
|
-
let loopStart = (
|
|
4045
|
+
let loopStart = (_g = suppressInitialScrollSideEffects ? bootstrapInitialScrollState == null ? void 0 : bootstrapInitialScrollState.targetIndexSeed : void 0) != null ? _g : !dataChanged && startBufferedIdOrig ? indexByKey.get(startBufferedIdOrig) || 0 : 0;
|
|
4028
4046
|
for (let i = loopStart; i >= 0; i--) {
|
|
4029
|
-
const id = (
|
|
4047
|
+
const id = (_h = idCache[i]) != null ? _h : getId(state, i);
|
|
4030
4048
|
const top = positions[i];
|
|
4031
|
-
const size = (
|
|
4049
|
+
const size = (_i = sizes.get(id)) != null ? _i : getItemSize(ctx, id, i, data[i]);
|
|
4032
4050
|
const bottom = top + size;
|
|
4033
4051
|
if (bottom > scroll - scrollBufferTop) {
|
|
4034
4052
|
loopStart = i;
|
|
@@ -4059,8 +4077,8 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4059
4077
|
let firstFullyOnScreenIndex;
|
|
4060
4078
|
const dataLength = data.length;
|
|
4061
4079
|
for (let i = Math.max(0, loopStart); i < dataLength && (!foundEnd || i <= maxIndexRendered); i++) {
|
|
4062
|
-
const id = (
|
|
4063
|
-
const size = (
|
|
4080
|
+
const id = (_j = idCache[i]) != null ? _j : getId(state, i);
|
|
4081
|
+
const size = (_k = sizes.get(id)) != null ? _k : getItemSize(ctx, id, i, data[i]);
|
|
4064
4082
|
const top = positions[i];
|
|
4065
4083
|
if (!foundEnd) {
|
|
4066
4084
|
if (startNoBuffer === null && top + size > scroll) {
|
|
@@ -4099,7 +4117,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4099
4117
|
const firstVisibleAnchorIndex = firstFullyOnScreenIndex != null ? firstFullyOnScreenIndex : startNoBuffer;
|
|
4100
4118
|
if (firstVisibleAnchorIndex !== null && firstVisibleAnchorIndex !== void 0 && endNoBuffer !== null) {
|
|
4101
4119
|
for (let i = firstVisibleAnchorIndex; i <= endNoBuffer; i++) {
|
|
4102
|
-
const id = (
|
|
4120
|
+
const id = (_l = idCache[i]) != null ? _l : getId(state, i);
|
|
4103
4121
|
idsInView.push(id);
|
|
4104
4122
|
}
|
|
4105
4123
|
}
|
|
@@ -4132,7 +4150,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4132
4150
|
const needNewContainers = [];
|
|
4133
4151
|
const needNewContainersSet = /* @__PURE__ */ new Set();
|
|
4134
4152
|
for (let i = startBuffered; i <= endBuffered; i++) {
|
|
4135
|
-
const id = (
|
|
4153
|
+
const id = (_m = idCache[i]) != null ? _m : getId(state, i);
|
|
4136
4154
|
if (!containerItemKeys.has(id)) {
|
|
4137
4155
|
needNewContainersSet.add(i);
|
|
4138
4156
|
needNewContainers.push(i);
|
|
@@ -4141,7 +4159,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4141
4159
|
if (alwaysRenderArr.length > 0) {
|
|
4142
4160
|
for (const index of alwaysRenderArr) {
|
|
4143
4161
|
if (index < 0 || index >= dataLength) continue;
|
|
4144
|
-
const id = (
|
|
4162
|
+
const id = (_n = idCache[index]) != null ? _n : getId(state, index);
|
|
4145
4163
|
if (id && !containerItemKeys.has(id) && !needNewContainersSet.has(index)) {
|
|
4146
4164
|
needNewContainersSet.add(index);
|
|
4147
4165
|
needNewContainers.push(index);
|
|
@@ -4174,12 +4192,13 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4174
4192
|
endBuffered,
|
|
4175
4193
|
pendingRemoval,
|
|
4176
4194
|
requiredItemTypes,
|
|
4177
|
-
needNewContainers
|
|
4195
|
+
needNewContainers,
|
|
4196
|
+
protectedContainerKeys
|
|
4178
4197
|
);
|
|
4179
4198
|
for (let idx = 0; idx < needNewContainers.length; idx++) {
|
|
4180
4199
|
const i = needNewContainers[idx];
|
|
4181
4200
|
const containerIndex = availableContainers[idx];
|
|
4182
|
-
const id = (
|
|
4201
|
+
const id = (_o = idCache[i]) != null ? _o : getId(state, i);
|
|
4183
4202
|
const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
4184
4203
|
if (oldKey && oldKey !== id) {
|
|
4185
4204
|
containerItemKeys.delete(oldKey);
|
|
@@ -4220,7 +4239,7 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4220
4239
|
if (alwaysRenderArr.length > 0) {
|
|
4221
4240
|
for (const index of alwaysRenderArr) {
|
|
4222
4241
|
if (index < 0 || index >= dataLength) continue;
|
|
4223
|
-
const id = (
|
|
4242
|
+
const id = (_p = idCache[index]) != null ? _p : getId(state, index);
|
|
4224
4243
|
const containerIndex = containerItemKeys.get(id);
|
|
4225
4244
|
if (containerIndex !== void 0) {
|
|
4226
4245
|
state.stickyContainerPool.add(containerIndex);
|
|
@@ -4281,16 +4300,18 @@ function calculateItemsInView(ctx, params = {}) {
|
|
|
4281
4300
|
handleInitialScrollLayoutReady(ctx);
|
|
4282
4301
|
}
|
|
4283
4302
|
if (viewabilityConfigCallbackPairs && startNoBuffer !== null && endNoBuffer !== null) {
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4303
|
+
if (!didMVCPAdjustScroll) {
|
|
4304
|
+
updateViewableItems(
|
|
4305
|
+
ctx.state,
|
|
4306
|
+
ctx,
|
|
4307
|
+
viewabilityConfigCallbackPairs,
|
|
4308
|
+
scrollLength,
|
|
4309
|
+
startNoBuffer,
|
|
4310
|
+
endNoBuffer,
|
|
4311
|
+
startBuffered != null ? startBuffered : startNoBuffer,
|
|
4312
|
+
endBuffered != null ? endBuffered : endNoBuffer
|
|
4313
|
+
);
|
|
4314
|
+
}
|
|
4294
4315
|
}
|
|
4295
4316
|
if (onStickyHeaderChange && stickyIndicesArr.length > 0 && nextActiveStickyIndex !== void 0 && nextActiveStickyIndex !== previousStickyIndex) {
|
|
4296
4317
|
const item = data[nextActiveStickyIndex];
|