Running Realm on ejected Expo projects on Android with errors

Viewed 300

I tried to run Realm on ejected Expo(both bare and managed workflow) projects on an Android simulator. When I tried to access realm, it showed the error as show in the picture below.

My ejected Expo project's dependencies included: "expo": "~42.0.1", "react": "16.13.1", "react-native": "~0.63.4", "realm": "^10.6.0"

The code base that I used for the test is from https://github.com/osama256/React-Native-Realm/blob/master/App.js. I tried to clone the repository and run it using react native cli and it worked.

For the ejected expo projects, the object created from realm is empty, https://github.com/osama256/React-Native-Realm/blob/master/App.js. (line 25):

    const newDB = async () => {
       //empty object returned from realm 
       realm = await new Realm({ instance
         path: "myrealm",
         schema: [EmployeeSchema],
        });
       }
       newDB()
   ...

I highly suspect that the error is came from some configuration between realm, expo and react-native. The error occur in (line 39)

    realm.write(() => {
       realm.create('Employee', {
        id,
        name,
        dep
     });
  });

Is there anyone have similar error message and any solution to fix it? thanks for helping.

enter image description here

1 Answers

The bug is fixed by following the comments here: https://github.com/realm/realm-js/issues/3710#issuecomment-834056098

remark: actually there are other alternative for react-native-reanimated: https://openbase.com/js/react-native-reanimated/alternatives?orderBy=RECOMMENDED&

Related