-
Notifications
You must be signed in to change notification settings - Fork 584
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
Realm + Reanimated v2 w/ JSC causes Realm to not work #3837
Comments
Oh, and I assume the conflict happens because of the low-level way both modules bind themselves into the JSC? |
Here is the android crash report for the above issue
|
Thank you for cross-posting. We will have to investigate it further to understand the interaction between JavaScriptCore and the two libraries is. |
I have the same issue, downgrading to Reanimated v1 works for me. |
Oh! Yes, v1 works here too. It's only an issue with v2 (which we're trying to upgrade to for the new API). |
The problem is hermes. Reanimated v2 needs enableHermes: true. However realm is not compatible with hermes yet. |
@wanderson-ra If you read the opening post you'll see that JSC is supported since Reanimated 2.2.0 |
Hi @kneth, any news on this one yet? We're starting on the implementation of something which would be a lot simpler in reanimated v2 due to the new API but we're having to stick to v1 for now due to this conflict with Realm. FYI, I've retested with the latest versions of both projects (Realm 10.6.1 and Reanimated 2.2.0) but, unsurprisingly, it still happens. Interestingly the behaviour seems somewhat variable? Possibly a race between the two modules hooking into the JSC? If I use the minimal repro off of the reanimated ticket (https://github.com/limpbrains/reanimated-2-playground) it doesn't always crash when I hit the 'write to realm' button. Sometimes it crashes the app (seems more likely if I tap the button as soon as it's available, rather than waiting) but when it does 'work' I've seen varying output from the console.log statement:
Also, if there's anything extra we can provide to help (tombstones, etc) let us know. |
Same having this problem with realm + reanimated v2 which is a major problem as reanimated v2 looks like a requirement for some camera packages i need |
Same here. iOS works. Android writes result in empty objects. r.write(() => {
var anObject = myRealm.create('SomeModel', {
id: 1,
// other variables
})
console.log(anObject, anObject.id) // => {} undefined
}) Hermes is disabled of course.
Downgrading |
Same problem, we have to use reanimated v2 to for other dependencies, and it's urgent for us to find a solution to use both together. Looking forward to hear more |
this problem doesn't seem to be solved. |
Anyone who is eager to have this issue fixed, please try the latest betas of 10.20 with hermes support. In my experiments, it was working out of the box |
Hi @somebody32 , I still crash ios app on testflight |
@hungnv2010 then please attach some reproducible example, because the original issue was about data loss or crash on reload. Looks like you have something different here |
@hungnv2010 we're not aware of any crashes happening with Realm JS 10.20.0-beta.1 and the Reanimated library. |
@somebody32 I don't know if the problem arises from the realm or from react-native-reanimated. I have upgraded from 5.0.3 to 10.20.0-beta.1 and react-native-reanimated from v1 to v2 with Hermes enabled, debug still runs normally testflight then crash app. both 5.0.3 and 10.20.0-beta.1 crashed a few times when open app. |
Thank you so much, I was having issues for days and this fixed it |
Our Hermes release branch currently solves all issues related to Reanimated v2. Please use this branch if your project needs To quickly switch to this release branch, use the following command:
We are actively working on this branch, so any input would be appreciated 😃 |
@takameyer does this include when running them together with the JSC rather than Hermes? |
@liamjones Yes, you do not need to enable Hermes for this to work. |
Awesome, thanks! |
Trying to debug issue where debugger crashes on restart: software-mansion/react-native-reanimated#1424 realm/realm-js#3837
I'm not sure upgrading to |
I don't think there's any other workarounds that I am aware of, although perhaps someone from the community has some ideas. We're hoping we can solve the performance regressions soon. Sorry, I realise it's not ideal, but since realising the impact we are treating this as a high priority. |
No worries, I know you're working hard on this. I want the JSI implementation to work because when it does it will be 🔥 Sounds like you're close! |
I think I'm having the same problem my app keeps crashing when i use realm in drawer or tab navigation but works fine on stack. plzz tell me how to sort this issue. I'm using react native reanimated v2 |
I'm using realm@hermes as @takameyer suggested and it is working, there are still some random crashes but it is better than without it. |
This issu has not been solved for me. "react": "18.0.0", |
@AzadMohammadi-z Please take a look at https://github.com/realm/realm-js/blob/v11/COMPATIBILITY.md to find a compatible version. Best is to upgrade to latest version but it will also include upgrading React Native. |
Thank you so much, My problem is solved |
will this also happen in a project that has reanimated v2 and also realm but as native component of a native module? we are using a native player component that internally uses realm for managing offline download support and having same sort of issues |
@OrenMe if you're using one of the Realm native modules only (e.g. realm-java, realm-cocoa, etc rather than realm-js) I don't think you should run into this issue. It's specifically a conflict between how realm-js and reanimated v2 both want to bind themselves to the JavaScriptCore and do so in a way that there's a conflict between them. The pure native modules won't know about the JSC and won't be attempting to do anything with it. |
thanks @liamjones |
Hey, bumping this up again. Here's both of my packages: "react-native-reanimated": "^3.6.1", I had realm 12.6.1 but read somewhere that the rc versions had this fixed. Critical loss in application functionality. Hoping this gets fixed soon. |
This is very unlikely, since |
I'm locking the issue for further comments as we believe this has been resolved. If you can reproduce an issue with Realm + Reanimated, please help us pin point any potential issue by opening a new issue with the templated filled out and ideally a minimal reproduction. Thanks! |
Goals
Use react-native-reanimated v2 alongside Realm. Reanimated v2 used to require Hermes (and I'm aware RealmJS's Hermes support is still WIP) but v2.2.0+ have added JSC support as well [1].
Expected Results
The two to live together happily.
Actual Results
In our instance - the app runs fine on iOS but on Android we can save stuff to Realm but reloading it results in objects being
undefined
. Others have reported app crashes with minimal repros to the renimated project already [2] but I thought I'd report it here too incase it can be fixed from the Realm side.Steps to Reproduce
Install Realm + react-native-reanimated v2.2.0+ in the same app without Hermes - attempt to use Realm on Android.
Code Sample
See minimal repro on this ticket: software-mansion/react-native-reanimated#2028
Version of Realm and Tooling
The text was updated successfully, but these errors were encountered: