ps99-api 2.6.4 → 2.6.5
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.
|
@@ -22,7 +22,11 @@ export const FixedSizeList = ({ children, itemCount, itemSize, height, width, on
|
|
|
22
22
|
<div
|
|
23
23
|
ref={ref}
|
|
24
24
|
style={{ height, width, overflow: "auto", position: 'relative' }}
|
|
25
|
-
onScroll={(e) => onScroll && onScroll({
|
|
25
|
+
onScroll={(e) => onScroll && onScroll({
|
|
26
|
+
scrollOffset: e.currentTarget.scrollTop,
|
|
27
|
+
scrollHeight: e.currentTarget.scrollHeight,
|
|
28
|
+
clientHeight: e.currentTarget.clientHeight
|
|
29
|
+
})}
|
|
26
30
|
>
|
|
27
31
|
{items}
|
|
28
32
|
{bottomPadding > 0 && <div style={{ height: bottomPadding }} />}
|
|
@@ -64,7 +68,11 @@ export const FixedSizeGrid = ({ children, columnCount, rowCount, columnWidth, ro
|
|
|
64
68
|
<div
|
|
65
69
|
ref={ref}
|
|
66
70
|
style={{ height, width, overflowY: "auto", overflowX: "hidden", position: 'relative', ...style }}
|
|
67
|
-
onScroll={(e) => onScroll && onScroll({
|
|
71
|
+
onScroll={(e) => onScroll && onScroll({
|
|
72
|
+
scrollTop: e.currentTarget.scrollTop,
|
|
73
|
+
scrollHeight: e.currentTarget.scrollHeight,
|
|
74
|
+
clientHeight: e.currentTarget.clientHeight
|
|
75
|
+
})}
|
|
68
76
|
>
|
|
69
77
|
<div style={{ height: rowCount * rowHeight + bottomPadding, width: columnWidth * columnCount }}>
|
|
70
78
|
{items}
|
|
@@ -16,7 +16,7 @@ export const useCollapsibleHeader = (options: UseCollapsibleHeaderOptions = {})
|
|
|
16
16
|
const lastScrollTop = useRef(0);
|
|
17
17
|
const scrollRef = useRef<number>(0);
|
|
18
18
|
|
|
19
|
-
const handleScroll = ({ scrollOffset, scrollTop }: { scrollOffset?: number, scrollTop?: number }) => {
|
|
19
|
+
const handleScroll = ({ scrollOffset, scrollTop, scrollHeight, clientHeight }: { scrollOffset?: number, scrollTop?: number, scrollHeight?: number, clientHeight?: number }) => {
|
|
20
20
|
if (disabled) {
|
|
21
21
|
setShowHeader(true);
|
|
22
22
|
return;
|
|
@@ -25,6 +25,14 @@ export const useCollapsibleHeader = (options: UseCollapsibleHeaderOptions = {})
|
|
|
25
25
|
const currentScrollTop = scrollTop ?? scrollOffset ?? 0;
|
|
26
26
|
const scrollDelta = currentScrollTop - lastScrollTop.current;
|
|
27
27
|
|
|
28
|
+
// Bounce Protection: Detect if we are near the bottom
|
|
29
|
+
// If we are at the bottom, a "scroll up" might be a bounce.
|
|
30
|
+
let isNearBottom = false;
|
|
31
|
+
if (scrollHeight && clientHeight) {
|
|
32
|
+
// Buffer of 100px to be safe
|
|
33
|
+
isNearBottom = (currentScrollTop + clientHeight) >= (scrollHeight - 100);
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
// Threshold to prevent jitter
|
|
29
37
|
if (Math.abs(scrollDelta) > threshold) {
|
|
30
38
|
if (scrollDelta > 0 && currentScrollTop > triggerStart) {
|
|
@@ -32,7 +40,10 @@ export const useCollapsibleHeader = (options: UseCollapsibleHeaderOptions = {})
|
|
|
32
40
|
setShowHeader(false);
|
|
33
41
|
} else if (scrollDelta < 0) {
|
|
34
42
|
// Scrolling Up
|
|
35
|
-
|
|
43
|
+
// ONLY show header if we are NOT at the very bottom (prevent bounce triggering it)
|
|
44
|
+
if (!isNearBottom) {
|
|
45
|
+
setShowHeader(true);
|
|
46
|
+
}
|
|
36
47
|
}
|
|
37
48
|
}
|
|
38
49
|
lastScrollTop.current = currentScrollTop;
|