Skip to content

Commit aeaa56a

Browse files
authored
Merge pull request #95 from dohooo/fix/94
fix: fix wrong offset when out of bounds
2 parents 23e7555 + db27279 commit aeaa56a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ScrollViewGesture.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ const IScrollViewGesture: React.FC<Props> = (props) => {
202202
!infinite &&
203203
(translation.value > 0 || translation.value < -ctx.max)
204204
) {
205-
panTranslation = panTranslation * 0.5;
205+
const boundary = translation.value > 0 ? 0 : -ctx.max;
206+
const fixed = boundary - ctx.panOffset;
207+
const dynamic = panTranslation - fixed;
208+
translation.value = boundary + dynamic * 0.5;
209+
return;
206210
}
207211

208212
translation.value = ctx.panOffset + panTranslation;

0 commit comments

Comments
 (0)