originally, we pump v8 message loop by requestIdleCallback provided by react-native. this will block detox testing because detox detects the app idle state by the internal queue shared with the requestIdleCallback. then detox testing will hang.
How
use the android Looper.getMainLooper().getQueue().addIdleHandler() to listen when main runloop is idle and call the c++ code through the native module and runtime executor.
Why
originally, we pump v8 message loop by
requestIdleCallback
provided by react-native. this will block detox testing because detox detects the app idle state by the internal queue shared with therequestIdleCallback
. then detox testing will hang.How
use the android
Looper.getMainLooper().getQueue().addIdleHandler()
to listen when main runloop is idle and call the c++ code through the native module and runtime executor.Test Plan