@legendapp/list 0.5.2 → 0.5.4
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 +7 -5
- package/index.mjs +7 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -541,7 +541,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
541
541
|
pendingAdjust: 0,
|
|
542
542
|
animFrameLayout: null,
|
|
543
543
|
animFrameTotalSize: null,
|
|
544
|
-
isStartReached:
|
|
544
|
+
isStartReached: true,
|
|
545
545
|
isEndReached: false,
|
|
546
546
|
isAtBottom: false,
|
|
547
547
|
isAtTop: false,
|
|
@@ -579,7 +579,7 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
579
579
|
const addTotalSize = React7.useCallback((key, add, set) => {
|
|
580
580
|
const state = refState.current;
|
|
581
581
|
const index = key === null ? 0 : state.indexByKey.get(key);
|
|
582
|
-
const isAbove = index < (state.startNoBuffer || 0);
|
|
582
|
+
const isAbove = key !== null && index < (state.startNoBuffer || 0);
|
|
583
583
|
const prev = state.totalSize;
|
|
584
584
|
if (set) {
|
|
585
585
|
state.totalSize = add;
|
|
@@ -802,15 +802,17 @@ var LegendListInner = React7.forwardRef(function LegendListInner2(props, forward
|
|
|
802
802
|
return;
|
|
803
803
|
}
|
|
804
804
|
const { scrollLength, scroll } = refState.current;
|
|
805
|
-
|
|
805
|
+
const scrollAdjust = peek$(ctx, "scrollAdjust") || 0;
|
|
806
|
+
const distanceFromTop = scroll - scrollAdjust;
|
|
807
|
+
refState.current.isAtTop = distanceFromTop < 0;
|
|
806
808
|
if (onStartReached) {
|
|
807
809
|
if (!refState.current.isStartReached) {
|
|
808
|
-
if (
|
|
810
|
+
if (distanceFromTop < onStartReachedThreshold * scrollLength) {
|
|
809
811
|
refState.current.isStartReached = true;
|
|
810
812
|
onStartReached({ distanceFromStart: scroll });
|
|
811
813
|
}
|
|
812
814
|
} else {
|
|
813
|
-
if (
|
|
815
|
+
if (distanceFromTop >= onStartReachedThreshold * scrollLength) {
|
|
814
816
|
refState.current.isStartReached = false;
|
|
815
817
|
}
|
|
816
818
|
}
|
package/index.mjs
CHANGED
|
@@ -520,7 +520,7 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
520
520
|
pendingAdjust: 0,
|
|
521
521
|
animFrameLayout: null,
|
|
522
522
|
animFrameTotalSize: null,
|
|
523
|
-
isStartReached:
|
|
523
|
+
isStartReached: true,
|
|
524
524
|
isEndReached: false,
|
|
525
525
|
isAtBottom: false,
|
|
526
526
|
isAtTop: false,
|
|
@@ -558,7 +558,7 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
558
558
|
const addTotalSize = useCallback((key, add, set) => {
|
|
559
559
|
const state = refState.current;
|
|
560
560
|
const index = key === null ? 0 : state.indexByKey.get(key);
|
|
561
|
-
const isAbove = index < (state.startNoBuffer || 0);
|
|
561
|
+
const isAbove = key !== null && index < (state.startNoBuffer || 0);
|
|
562
562
|
const prev = state.totalSize;
|
|
563
563
|
if (set) {
|
|
564
564
|
state.totalSize = add;
|
|
@@ -781,15 +781,17 @@ var LegendListInner = forwardRef(function LegendListInner2(props, forwardedRef)
|
|
|
781
781
|
return;
|
|
782
782
|
}
|
|
783
783
|
const { scrollLength, scroll } = refState.current;
|
|
784
|
-
|
|
784
|
+
const scrollAdjust = peek$(ctx, "scrollAdjust") || 0;
|
|
785
|
+
const distanceFromTop = scroll - scrollAdjust;
|
|
786
|
+
refState.current.isAtTop = distanceFromTop < 0;
|
|
785
787
|
if (onStartReached) {
|
|
786
788
|
if (!refState.current.isStartReached) {
|
|
787
|
-
if (
|
|
789
|
+
if (distanceFromTop < onStartReachedThreshold * scrollLength) {
|
|
788
790
|
refState.current.isStartReached = true;
|
|
789
791
|
onStartReached({ distanceFromStart: scroll });
|
|
790
792
|
}
|
|
791
793
|
} else {
|
|
792
|
-
if (
|
|
794
|
+
if (distanceFromTop >= onStartReachedThreshold * scrollLength) {
|
|
793
795
|
refState.current.isStartReached = false;
|
|
794
796
|
}
|
|
795
797
|
}
|