@legendapp/list 2.0.0-next.11 → 2.0.0-next.12
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 +38 -19
- package/index.mjs +38 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -303,12 +303,10 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
303
303
|
return /* @__PURE__ */ React3__namespace.createElement(reactNative.Animated.View, { ref: refView, style: viewStyle, ...rest });
|
|
304
304
|
});
|
|
305
305
|
var PositionView3 = IsNewArchitecture ? PositionViewState : PositionViewAnimated;
|
|
306
|
-
|
|
307
|
-
// src/components/Separator.tsx
|
|
308
306
|
function Separator({ ItemSeparatorComponent, itemKey, leadingItem }) {
|
|
309
307
|
const [lastItemKeys] = useArr$(["lastItemKeys"]);
|
|
310
308
|
const isALastItem = lastItemKeys.includes(itemKey);
|
|
311
|
-
return isALastItem ? null : /* @__PURE__ */
|
|
309
|
+
return isALastItem ? null : /* @__PURE__ */ React3__namespace.createElement(ItemSeparatorComponent, { leadingItem });
|
|
312
310
|
}
|
|
313
311
|
var symbolFirst = Symbol();
|
|
314
312
|
function useInit(cb) {
|
|
@@ -989,41 +987,61 @@ function requestAdjust(ctx, state, positionDiff) {
|
|
|
989
987
|
// src/core/prepareMVCP.ts
|
|
990
988
|
function prepareMVCP(ctx, state, dataChanged) {
|
|
991
989
|
const {
|
|
990
|
+
idsInView,
|
|
992
991
|
positions,
|
|
993
992
|
scrollingTo,
|
|
994
993
|
props: { maintainVisibleContentPosition }
|
|
995
994
|
} = state;
|
|
996
995
|
let prevPosition;
|
|
997
996
|
let targetId;
|
|
998
|
-
|
|
997
|
+
const idsInViewWithPositions = [];
|
|
999
998
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
1000
999
|
if (maintainVisibleContentPosition) {
|
|
1001
1000
|
const indexByKey = state.indexByKey;
|
|
1002
1001
|
if (scrollTarget !== void 0) {
|
|
1003
1002
|
targetId = getId(state, scrollTarget);
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1003
|
+
} else if (idsInView.length > 0 && peek$(ctx, "containersDidLayout")) {
|
|
1004
|
+
if (dataChanged) {
|
|
1005
|
+
for (let i = 0; i < idsInView.length; i++) {
|
|
1006
|
+
const id = idsInView[i];
|
|
1007
|
+
const index = indexByKey.get(id);
|
|
1008
|
+
if (index !== void 0) {
|
|
1009
|
+
idsInViewWithPositions.push({ id, position: positions.get(id) });
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
} else {
|
|
1013
|
+
targetId = state.idsInView.find((id) => indexByKey.get(id) !== void 0);
|
|
1014
|
+
}
|
|
1008
1015
|
}
|
|
1009
|
-
if (targetId !== void 0
|
|
1016
|
+
if (targetId !== void 0) {
|
|
1010
1017
|
prevPosition = positions.get(targetId);
|
|
1011
1018
|
}
|
|
1012
1019
|
}
|
|
1013
1020
|
return () => {
|
|
1021
|
+
let positionDiff;
|
|
1022
|
+
if (targetId === void 0) {
|
|
1023
|
+
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1024
|
+
const { id, position } = idsInViewWithPositions[i];
|
|
1025
|
+
const newPosition = positions.get(id);
|
|
1026
|
+
if (newPosition !== void 0) {
|
|
1027
|
+
positionDiff = newPosition - position;
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1014
1032
|
if (targetId !== void 0 && prevPosition !== void 0) {
|
|
1015
1033
|
const newPosition = positions.get(targetId);
|
|
1016
1034
|
if (newPosition !== void 0) {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1035
|
+
positionDiff = newPosition - prevPosition;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
|
|
1039
|
+
if (reactNative.Platform.OS === "android" && !IsNewArchitecture && dataChanged && state.scroll <= positionDiff) {
|
|
1040
|
+
scrollTo(state, {
|
|
1041
|
+
offset: state.scroll + positionDiff
|
|
1042
|
+
});
|
|
1043
|
+
} else {
|
|
1044
|
+
requestAdjust(ctx, state, positionDiff);
|
|
1027
1045
|
}
|
|
1028
1046
|
}
|
|
1029
1047
|
};
|
|
@@ -1173,6 +1191,7 @@ function updateAllPositions(ctx, state, dataChanged) {
|
|
|
1173
1191
|
if (dataChanged) {
|
|
1174
1192
|
indexByKey.clear();
|
|
1175
1193
|
idCache.clear();
|
|
1194
|
+
positions.clear();
|
|
1176
1195
|
}
|
|
1177
1196
|
const useAverageSize = !getEstimatedItemSize;
|
|
1178
1197
|
const itemType = "";
|
package/index.mjs
CHANGED
|
@@ -282,12 +282,10 @@ var PositionViewSticky = typedMemo(function PositionViewSticky2({
|
|
|
282
282
|
return /* @__PURE__ */ React3.createElement(Animated.View, { ref: refView, style: viewStyle, ...rest });
|
|
283
283
|
});
|
|
284
284
|
var PositionView3 = IsNewArchitecture ? PositionViewState : PositionViewAnimated;
|
|
285
|
-
|
|
286
|
-
// src/components/Separator.tsx
|
|
287
285
|
function Separator({ ItemSeparatorComponent, itemKey, leadingItem }) {
|
|
288
286
|
const [lastItemKeys] = useArr$(["lastItemKeys"]);
|
|
289
287
|
const isALastItem = lastItemKeys.includes(itemKey);
|
|
290
|
-
return isALastItem ? null : /* @__PURE__ */
|
|
288
|
+
return isALastItem ? null : /* @__PURE__ */ React3.createElement(ItemSeparatorComponent, { leadingItem });
|
|
291
289
|
}
|
|
292
290
|
var symbolFirst = Symbol();
|
|
293
291
|
function useInit(cb) {
|
|
@@ -968,41 +966,61 @@ function requestAdjust(ctx, state, positionDiff) {
|
|
|
968
966
|
// src/core/prepareMVCP.ts
|
|
969
967
|
function prepareMVCP(ctx, state, dataChanged) {
|
|
970
968
|
const {
|
|
969
|
+
idsInView,
|
|
971
970
|
positions,
|
|
972
971
|
scrollingTo,
|
|
973
972
|
props: { maintainVisibleContentPosition }
|
|
974
973
|
} = state;
|
|
975
974
|
let prevPosition;
|
|
976
975
|
let targetId;
|
|
977
|
-
|
|
976
|
+
const idsInViewWithPositions = [];
|
|
978
977
|
const scrollTarget = scrollingTo == null ? void 0 : scrollingTo.index;
|
|
979
978
|
if (maintainVisibleContentPosition) {
|
|
980
979
|
const indexByKey = state.indexByKey;
|
|
981
980
|
if (scrollTarget !== void 0) {
|
|
982
981
|
targetId = getId(state, scrollTarget);
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
982
|
+
} else if (idsInView.length > 0 && peek$(ctx, "containersDidLayout")) {
|
|
983
|
+
if (dataChanged) {
|
|
984
|
+
for (let i = 0; i < idsInView.length; i++) {
|
|
985
|
+
const id = idsInView[i];
|
|
986
|
+
const index = indexByKey.get(id);
|
|
987
|
+
if (index !== void 0) {
|
|
988
|
+
idsInViewWithPositions.push({ id, position: positions.get(id) });
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
} else {
|
|
992
|
+
targetId = state.idsInView.find((id) => indexByKey.get(id) !== void 0);
|
|
993
|
+
}
|
|
987
994
|
}
|
|
988
|
-
if (targetId !== void 0
|
|
995
|
+
if (targetId !== void 0) {
|
|
989
996
|
prevPosition = positions.get(targetId);
|
|
990
997
|
}
|
|
991
998
|
}
|
|
992
999
|
return () => {
|
|
1000
|
+
let positionDiff;
|
|
1001
|
+
if (targetId === void 0) {
|
|
1002
|
+
for (let i = 0; i < idsInViewWithPositions.length; i++) {
|
|
1003
|
+
const { id, position } = idsInViewWithPositions[i];
|
|
1004
|
+
const newPosition = positions.get(id);
|
|
1005
|
+
if (newPosition !== void 0) {
|
|
1006
|
+
positionDiff = newPosition - position;
|
|
1007
|
+
break;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
993
1011
|
if (targetId !== void 0 && prevPosition !== void 0) {
|
|
994
1012
|
const newPosition = positions.get(targetId);
|
|
995
1013
|
if (newPosition !== void 0) {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1014
|
+
positionDiff = newPosition - prevPosition;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
if (positionDiff !== void 0 && Math.abs(positionDiff) > 0.1) {
|
|
1018
|
+
if (Platform.OS === "android" && !IsNewArchitecture && dataChanged && state.scroll <= positionDiff) {
|
|
1019
|
+
scrollTo(state, {
|
|
1020
|
+
offset: state.scroll + positionDiff
|
|
1021
|
+
});
|
|
1022
|
+
} else {
|
|
1023
|
+
requestAdjust(ctx, state, positionDiff);
|
|
1006
1024
|
}
|
|
1007
1025
|
}
|
|
1008
1026
|
};
|
|
@@ -1152,6 +1170,7 @@ function updateAllPositions(ctx, state, dataChanged) {
|
|
|
1152
1170
|
if (dataChanged) {
|
|
1153
1171
|
indexByKey.clear();
|
|
1154
1172
|
idCache.clear();
|
|
1173
|
+
positions.clear();
|
|
1155
1174
|
}
|
|
1156
1175
|
const useAverageSize = !getEstimatedItemSize;
|
|
1157
1176
|
const itemType = "";
|
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.12",
|
|
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,
|