New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default JS Dispatcher for React Native is wrong #2843
Labels
Comments
Thanks for the detailed explanation! The PR is very welcome |
Legion2
added a commit
to Legion2/kotlinx.coroutines
that referenced
this issue
Jul 29, 2021
Wooow, when will this change be released!? |
Is there any current work around? |
you can create your own dispatcher based on the one in the fix and then use it explicitly when launching coroutines |
Already did. Just thought maybe there would be one which would require me not to state explicitly which dispatcher |
pablobaxter
pushed a commit
to pablobaxter/kotlinx.coroutines
that referenced
this issue
Sep 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As part of ecc68f1 the Default dispatcher for React Native was set to
NodeDispatcher
. However, there is noprocess.nextTick
in React Native environments. There is only a fakeprocess.env
object but nothing else. As a result the Default dispatcher does not work in React Native.So I tested the other dispatchers. In React Native environments the
SetTimeoutDispatcher
works well. If React Native is executed with a Debugger (Chrome) the JS code is executed in a Chrome worker. In this modeSetTimeoutDispatcher
andwindow.asCoroutineDispatcher()
can be used as dispatchers,NodeDispatcher
does not work.To resolve this issue,
createDefaultDispatcher
must be adapted, so it properly detects the fakeprocess
object without thenextTick
function.If needed I can provide a PR and test changes.
The text was updated successfully, but these errors were encountered: