Module call threading and payload shape
Prerequisites: 07-turbo-codegen, 08-expo-dsl
Thread hops for an async task
Mental model verified
Expo Function executes on the JS runtime thread. AsyncFunction normally dispatches native work away from JS and can use a specified queue. Platform UI APIs still require main. A TurboModule contract can expose sync or async methods, but its implementation determines blocking behavior.
[S09] [S12]Worked flow synthesis
For OCR, return a file URI or handle to native code, process off main, emit a small result and resolve the JS Promise. Transferring full frames through JS on every preview frame adds conversion and rendering pressure.
[S04] [S12] [S13]Engineering decision synthesis
State max payload, cancellation and timeout semantics in the public API. Profile call overhead, conversion, native SDK time and callback fan-out separately.
[S04] [S12]Failure mode and improvement synthesis
Moving CPU work into AsyncFunction but pinning it to main simply relocates jank. Choose the queue from the task and audit any UI hop.
[S12] [S15] [S17]Check yourself: What makes a synchronous function hazardous even with JSI?
It blocks its caller while native work runs; I/O, locks or expensive conversion can stall JS.