tao icon indicating copy to clipboard operation
tao copied to clipboard

iOS Scroll freezes entire Rust event loop

Open rapporian opened this issue 1 week ago • 2 comments

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.

Related

https://github.com/DioxusLabs/dioxus/issues/5091

rapporian avatar Dec 13 '25 09:12 rapporian

@FabianLars / @lucasfernog any chance you guys can take a look at this? It's a small fix for a pretty show-stopper issue for mobile dev (stalling futures, missing timers, etc)

jkelleyrtp avatar Dec 16 '25 06:12 jkelleyrtp

can/did you test #1163 yourself? Looking at winit's code and PRs it may not be that easy and if it is we may have a hard time upstreaming this into winit.

FabianLars avatar Dec 16 '25 12:12 FabianLars

Definately need your guys help w/ this ━ whatever the right path is, this PR (when validated) or another path.

As of right now, all interactive content freezes which is a non-starter to ship product w/ any kind of visual animations on iOS.

rapporian avatar Dec 19 '25 08:12 rapporian