-
-
Notifications
You must be signed in to change notification settings - Fork 271
Description
iOS Scroll freezes entire Rust event loop
Problem
On iOS, all EventLoopProxy events are blocked while the user is scrolling. Events queue up and deliver only after scrolling stops.
This breaks every Tao-based iOS app that needs real-time updates during scroll.
Affected (anything using EventLoopProxy to reach the main thread):
- Signal/state updates
- Async task completions
- Cross-thread UI communication
The Rust code runs, but the main thread never receives events until scroll stops.
Screen Recording of Issue
https://github.com/rapporian/ios-scroll-blocks-rust/raw/refs/heads/main/ScreenRecording.mp4
(Red dot = Rust, Green dot = JavaScript. Watch the red dot freeze during scroll while green continues.)
Reproduction
Repo: https://github.com/rapporian/ios-scroll-blocks-rust
Scroll the page. Watch the Rust-driven animation freeze while JavaScript requestAnimationFrame continues.
Root Cause
iOS run loop modes:
| Mode | When Active | DefaultMode Observers |
CommonModes Observers |
|---|---|---|---|
kCFRunLoopDefaultMode |
Normal | ✅ Fire | ✅ Fire |
UITrackingRunLoopMode |
Scrolling | ❌ Don't fire | ✅ Fire |
The run loop observers are registered for kCFRunLoopDefaultMode only. During scroll, iOS switches to UITrackingRunLoopMode — observers aren't registered for that mode, so they don't fire and events don't get processed.