`@effect/ui-native` (Effect-TS/ui): `kit/Pan` fires stale non-zero `vx`/`vy` on `onEnd` after user pauses still before lifting
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react-native, typescript
Hướng nghiên cứu
Đọc packages/ui-native/src/kit/Pan.ts quanh các dòng 283–314 và bài kiểm thử tái hiện được liên kết, 05-pan-stale-velocity-on-end-after-pause/repro.test.ts. Theo dõi cách các sự kiện di chuyển cập nhật vận tốc và cách sự kiện kết thúc báo cáo vận tốc; tái hiện trường hợp tạm dừng 500 ms. Hoàn tất khi onEnd báo cáo vận tốc gần bằng không sau khoảng tạm dừng, đồng thời vẫn giữ vận tốc như mong đợi khi thả tay ngay sau khi di chuyển.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
partially generated with help of my ai friend - neon 4.4
Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native
What version of Effect is running?
effect:4.1.7@effect/ui&@effect/ui-native:Effect-TS/uimainat77391ee50ae3d3175d670facbf675e9a819ba6a6react-native:0.88.1
What steps can reproduce the bug?
- Clone the minimal reproduction repository:
git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git cd effectui-native-error-reproductions pnpm install pnpm vitest run 05-pan-stale-velocity-on-end-after-pause - Attach
Pan.on({ axis: "x", onMove, onEnd })to a draggable view (such as a swipeable row or drawer):topTouchStartat(x: 100, t: 1000)topTouchMovepast slop to(x: 120, t: 1016)- Fast
topTouchMoveto(x: 140, t: 1032)(vx = 1.25 px/ms) - User holds their finger completely stationary for 500 ms (no further move events)
topTouchEndat(x: 140, t: 1532)
See 05-pan-stale-velocity-on-end-after-pause/repro.test.ts.
What is the expected behavior?
After dragging and then holding still for 500 ms before releasing, onEnd should report near-zero velocity (Math.abs(vx) < 0.05) so snap-threshold and Animation.spring({ velocity }) handoff logic treats the release as a stationary release rather than a high-speed flick.
What do you see instead?
packages/ui-native/src/kit/Pan.ts:283-314 computes g.vx and g.vy exclusively during phase === 1 (topTouchMove) using dt = now - g.t, and on phase === 2 (topTouchEnd, lines 307–314) fires end with the unchanged g.vx and g.vy without checking elapsed time since the last move (t).
As a result, onEnd still receives the stale vx = 1.25 px/ms from 500 ms earlier even though the finger stopped moving half a second before lifting.
Additional information
Possible fix in packages/ui-native/src/kit/Pan.ts: on phase === 2, inspect the elapsed time now - t (using touch.timestamp ?? Date.now()). If the elapsed time since the last move exceeds a stillness window (e.g., > 60–100 ms), zero out g.vx and g.vy (or recompute/decay velocity using the total interval up to release).
- Ngôn ngữ chính
- TypeScript
- Star
- 16.7k
- Fork
- 808
- Merge trung bình
- 21 giờ 22 phút
- Pull request đã merge (30 ngày)
- 486
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Effect-TS/effect
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsCó thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11097 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Có thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11096 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): `internal/focus.ts` `trackKeyboard` ignores `keyboardWillChangeFrame` / `keyboardDidChangeFrame` dismissalCó thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11095 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Effect-TS/effect
Issue tương tự
-
check:failed streams:edit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
iptv-org/iptv#60585 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsCó thể đã có người làm @Piyush4801 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jaegertracing/jaeger-ui#4865 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày