React Native app crash instantly after add Realm + React Navigation (screens/gesture handler)

900 Views Asked by At

I'm working on a fresh react native project (CLI). So I started adding and configuring React navigation (Stack and Drawer). Also i added React-native gesture handler and react native screens (because both are dependencies to react navigation). Until here, everything was fine.

After this, I added MongoDB Realm (npm install realm) but then my app started to fail. It was showing many errors on build, and after correcting them all the app instal with build successful, but when I try to open app in emulator it just close instantly, without any errors. The only messaged displayed is this:

enter image description here

I spent a whole day researching and trying to fix it, but i just couldnt do anything.

So I created a new project and started in reverse way. First, installed and configured Realm, and everything was fine. Then, I added react-navigation stack and still ok. But when I added react native navigation Drawer and configured its dependencies (gesture handler and react native screens, also I had to enable hermes because its a screens must have) the app started to crashes exactly the same as the previous app.

I tried to fix it in so many ways but nothing seems to work. I'm starting to get desperate, because it's been 2 days since I can't do anything in my app :C

I hope any of you can help me :)

1

There are 1 best solutions below

0
On

the main culprit is reanimated v2 which is required for react navigation drawer, there are 2 ways to fix it:

  1. downgrade to reanimated v1
  2. install realm@hermes yarn add realm@hermes then rebuild the project. (no need enable hermes)

go to reanimated v2 causes realm to not work for more detail