@legendapp/list 1.0.0-beta.15 → 1.0.0-beta.16
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 +18 -14
- package/index.mjs +18 -14
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -169,7 +169,7 @@ var DebugView = React6.memo(function DebugView2({ state }) {
|
|
|
169
169
|
useInterval(() => {
|
|
170
170
|
forceUpdate();
|
|
171
171
|
}, 100);
|
|
172
|
-
return /* @__PURE__ */
|
|
172
|
+
return /* @__PURE__ */ React6__namespace.createElement(
|
|
173
173
|
reactNative.View,
|
|
174
174
|
{
|
|
175
175
|
style: {
|
|
@@ -182,8 +182,8 @@ var DebugView = React6.memo(function DebugView2({ state }) {
|
|
|
182
182
|
backgroundColor: "#FFFFFFCC"
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ React6__namespace.createElement(reactNative.Text, null, "PaddingTop: ", paddingTop),
|
|
186
|
+
/* @__PURE__ */ React6__namespace.createElement(reactNative.Text, null, "At end: ", String(state.isAtBottom))
|
|
187
187
|
);
|
|
188
188
|
});
|
|
189
189
|
function useInterval(callback, delay) {
|
|
@@ -262,9 +262,17 @@ var Container = ({
|
|
|
262
262
|
const { index, renderedItem } = renderedItemInfo || {};
|
|
263
263
|
const onLayout = (event) => {
|
|
264
264
|
if (itemKey !== void 0) {
|
|
265
|
-
const
|
|
265
|
+
const layout = event.nativeEvent.layout;
|
|
266
|
+
const size = Math.floor(layout[horizontal ? "width" : "height"] * 8) / 8;
|
|
266
267
|
if (size === 0) {
|
|
267
|
-
|
|
268
|
+
if (layout.y !== POSITION_OUT_OF_VIEW && layout.y !== POSITION_OUT_OF_VIEW) {
|
|
269
|
+
console.log(
|
|
270
|
+
"[WARN] Container 0 height reported, possible bug in LegendList",
|
|
271
|
+
id,
|
|
272
|
+
itemKey,
|
|
273
|
+
event.nativeEvent
|
|
274
|
+
);
|
|
275
|
+
}
|
|
268
276
|
return;
|
|
269
277
|
}
|
|
270
278
|
updateItemSize(id, itemKey, size);
|
|
@@ -1254,9 +1262,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1254
1262
|
if (!refState.current) {
|
|
1255
1263
|
return;
|
|
1256
1264
|
}
|
|
1257
|
-
const { scrollLength, scroll, totalSize } = refState.current;
|
|
1258
|
-
if (totalSize > 0) {
|
|
1259
|
-
const distanceFromEnd =
|
|
1265
|
+
const { scrollLength, scroll, totalSize, hasScrolled } = refState.current;
|
|
1266
|
+
if (totalSize > 0 && hasScrolled) {
|
|
1267
|
+
const distanceFromEnd = Math.abs(
|
|
1268
|
+
totalSize - scroll - scrollLength + (peek$(ctx, "paddingTop") || 0)
|
|
1269
|
+
);
|
|
1260
1270
|
if (refState.current) {
|
|
1261
1271
|
refState.current.isAtBottom = distanceFromEnd < scrollLength * maintainScrollAtEndThreshold;
|
|
1262
1272
|
}
|
|
@@ -1411,12 +1421,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1411
1421
|
refState.current.positions.clear();
|
|
1412
1422
|
}
|
|
1413
1423
|
refState.current.data = dataProp;
|
|
1414
|
-
const indexByKey = /* @__PURE__ */ new Map();
|
|
1415
|
-
for (let i = 0; i < dataProp.length; i++) {
|
|
1416
|
-
const key = getId(i);
|
|
1417
|
-
indexByKey.set(key, i);
|
|
1418
|
-
}
|
|
1419
|
-
refState.current.indexByKey = indexByKey;
|
|
1420
1424
|
calcTotalSizesAndPositions({ forgetPositions: false });
|
|
1421
1425
|
}
|
|
1422
1426
|
React6.useEffect(() => {
|
package/index.mjs
CHANGED
|
@@ -148,7 +148,7 @@ var DebugView = memo(function DebugView2({ state }) {
|
|
|
148
148
|
useInterval(() => {
|
|
149
149
|
forceUpdate();
|
|
150
150
|
}, 100);
|
|
151
|
-
return /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ React6.createElement(
|
|
152
152
|
View,
|
|
153
153
|
{
|
|
154
154
|
style: {
|
|
@@ -161,8 +161,8 @@ var DebugView = memo(function DebugView2({ state }) {
|
|
|
161
161
|
backgroundColor: "#FFFFFFCC"
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ React6.createElement(Text, null, "PaddingTop: ", paddingTop),
|
|
165
|
+
/* @__PURE__ */ React6.createElement(Text, null, "At end: ", String(state.isAtBottom))
|
|
166
166
|
);
|
|
167
167
|
});
|
|
168
168
|
function useInterval(callback, delay) {
|
|
@@ -241,9 +241,17 @@ var Container = ({
|
|
|
241
241
|
const { index, renderedItem } = renderedItemInfo || {};
|
|
242
242
|
const onLayout = (event) => {
|
|
243
243
|
if (itemKey !== void 0) {
|
|
244
|
-
const
|
|
244
|
+
const layout = event.nativeEvent.layout;
|
|
245
|
+
const size = Math.floor(layout[horizontal ? "width" : "height"] * 8) / 8;
|
|
245
246
|
if (size === 0) {
|
|
246
|
-
|
|
247
|
+
if (layout.y !== POSITION_OUT_OF_VIEW && layout.y !== POSITION_OUT_OF_VIEW) {
|
|
248
|
+
console.log(
|
|
249
|
+
"[WARN] Container 0 height reported, possible bug in LegendList",
|
|
250
|
+
id,
|
|
251
|
+
itemKey,
|
|
252
|
+
event.nativeEvent
|
|
253
|
+
);
|
|
254
|
+
}
|
|
247
255
|
return;
|
|
248
256
|
}
|
|
249
257
|
updateItemSize(id, itemKey, size);
|
|
@@ -1233,9 +1241,11 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1233
1241
|
if (!refState.current) {
|
|
1234
1242
|
return;
|
|
1235
1243
|
}
|
|
1236
|
-
const { scrollLength, scroll, totalSize } = refState.current;
|
|
1237
|
-
if (totalSize > 0) {
|
|
1238
|
-
const distanceFromEnd =
|
|
1244
|
+
const { scrollLength, scroll, totalSize, hasScrolled } = refState.current;
|
|
1245
|
+
if (totalSize > 0 && hasScrolled) {
|
|
1246
|
+
const distanceFromEnd = Math.abs(
|
|
1247
|
+
totalSize - scroll - scrollLength + (peek$(ctx, "paddingTop") || 0)
|
|
1248
|
+
);
|
|
1239
1249
|
if (refState.current) {
|
|
1240
1250
|
refState.current.isAtBottom = distanceFromEnd < scrollLength * maintainScrollAtEndThreshold;
|
|
1241
1251
|
}
|
|
@@ -1390,12 +1400,6 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1390
1400
|
refState.current.positions.clear();
|
|
1391
1401
|
}
|
|
1392
1402
|
refState.current.data = dataProp;
|
|
1393
|
-
const indexByKey = /* @__PURE__ */ new Map();
|
|
1394
|
-
for (let i = 0; i < dataProp.length; i++) {
|
|
1395
|
-
const key = getId(i);
|
|
1396
|
-
indexByKey.set(key, i);
|
|
1397
|
-
}
|
|
1398
|
-
refState.current.indexByKey = indexByKey;
|
|
1399
1403
|
calcTotalSizesAndPositions({ forgetPositions: false });
|
|
1400
1404
|
}
|
|
1401
1405
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/list",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.16",
|
|
4
4
|
"description": "Legend List aims to be a drop-in replacement for FlatList with much better performance and supporting dynamically sized items.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"private": false,
|