@legendapp/list 1.0.0-beta.36 → 1.0.0-beta.37

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.
Files changed (3) hide show
  1. package/index.js +9 -5
  2. package/index.mjs +9 -5
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -1015,6 +1015,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1015
1015
  const setDidLayout = () => {
1016
1016
  var _a2;
1017
1017
  refState.current.queuedInitialLayout = true;
1018
+ checkAtBottom();
1018
1019
  if (initialScrollIndex) {
1019
1020
  const updatedOffset = calculateOffsetForIndex(initialScrollIndex);
1020
1021
  (_a2 = refState.current) == null ? void 0 : _a2.scrollAdjustHandler.setDisableAdjust(true);
@@ -1443,9 +1444,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1443
1444
  return true;
1444
1445
  }
1445
1446
  };
1446
- const checkThreshold = (distance, threshold, isReached, isBlockedByTimer, onReached, blockTimer) => {
1447
+ const checkThreshold = (distance, atThreshold, threshold, isReached, isBlockedByTimer, onReached, blockTimer) => {
1447
1448
  const distanceAbs = Math.abs(distance);
1448
- const isAtThreshold = distanceAbs < threshold;
1449
+ const isAtThreshold = atThreshold || distanceAbs < threshold;
1449
1450
  if (!isReached && !isBlockedByTimer) {
1450
1451
  if (isAtThreshold) {
1451
1452
  onReached == null ? void 0 : onReached(distance);
@@ -1466,14 +1467,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1466
1467
  if (!refState.current) {
1467
1468
  return;
1468
1469
  }
1469
- const { scrollLength, scroll, hasScrolled } = refState.current;
1470
+ const { queuedInitialLayout, scrollLength, scroll } = refState.current;
1470
1471
  const contentSize = getContentSize(ctx);
1471
- if (contentSize > 0 && hasScrolled) {
1472
+ if (contentSize > 0 && queuedInitialLayout) {
1472
1473
  const distanceFromEnd = contentSize - scroll - scrollLength;
1473
1474
  const distanceFromEndAbs = Math.abs(distanceFromEnd);
1474
- refState.current.isAtBottom = distanceFromEndAbs < scrollLength * maintainScrollAtEndThreshold;
1475
+ const isContentLess = contentSize < scrollLength;
1476
+ refState.current.isAtBottom = isContentLess || distanceFromEndAbs < scrollLength * maintainScrollAtEndThreshold;
1475
1477
  refState.current.isEndReached = checkThreshold(
1476
1478
  distanceFromEnd,
1479
+ isContentLess,
1477
1480
  onEndReachedThreshold * scrollLength,
1478
1481
  refState.current.isEndReached,
1479
1482
  refState.current.endReachedBlockedByTimer,
@@ -1497,6 +1500,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1497
1500
  refState.current.isAtTop = distanceFromTopAbs < 0;
1498
1501
  refState.current.isStartReached = checkThreshold(
1499
1502
  distanceFromTop,
1503
+ false,
1500
1504
  onStartReachedThreshold * scrollLength,
1501
1505
  refState.current.isStartReached,
1502
1506
  refState.current.startReachedBlockedByTimer,
package/index.mjs CHANGED
@@ -994,6 +994,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
994
994
  const setDidLayout = () => {
995
995
  var _a2;
996
996
  refState.current.queuedInitialLayout = true;
997
+ checkAtBottom();
997
998
  if (initialScrollIndex) {
998
999
  const updatedOffset = calculateOffsetForIndex(initialScrollIndex);
999
1000
  (_a2 = refState.current) == null ? void 0 : _a2.scrollAdjustHandler.setDisableAdjust(true);
@@ -1422,9 +1423,9 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1422
1423
  return true;
1423
1424
  }
1424
1425
  };
1425
- const checkThreshold = (distance, threshold, isReached, isBlockedByTimer, onReached, blockTimer) => {
1426
+ const checkThreshold = (distance, atThreshold, threshold, isReached, isBlockedByTimer, onReached, blockTimer) => {
1426
1427
  const distanceAbs = Math.abs(distance);
1427
- const isAtThreshold = distanceAbs < threshold;
1428
+ const isAtThreshold = atThreshold || distanceAbs < threshold;
1428
1429
  if (!isReached && !isBlockedByTimer) {
1429
1430
  if (isAtThreshold) {
1430
1431
  onReached == null ? void 0 : onReached(distance);
@@ -1445,14 +1446,16 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1445
1446
  if (!refState.current) {
1446
1447
  return;
1447
1448
  }
1448
- const { scrollLength, scroll, hasScrolled } = refState.current;
1449
+ const { queuedInitialLayout, scrollLength, scroll } = refState.current;
1449
1450
  const contentSize = getContentSize(ctx);
1450
- if (contentSize > 0 && hasScrolled) {
1451
+ if (contentSize > 0 && queuedInitialLayout) {
1451
1452
  const distanceFromEnd = contentSize - scroll - scrollLength;
1452
1453
  const distanceFromEndAbs = Math.abs(distanceFromEnd);
1453
- refState.current.isAtBottom = distanceFromEndAbs < scrollLength * maintainScrollAtEndThreshold;
1454
+ const isContentLess = contentSize < scrollLength;
1455
+ refState.current.isAtBottom = isContentLess || distanceFromEndAbs < scrollLength * maintainScrollAtEndThreshold;
1454
1456
  refState.current.isEndReached = checkThreshold(
1455
1457
  distanceFromEnd,
1458
+ isContentLess,
1456
1459
  onEndReachedThreshold * scrollLength,
1457
1460
  refState.current.isEndReached,
1458
1461
  refState.current.endReachedBlockedByTimer,
@@ -1476,6 +1479,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
1476
1479
  refState.current.isAtTop = distanceFromTopAbs < 0;
1477
1480
  refState.current.isStartReached = checkThreshold(
1478
1481
  distanceFromTop,
1482
+ false,
1479
1483
  onStartReachedThreshold * scrollLength,
1480
1484
  refState.current.isStartReached,
1481
1485
  refState.current.startReachedBlockedByTimer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/list",
3
- "version": "1.0.0-beta.36",
3
+ "version": "1.0.0-beta.37",
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,