react-native-threads
react-native-threads copied to clipboard
Doesn't work with realm
Hi! I'm trying a project with realm but I catch error "com.facebook.react.JavaScript (15): EXC_BAD_ACCESS (code=1, address=0x0)" after (Cmd + R), testing also did on android (real devices), it works without errors, but it does not start another thread.
Thanks!
Hi @IamRoman, I have no experience using Realm so unfortunately I am not sure what we could do to resolve this issue. I do not think this error is caused by react-native-threads
but is probably an error with Realm
Same issue here
Hi! Did anybody find a solution or workaround?
Hi there ! You are not alone using Realm and this package at the same time. For now, my project is targetting only Android and I have not crossed yet any problem on Android. We will soon target iOS so I guess we will have the same issue. I'll tell here if we find a solution...
OK, actually, it is not working with Android neither.
As soon as we start a new thread, Realm gets closed. I've created an issue about it there: https://github.com/realm/realm-js/issues/2117
any update? pls
Hi,
I found a workaround that makes these two libraries work together.
Firstly, starting of new thread for some reason kills realm, so I reinitialized realm whenever I used it.
Rather then exporting realm instance and using it in every file I just exported schema and reinitialized realm there.
It looks something like this
const realm = new Realm({ schema : schemas });
I initialized this variable before using any realm operation and it worked without crashing
Unfortunately this is still an issue. Any ideas for even a hacky fix?
I can use both of these libraries in my project. All you need to do is to use Realm in only one thread. For example I only use Realm in the worker thread so that my main thread doesn't know there is Realm, but you can communicate with postMessage and onmessage methods. Hope it helps.
[Edit] It works on Android, but in my test on iOS, it failes to bundle the thread. Loading stucks at 100%.