@legendapp/list 1.0.0-beta.35 → 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.
- package/index.js +17 -6
- package/index.mjs +17 -6
- package/package.json +1 -1
- package/reanimated.d.mts +5 -4
- package/reanimated.d.ts +5 -4
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
|
|
1470
|
+
const { queuedInitialLayout, scrollLength, scroll } = refState.current;
|
|
1470
1471
|
const contentSize = getContentSize(ctx);
|
|
1471
|
-
if (contentSize > 0 &&
|
|
1472
|
+
if (contentSize > 0 && queuedInitialLayout) {
|
|
1472
1473
|
const distanceFromEnd = contentSize - scroll - scrollLength;
|
|
1473
1474
|
const distanceFromEndAbs = Math.abs(distanceFromEnd);
|
|
1474
|
-
|
|
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,
|
|
@@ -1635,7 +1639,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1635
1639
|
const initalizeStateVars = () => {
|
|
1636
1640
|
set$(ctx, "lastItemKeys", memoizedLastItemKeys);
|
|
1637
1641
|
set$(ctx, "numColumns", numColumnsProp);
|
|
1638
|
-
|
|
1642
|
+
if (maintainVisibleContentPosition) {
|
|
1643
|
+
const prevPaddingTop = peek$(ctx, "stylePaddingTop");
|
|
1644
|
+
const paddingDiff = stylePaddingTop - prevPaddingTop;
|
|
1645
|
+
if (paddingDiff) {
|
|
1646
|
+
scrollTo(refState.current.scroll + paddingDiff, false);
|
|
1647
|
+
}
|
|
1648
|
+
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
1649
|
+
}
|
|
1639
1650
|
};
|
|
1640
1651
|
if (isFirst) {
|
|
1641
1652
|
initalizeStateVars();
|
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
|
|
1449
|
+
const { queuedInitialLayout, scrollLength, scroll } = refState.current;
|
|
1449
1450
|
const contentSize = getContentSize(ctx);
|
|
1450
|
-
if (contentSize > 0 &&
|
|
1451
|
+
if (contentSize > 0 && queuedInitialLayout) {
|
|
1451
1452
|
const distanceFromEnd = contentSize - scroll - scrollLength;
|
|
1452
1453
|
const distanceFromEndAbs = Math.abs(distanceFromEnd);
|
|
1453
|
-
|
|
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,
|
|
@@ -1614,7 +1618,14 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded
|
|
|
1614
1618
|
const initalizeStateVars = () => {
|
|
1615
1619
|
set$(ctx, "lastItemKeys", memoizedLastItemKeys);
|
|
1616
1620
|
set$(ctx, "numColumns", numColumnsProp);
|
|
1617
|
-
|
|
1621
|
+
if (maintainVisibleContentPosition) {
|
|
1622
|
+
const prevPaddingTop = peek$(ctx, "stylePaddingTop");
|
|
1623
|
+
const paddingDiff = stylePaddingTop - prevPaddingTop;
|
|
1624
|
+
if (paddingDiff) {
|
|
1625
|
+
scrollTo(refState.current.scroll + paddingDiff, false);
|
|
1626
|
+
}
|
|
1627
|
+
set$(ctx, "stylePaddingTop", stylePaddingTop);
|
|
1628
|
+
}
|
|
1618
1629
|
};
|
|
1619
1630
|
if (isFirst) {
|
|
1620
1631
|
initalizeStateVars();
|
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.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,
|
package/reanimated.d.mts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
|
|
2
2
|
import React__default, { ComponentProps } from 'react';
|
|
3
3
|
import Animated from 'react-native-reanimated';
|
|
4
4
|
|
|
5
5
|
type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "ItemSeparatorComponent";
|
|
6
6
|
type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;
|
|
7
|
-
interface
|
|
7
|
+
interface AnimatedLegendListPropsBase<ItemT> extends Omit<PropsBase<ItemT>, KeysToOmit> {
|
|
8
8
|
refScrollView?: React__default.Ref<Animated.ScrollView>;
|
|
9
9
|
}
|
|
10
10
|
type OtherAnimatedLegendListProps<ItemT> = Pick<PropsBase<ItemT>, KeysToOmit>;
|
|
11
|
-
type
|
|
11
|
+
type AnimatedLegendListProps<ItemT> = Omit<AnimatedLegendListPropsBase<ItemT>, "refLegendList"> & OtherAnimatedLegendListProps<ItemT>;
|
|
12
|
+
type AnimatedLegendListDefinition = <ItemT>(props: Omit<AnimatedLegendListPropsBase<ItemT>, "refLegendList"> & OtherAnimatedLegendListProps<ItemT> & {
|
|
12
13
|
ref?: React__default.Ref<LegendListRef>;
|
|
13
14
|
}) => React__default.ReactElement | null;
|
|
14
15
|
declare const AnimatedLegendList: AnimatedLegendListDefinition;
|
|
15
16
|
|
|
16
|
-
export { AnimatedLegendList };
|
|
17
|
+
export { AnimatedLegendList, type AnimatedLegendListProps, type AnimatedLegendListPropsBase };
|
package/reanimated.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LegendListPropsBase, LegendListRef } from '@legendapp/list';
|
|
2
2
|
import React__default, { ComponentProps } from 'react';
|
|
3
3
|
import Animated from 'react-native-reanimated';
|
|
4
4
|
|
|
5
5
|
type KeysToOmit = "getEstimatedItemSize" | "keyExtractor" | "animatedProps" | "renderItem" | "onItemSizeChanged" | "ItemSeparatorComponent";
|
|
6
6
|
type PropsBase<ItemT> = LegendListPropsBase<ItemT, ComponentProps<typeof Animated.ScrollView>>;
|
|
7
|
-
interface
|
|
7
|
+
interface AnimatedLegendListPropsBase<ItemT> extends Omit<PropsBase<ItemT>, KeysToOmit> {
|
|
8
8
|
refScrollView?: React__default.Ref<Animated.ScrollView>;
|
|
9
9
|
}
|
|
10
10
|
type OtherAnimatedLegendListProps<ItemT> = Pick<PropsBase<ItemT>, KeysToOmit>;
|
|
11
|
-
type
|
|
11
|
+
type AnimatedLegendListProps<ItemT> = Omit<AnimatedLegendListPropsBase<ItemT>, "refLegendList"> & OtherAnimatedLegendListProps<ItemT>;
|
|
12
|
+
type AnimatedLegendListDefinition = <ItemT>(props: Omit<AnimatedLegendListPropsBase<ItemT>, "refLegendList"> & OtherAnimatedLegendListProps<ItemT> & {
|
|
12
13
|
ref?: React__default.Ref<LegendListRef>;
|
|
13
14
|
}) => React__default.ReactElement | null;
|
|
14
15
|
declare const AnimatedLegendList: AnimatedLegendListDefinition;
|
|
15
16
|
|
|
16
|
-
export { AnimatedLegendList };
|
|
17
|
+
export { AnimatedLegendList, type AnimatedLegendListProps, type AnimatedLegendListPropsBase };
|