@legendapp/list 2.0.0-next.22 → 2.0.0-next.24
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/.DS_Store +0 -0
- package/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.js +55 -58
- package/index.mjs +55 -58
- package/package.json +1 -1
package/.DS_Store
ADDED
|
Binary file
|
package/index.d.mts
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -920,18 +920,6 @@ function calculateOffsetWithOffsetPosition(state, offsetParam, params) {
|
|
|
920
920
|
return offset;
|
|
921
921
|
}
|
|
922
922
|
|
|
923
|
-
// src/core/getEffectiveScroll.ts
|
|
924
|
-
function getEffectiveScroll(ctx, state) {
|
|
925
|
-
const { scroll: scrollState, scrollLength } = state;
|
|
926
|
-
const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
|
|
927
|
-
const totalSize = peek$(ctx, "totalSize");
|
|
928
|
-
let scroll = scrollState - topPad;
|
|
929
|
-
if (scroll + scrollLength > totalSize) {
|
|
930
|
-
scroll = Math.max(0, totalSize - scrollLength);
|
|
931
|
-
}
|
|
932
|
-
return scroll;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
923
|
// src/core/finishScrollTo.ts
|
|
936
924
|
var finishScrollTo = (state) => {
|
|
937
925
|
if (state) {
|
|
@@ -943,14 +931,16 @@ var finishScrollTo = (state) => {
|
|
|
943
931
|
// src/core/scrollTo.ts
|
|
944
932
|
function scrollTo(state, params = {}) {
|
|
945
933
|
var _a;
|
|
946
|
-
const { animated } = params;
|
|
934
|
+
const { animated, noScrollingTo } = params;
|
|
947
935
|
const {
|
|
948
936
|
refScroller,
|
|
949
937
|
props: { horizontal }
|
|
950
938
|
} = state;
|
|
951
939
|
const offset = calculateOffsetWithOffsetPosition(state, params.offset, params);
|
|
952
940
|
state.scrollHistory.length = 0;
|
|
953
|
-
|
|
941
|
+
if (!noScrollingTo) {
|
|
942
|
+
state.scrollingTo = params;
|
|
943
|
+
}
|
|
954
944
|
state.scrollPending = offset;
|
|
955
945
|
(_a = refScroller.current) == null ? void 0 : _a.scrollTo({
|
|
956
946
|
animated: !!animated,
|
|
@@ -964,10 +954,18 @@ function scrollTo(state, params = {}) {
|
|
|
964
954
|
}
|
|
965
955
|
|
|
966
956
|
// src/utils/requestAdjust.ts
|
|
967
|
-
function requestAdjust(ctx, state, positionDiff) {
|
|
957
|
+
function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
968
958
|
if (Math.abs(positionDiff) > 0.1) {
|
|
959
|
+
const needsScrollWorkaround = reactNative.Platform.OS === "android" && !IsNewArchitecture && dataChanged && state.scroll <= positionDiff;
|
|
969
960
|
const doit = () => {
|
|
970
|
-
|
|
961
|
+
if (needsScrollWorkaround) {
|
|
962
|
+
scrollTo(state, {
|
|
963
|
+
noScrollingTo: true,
|
|
964
|
+
offset: state.scroll
|
|
965
|
+
});
|
|
966
|
+
} else {
|
|
967
|
+
state.scrollAdjustHandler.requestAdjust(positionDiff);
|
|
968
|
+
}
|
|
971
969
|
};
|
|
972
970
|
state.scroll += positionDiff;
|
|
973
971
|
state.scrollForNextCalculateItemsInView = void 0;
|
|
@@ -986,9 +984,12 @@ function requestAdjust(ctx, state, positionDiff) {
|
|
|
986
984
|
if (state.ignoreScrollFromMVCPTimeout) {
|
|
987
985
|
clearTimeout(state.ignoreScrollFromMVCPTimeout);
|
|
988
986
|
}
|
|
989
|
-
state.ignoreScrollFromMVCPTimeout = setTimeout(
|
|
990
|
-
|
|
991
|
-
|
|
987
|
+
state.ignoreScrollFromMVCPTimeout = setTimeout(
|
|
988
|
+
() => {
|
|
989
|
+
state.ignoreScrollFromMVCP = void 0;
|
|
990
|
+
},
|
|
991
|
+
needsScrollWorkaround ? 250 : 100
|
|
992
|
+
);
|
|
992
993
|
} else {
|
|
993
994
|
requestAnimationFrame(doit);
|
|
994
995
|
}
|
|
@@ -996,44 +997,32 @@ function requestAdjust(ctx, state, positionDiff) {
|
|
|
996
997
|
}
|
|
997
998
|
|
|
998
999
|
// src/core/mvcp.ts
|
|
999
|
-
function getItemsInView(ctx, state) {
|
|
1000
|
-
const { startNoBuffer, endNoBuffer, positions, scrollLength } = state;
|
|
1001
|
-
const idsInViewWithPositions = [];
|
|
1002
|
-
const scroll = getEffectiveScroll(ctx, state);
|
|
1003
|
-
if (startNoBuffer !== null && endNoBuffer !== null) {
|
|
1004
|
-
for (let i = startNoBuffer; i <= endNoBuffer; i++) {
|
|
1005
|
-
const id = getId(state, i);
|
|
1006
|
-
if (id) {
|
|
1007
|
-
const position = positions.get(id);
|
|
1008
|
-
if (position === void 0 || position > scroll + scrollLength) {
|
|
1009
|
-
break;
|
|
1010
|
-
} else if (position >= scroll) {
|
|
1011
|
-
idsInViewWithPositions.push({ id, position });
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
return idsInViewWithPositions;
|
|
1017
|
-
}
|
|
1018
1000
|
function prepareMVCP(ctx, state, dataChanged) {
|
|
1019
|
-
var _a;
|
|
1020
1001
|
const {
|
|
1002
|
+
idsInView,
|
|
1021
1003
|
positions,
|
|
1022
1004
|
scrollingTo,
|
|
1023
1005
|
props: { maintainVisibleContentPosition }
|
|
1024
1006
|
} = state;
|
|
1025
1007
|
let prevPosition;
|
|
1026
1008
|
let targetId;
|
|
1027
|
-
|
|
1009
|
+
const idsInViewWithPositions = [];
|
|
1028
1010
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1029
1011
|
if (maintainVisibleContentPosition) {
|
|
1030
1012
|
const indexByKey = state.indexByKey;
|
|
1031
1013
|
if (scrollTarget !== void 0) {
|
|
1032
1014
|
targetId = getId(state, scrollTarget);
|
|
1033
|
-
} else if (peek$(ctx, "containersDidLayout")) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1015
|
+
} else if (idsInView.length > 0 && peek$(ctx, "containersDidLayout")) {
|
|
1016
|
+
if (dataChanged) {
|
|
1017
|
+
for (let i = 0; i < idsInView.length; i++) {
|
|
1018
|
+
const id = idsInView[i];
|
|
1019
|
+
const index = indexByKey.get(id);
|
|
1020
|
+
if (index !== void 0) {
|
|
1021
|
+
idsInViewWithPositions.push({ id, position: positions.get(id) });
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
} else {
|
|
1025
|
+
targetId = state.idsInView.find((id) => indexByKey.get(id) !== void 0);
|
|
1037
1026
|
}
|
|
1038
1027
|
}
|
|
1039
1028
|
if (targetId !== void 0) {
|
|
@@ -1042,7 +1031,7 @@ function prepareMVCP(ctx, state, dataChanged) {
|
|
|
1042
1031
|
}
|
|
1043
1032
|
return () => {
|
|
1044
1033
|
let positionDiff;
|
|
1045
|
-
if (dataChanged &&
|
|
1034
|
+
if (dataChanged && targetId === void 0) {
|
|
1046
1035
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1047
1036
|
const { id, position } = idsInViewWithPositions[i];
|
|
1048
1037
|
const newPosition = positions.get(id);
|
|
@@ -1059,13 +1048,7 @@ function prepareMVCP(ctx, state, dataChanged) {
|
|
|
1059
1048
|
}
|
|
1060
1049
|
}
|
|
1061
1050
|
if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
|
|
1062
|
-
|
|
1063
|
-
scrollTo(state, {
|
|
1064
|
-
offset: state.scroll + positionDiff
|
|
1065
|
-
});
|
|
1066
|
-
} else {
|
|
1067
|
-
requestAdjust(ctx, state, positionDiff);
|
|
1068
|
-
}
|
|
1051
|
+
requestAdjust(ctx, state, positionDiff, dataChanged);
|
|
1069
1052
|
}
|
|
1070
1053
|
};
|
|
1071
1054
|
}
|
|
@@ -1789,7 +1772,7 @@ function handleStickyRecycling(ctx, state, stickyArray, scroll, scrollBuffer, pe
|
|
|
1789
1772
|
}
|
|
1790
1773
|
function calculateItemsInView(ctx, state, params = {}) {
|
|
1791
1774
|
reactNative.unstable_batchedUpdates(() => {
|
|
1792
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1775
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1793
1776
|
const {
|
|
1794
1777
|
columns,
|
|
1795
1778
|
containerItemKeys,
|
|
@@ -1810,7 +1793,10 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1810
1793
|
if (!data || scrollLength === 0 || !prevNumContainers) {
|
|
1811
1794
|
return;
|
|
1812
1795
|
}
|
|
1796
|
+
const totalSize = peek$(ctx, "totalSize");
|
|
1797
|
+
const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
|
|
1813
1798
|
const numColumns = peek$(ctx, "numColumns");
|
|
1799
|
+
const previousScrollAdjust = 0;
|
|
1814
1800
|
const { dataChanged, doMVCP } = params;
|
|
1815
1801
|
const speed = getScrollVelocity(state);
|
|
1816
1802
|
if (doMVCP || dataChanged) {
|
|
@@ -1823,6 +1809,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1823
1809
|
updateAllPositions(ctx, state, dataChanged);
|
|
1824
1810
|
checkMVCP == null ? void 0 : checkMVCP();
|
|
1825
1811
|
}
|
|
1812
|
+
const scrollExtra = 0;
|
|
1826
1813
|
const { queuedInitialLayout } = state;
|
|
1827
1814
|
let { scroll: scrollState } = state;
|
|
1828
1815
|
if (!queuedInitialLayout && initialScroll) {
|
|
@@ -1832,9 +1819,12 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1832
1819
|
initialScroll
|
|
1833
1820
|
);
|
|
1834
1821
|
scrollState = updatedOffset;
|
|
1835
|
-
state.scroll = scrollState;
|
|
1836
1822
|
}
|
|
1837
|
-
const
|
|
1823
|
+
const scrollAdjustPad = -previousScrollAdjust - topPad;
|
|
1824
|
+
let scroll = scrollState + scrollExtra + scrollAdjustPad;
|
|
1825
|
+
if (scroll + scrollLength > totalSize) {
|
|
1826
|
+
scroll = Math.max(0, totalSize - scrollLength);
|
|
1827
|
+
}
|
|
1838
1828
|
if (ENABLE_DEBUG_VIEW) {
|
|
1839
1829
|
set$(ctx, "debugRawScroll", scrollState);
|
|
1840
1830
|
set$(ctx, "debugComputedScroll", scroll);
|
|
@@ -1924,10 +1914,16 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1924
1914
|
}
|
|
1925
1915
|
}
|
|
1926
1916
|
}
|
|
1917
|
+
const idsInView = [];
|
|
1918
|
+
for (let i = firstFullyOnScreenIndex; i <= endNoBuffer; i++) {
|
|
1919
|
+
const id = (_e = idCache.get(i)) != null ? _e : getId(state, i);
|
|
1920
|
+
idsInView.push(id);
|
|
1921
|
+
}
|
|
1927
1922
|
Object.assign(state, {
|
|
1928
1923
|
endBuffered,
|
|
1929
1924
|
endNoBuffer,
|
|
1930
1925
|
firstFullyOnScreenIndex,
|
|
1926
|
+
idsInView,
|
|
1931
1927
|
startBuffered,
|
|
1932
1928
|
startBufferedId,
|
|
1933
1929
|
startNoBuffer
|
|
@@ -1952,7 +1948,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1952
1948
|
let numContainers2 = prevNumContainers;
|
|
1953
1949
|
const needNewContainers = [];
|
|
1954
1950
|
for (let i = startBuffered; i <= endBuffered; i++) {
|
|
1955
|
-
const id = (
|
|
1951
|
+
const id = (_f = idCache.get(i)) != null ? _f : getId(state, i);
|
|
1956
1952
|
if (!containerItemKeys.has(id)) {
|
|
1957
1953
|
needNewContainers.push(i);
|
|
1958
1954
|
}
|
|
@@ -1987,7 +1983,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1987
1983
|
for (let idx = 0; idx < needNewContainers.length; idx++) {
|
|
1988
1984
|
const i = needNewContainers[idx];
|
|
1989
1985
|
const containerIndex = availableContainers[idx];
|
|
1990
|
-
const id = (
|
|
1986
|
+
const id = (_g = idCache.get(i)) != null ? _g : getId(state, i);
|
|
1991
1987
|
const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
1992
1988
|
if (oldKey && oldKey !== id) {
|
|
1993
1989
|
containerItemKeys.delete(oldKey);
|
|
@@ -2041,7 +2037,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
2041
2037
|
const itemIndex = indexByKey.get(itemKey);
|
|
2042
2038
|
const item = data[itemIndex];
|
|
2043
2039
|
if (item !== void 0) {
|
|
2044
|
-
const id = (
|
|
2040
|
+
const id = (_h = idCache.get(itemIndex)) != null ? _h : getId(state, itemIndex);
|
|
2045
2041
|
const position = positions.get(id);
|
|
2046
2042
|
if (position === void 0) {
|
|
2047
2043
|
set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
|
|
@@ -2619,6 +2615,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2619
2615
|
endReachedBlockedByTimer: false,
|
|
2620
2616
|
firstFullyOnScreenIndex: -1,
|
|
2621
2617
|
idCache: /* @__PURE__ */ new Map(),
|
|
2618
|
+
idsInView: [],
|
|
2622
2619
|
indexByKey: /* @__PURE__ */ new Map(),
|
|
2623
2620
|
initialScroll,
|
|
2624
2621
|
isAtEnd: false,
|
package/index.mjs
CHANGED
|
@@ -899,18 +899,6 @@ function calculateOffsetWithOffsetPosition(state, offsetParam, params) {
|
|
|
899
899
|
return offset;
|
|
900
900
|
}
|
|
901
901
|
|
|
902
|
-
// src/core/getEffectiveScroll.ts
|
|
903
|
-
function getEffectiveScroll(ctx, state) {
|
|
904
|
-
const { scroll: scrollState, scrollLength } = state;
|
|
905
|
-
const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
|
|
906
|
-
const totalSize = peek$(ctx, "totalSize");
|
|
907
|
-
let scroll = scrollState - topPad;
|
|
908
|
-
if (scroll + scrollLength > totalSize) {
|
|
909
|
-
scroll = Math.max(0, totalSize - scrollLength);
|
|
910
|
-
}
|
|
911
|
-
return scroll;
|
|
912
|
-
}
|
|
913
|
-
|
|
914
902
|
// src/core/finishScrollTo.ts
|
|
915
903
|
var finishScrollTo = (state) => {
|
|
916
904
|
if (state) {
|
|
@@ -922,14 +910,16 @@ var finishScrollTo = (state) => {
|
|
|
922
910
|
// src/core/scrollTo.ts
|
|
923
911
|
function scrollTo(state, params = {}) {
|
|
924
912
|
var _a;
|
|
925
|
-
const { animated } = params;
|
|
913
|
+
const { animated, noScrollingTo } = params;
|
|
926
914
|
const {
|
|
927
915
|
refScroller,
|
|
928
916
|
props: { horizontal }
|
|
929
917
|
} = state;
|
|
930
918
|
const offset = calculateOffsetWithOffsetPosition(state, params.offset, params);
|
|
931
919
|
state.scrollHistory.length = 0;
|
|
932
|
-
|
|
920
|
+
if (!noScrollingTo) {
|
|
921
|
+
state.scrollingTo = params;
|
|
922
|
+
}
|
|
933
923
|
state.scrollPending = offset;
|
|
934
924
|
(_a = refScroller.current) == null ? void 0 : _a.scrollTo({
|
|
935
925
|
animated: !!animated,
|
|
@@ -943,10 +933,18 @@ function scrollTo(state, params = {}) {
|
|
|
943
933
|
}
|
|
944
934
|
|
|
945
935
|
// src/utils/requestAdjust.ts
|
|
946
|
-
function requestAdjust(ctx, state, positionDiff) {
|
|
936
|
+
function requestAdjust(ctx, state, positionDiff, dataChanged) {
|
|
947
937
|
if (Math.abs(positionDiff) > 0.1) {
|
|
938
|
+
const needsScrollWorkaround = Platform.OS === "android" && !IsNewArchitecture && dataChanged && state.scroll <= positionDiff;
|
|
948
939
|
const doit = () => {
|
|
949
|
-
|
|
940
|
+
if (needsScrollWorkaround) {
|
|
941
|
+
scrollTo(state, {
|
|
942
|
+
noScrollingTo: true,
|
|
943
|
+
offset: state.scroll
|
|
944
|
+
});
|
|
945
|
+
} else {
|
|
946
|
+
state.scrollAdjustHandler.requestAdjust(positionDiff);
|
|
947
|
+
}
|
|
950
948
|
};
|
|
951
949
|
state.scroll += positionDiff;
|
|
952
950
|
state.scrollForNextCalculateItemsInView = void 0;
|
|
@@ -965,9 +963,12 @@ function requestAdjust(ctx, state, positionDiff) {
|
|
|
965
963
|
if (state.ignoreScrollFromMVCPTimeout) {
|
|
966
964
|
clearTimeout(state.ignoreScrollFromMVCPTimeout);
|
|
967
965
|
}
|
|
968
|
-
state.ignoreScrollFromMVCPTimeout = setTimeout(
|
|
969
|
-
|
|
970
|
-
|
|
966
|
+
state.ignoreScrollFromMVCPTimeout = setTimeout(
|
|
967
|
+
() => {
|
|
968
|
+
state.ignoreScrollFromMVCP = void 0;
|
|
969
|
+
},
|
|
970
|
+
needsScrollWorkaround ? 250 : 100
|
|
971
|
+
);
|
|
971
972
|
} else {
|
|
972
973
|
requestAnimationFrame(doit);
|
|
973
974
|
}
|
|
@@ -975,44 +976,32 @@ function requestAdjust(ctx, state, positionDiff) {
|
|
|
975
976
|
}
|
|
976
977
|
|
|
977
978
|
// src/core/mvcp.ts
|
|
978
|
-
function getItemsInView(ctx, state) {
|
|
979
|
-
const { startNoBuffer, endNoBuffer, positions, scrollLength } = state;
|
|
980
|
-
const idsInViewWithPositions = [];
|
|
981
|
-
const scroll = getEffectiveScroll(ctx, state);
|
|
982
|
-
if (startNoBuffer !== null && endNoBuffer !== null) {
|
|
983
|
-
for (let i = startNoBuffer; i <= endNoBuffer; i++) {
|
|
984
|
-
const id = getId(state, i);
|
|
985
|
-
if (id) {
|
|
986
|
-
const position = positions.get(id);
|
|
987
|
-
if (position === void 0 || position > scroll + scrollLength) {
|
|
988
|
-
break;
|
|
989
|
-
} else if (position >= scroll) {
|
|
990
|
-
idsInViewWithPositions.push({ id, position });
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
return idsInViewWithPositions;
|
|
996
|
-
}
|
|
997
979
|
function prepareMVCP(ctx, state, dataChanged) {
|
|
998
|
-
var _a;
|
|
999
980
|
const {
|
|
981
|
+
idsInView,
|
|
1000
982
|
positions,
|
|
1001
983
|
scrollingTo,
|
|
1002
984
|
props: { maintainVisibleContentPosition }
|
|
1003
985
|
} = state;
|
|
1004
986
|
let prevPosition;
|
|
1005
987
|
let targetId;
|
|
1006
|
-
|
|
988
|
+
const idsInViewWithPositions = [];
|
|
1007
989
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1008
990
|
if (maintainVisibleContentPosition) {
|
|
1009
991
|
const indexByKey = state.indexByKey;
|
|
1010
992
|
if (scrollTarget !== void 0) {
|
|
1011
993
|
targetId = getId(state, scrollTarget);
|
|
1012
|
-
} else if (peek$(ctx, "containersDidLayout")) {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
994
|
+
} else if (idsInView.length > 0 && peek$(ctx, "containersDidLayout")) {
|
|
995
|
+
if (dataChanged) {
|
|
996
|
+
for (let i = 0; i < idsInView.length; i++) {
|
|
997
|
+
const id = idsInView[i];
|
|
998
|
+
const index = indexByKey.get(id);
|
|
999
|
+
if (index !== void 0) {
|
|
1000
|
+
idsInViewWithPositions.push({ id, position: positions.get(id) });
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
} else {
|
|
1004
|
+
targetId = state.idsInView.find((id) => indexByKey.get(id) !== void 0);
|
|
1016
1005
|
}
|
|
1017
1006
|
}
|
|
1018
1007
|
if (targetId !== void 0) {
|
|
@@ -1021,7 +1010,7 @@ function prepareMVCP(ctx, state, dataChanged) {
|
|
|
1021
1010
|
}
|
|
1022
1011
|
return () => {
|
|
1023
1012
|
let positionDiff;
|
|
1024
|
-
if (dataChanged &&
|
|
1013
|
+
if (dataChanged && targetId === void 0) {
|
|
1025
1014
|
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1026
1015
|
const { id, position } = idsInViewWithPositions[i];
|
|
1027
1016
|
const newPosition = positions.get(id);
|
|
@@ -1038,13 +1027,7 @@ function prepareMVCP(ctx, state, dataChanged) {
|
|
|
1038
1027
|
}
|
|
1039
1028
|
}
|
|
1040
1029
|
if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
|
|
1041
|
-
|
|
1042
|
-
scrollTo(state, {
|
|
1043
|
-
offset: state.scroll + positionDiff
|
|
1044
|
-
});
|
|
1045
|
-
} else {
|
|
1046
|
-
requestAdjust(ctx, state, positionDiff);
|
|
1047
|
-
}
|
|
1030
|
+
requestAdjust(ctx, state, positionDiff, dataChanged);
|
|
1048
1031
|
}
|
|
1049
1032
|
};
|
|
1050
1033
|
}
|
|
@@ -1768,7 +1751,7 @@ function handleStickyRecycling(ctx, state, stickyArray, scroll, scrollBuffer, pe
|
|
|
1768
1751
|
}
|
|
1769
1752
|
function calculateItemsInView(ctx, state, params = {}) {
|
|
1770
1753
|
unstable_batchedUpdates(() => {
|
|
1771
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1754
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1772
1755
|
const {
|
|
1773
1756
|
columns,
|
|
1774
1757
|
containerItemKeys,
|
|
@@ -1789,7 +1772,10 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1789
1772
|
if (!data || scrollLength === 0 || !prevNumContainers) {
|
|
1790
1773
|
return;
|
|
1791
1774
|
}
|
|
1775
|
+
const totalSize = peek$(ctx, "totalSize");
|
|
1776
|
+
const topPad = peek$(ctx, "stylePaddingTop") + peek$(ctx, "headerSize");
|
|
1792
1777
|
const numColumns = peek$(ctx, "numColumns");
|
|
1778
|
+
const previousScrollAdjust = 0;
|
|
1793
1779
|
const { dataChanged, doMVCP } = params;
|
|
1794
1780
|
const speed = getScrollVelocity(state);
|
|
1795
1781
|
if (doMVCP || dataChanged) {
|
|
@@ -1802,6 +1788,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1802
1788
|
updateAllPositions(ctx, state, dataChanged);
|
|
1803
1789
|
checkMVCP == null ? void 0 : checkMVCP();
|
|
1804
1790
|
}
|
|
1791
|
+
const scrollExtra = 0;
|
|
1805
1792
|
const { queuedInitialLayout } = state;
|
|
1806
1793
|
let { scroll: scrollState } = state;
|
|
1807
1794
|
if (!queuedInitialLayout && initialScroll) {
|
|
@@ -1811,9 +1798,12 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1811
1798
|
initialScroll
|
|
1812
1799
|
);
|
|
1813
1800
|
scrollState = updatedOffset;
|
|
1814
|
-
state.scroll = scrollState;
|
|
1815
1801
|
}
|
|
1816
|
-
const
|
|
1802
|
+
const scrollAdjustPad = -previousScrollAdjust - topPad;
|
|
1803
|
+
let scroll = scrollState + scrollExtra + scrollAdjustPad;
|
|
1804
|
+
if (scroll + scrollLength > totalSize) {
|
|
1805
|
+
scroll = Math.max(0, totalSize - scrollLength);
|
|
1806
|
+
}
|
|
1817
1807
|
if (ENABLE_DEBUG_VIEW) {
|
|
1818
1808
|
set$(ctx, "debugRawScroll", scrollState);
|
|
1819
1809
|
set$(ctx, "debugComputedScroll", scroll);
|
|
@@ -1903,10 +1893,16 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1903
1893
|
}
|
|
1904
1894
|
}
|
|
1905
1895
|
}
|
|
1896
|
+
const idsInView = [];
|
|
1897
|
+
for (let i = firstFullyOnScreenIndex; i <= endNoBuffer; i++) {
|
|
1898
|
+
const id = (_e = idCache.get(i)) != null ? _e : getId(state, i);
|
|
1899
|
+
idsInView.push(id);
|
|
1900
|
+
}
|
|
1906
1901
|
Object.assign(state, {
|
|
1907
1902
|
endBuffered,
|
|
1908
1903
|
endNoBuffer,
|
|
1909
1904
|
firstFullyOnScreenIndex,
|
|
1905
|
+
idsInView,
|
|
1910
1906
|
startBuffered,
|
|
1911
1907
|
startBufferedId,
|
|
1912
1908
|
startNoBuffer
|
|
@@ -1931,7 +1927,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1931
1927
|
let numContainers2 = prevNumContainers;
|
|
1932
1928
|
const needNewContainers = [];
|
|
1933
1929
|
for (let i = startBuffered; i <= endBuffered; i++) {
|
|
1934
|
-
const id = (
|
|
1930
|
+
const id = (_f = idCache.get(i)) != null ? _f : getId(state, i);
|
|
1935
1931
|
if (!containerItemKeys.has(id)) {
|
|
1936
1932
|
needNewContainers.push(i);
|
|
1937
1933
|
}
|
|
@@ -1966,7 +1962,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
1966
1962
|
for (let idx = 0; idx < needNewContainers.length; idx++) {
|
|
1967
1963
|
const i = needNewContainers[idx];
|
|
1968
1964
|
const containerIndex = availableContainers[idx];
|
|
1969
|
-
const id = (
|
|
1965
|
+
const id = (_g = idCache.get(i)) != null ? _g : getId(state, i);
|
|
1970
1966
|
const oldKey = peek$(ctx, `containerItemKey${containerIndex}`);
|
|
1971
1967
|
if (oldKey && oldKey !== id) {
|
|
1972
1968
|
containerItemKeys.delete(oldKey);
|
|
@@ -2020,7 +2016,7 @@ function calculateItemsInView(ctx, state, params = {}) {
|
|
|
2020
2016
|
const itemIndex = indexByKey.get(itemKey);
|
|
2021
2017
|
const item = data[itemIndex];
|
|
2022
2018
|
if (item !== void 0) {
|
|
2023
|
-
const id = (
|
|
2019
|
+
const id = (_h = idCache.get(itemIndex)) != null ? _h : getId(state, itemIndex);
|
|
2024
2020
|
const position = positions.get(id);
|
|
2025
2021
|
if (position === void 0) {
|
|
2026
2022
|
set$(ctx, `containerPosition${i}`, POSITION_OUT_OF_VIEW);
|
|
@@ -2598,6 +2594,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
2598
2594
|
endReachedBlockedByTimer: false,
|
|
2599
2595
|
firstFullyOnScreenIndex: -1,
|
|
2600
2596
|
idCache: /* @__PURE__ */ new Map(),
|
|
2597
|
+
idsInView: [],
|
|
2601
2598
|
indexByKey: /* @__PURE__ */ new Map(),
|
|
2602
2599
|
initialScroll,
|
|
2603
2600
|
isAtEnd: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/list",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.24",
|
|
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,
|