Skip to content

Commit 8a048df

Browse files
committed
fix: fix bug with windowSize props
fix #71
1 parent f24ee1a commit 8a048df

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/hooks/useVisibleRanges.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ export function useVisibleRanges(options: {
1212
windowSize?: number;
1313
translation: Animated.SharedValue<number>;
1414
}): IVisibleRanges {
15-
const { total, viewSize, windowSize = 0, translation } = options;
15+
const {
16+
total = 0,
17+
viewSize,
18+
translation,
19+
windowSize: _windowSize = 0,
20+
} = options;
21+
22+
const windowSize = total <= _windowSize ? total : _windowSize;
1623

1724
const ranges = useDerivedValue(() => {
1825
const positiveCount = Math.round(windowSize / 2);

0 commit comments

Comments
 (0)