Skip to content
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

Missing Realm Constructor Ignite-cli RN app #4346

Closed
Lektrion opened this issue Feb 14, 2022 · 5 comments
Closed

Missing Realm Constructor Ignite-cli RN app #4346

Lektrion opened this issue Feb 14, 2022 · 5 comments

Comments

@Lektrion
Copy link

Lektrion commented Feb 14, 2022

Goals
Build a Ignite-Expo-Realm app

Expected results
Being able to use Realm with a ignite boilerplates with updated expo SDK

Actual results
Error is thrown : Missing Realm Constructor

Steps to reproduce
creating boilerplate via ignite-cli
npx ignite-cli new realmIgnite --expo
npm install realm
expo upgrade (ignite use expo sdk 43) realm is supported (or is supposed to) with the Sdk 44
{{ yarn android}}

As soon as i tried to use Realm via "import Realm from 'realm'" an error is thrown :Missing realm constructor

Realm Works fine using npx create-react-native-app MyAwesomeRealmApp -t with-realm

Version of Realm / Xcode/ Android Studio/ OSX/ WIN:
Here is the dependencies from package.json

"@expo/webpack-config": "~0.16.2", "@react-native-async-storage/async-storage": "~1.15.0", "@react-navigation/native": "~6.0.1", "@react-navigation/native-stack": "^6.0.2", "@react-navigation/stack": "~6.0.1", "apisauce": "2.0.0", "expo": "^44.0.0", "expo-linear-gradient": "~11.0.3", "expo-localization": "~12.0.0", "expo-modules-core": "~0.6.4", "expo-status-bar": "~1.2.0", "i18n-js": "3.8.0", "mobx": "6.1.8", "mobx-react-lite": "3.2.0", "mobx-state-tree": "5.0.1", "react": "17.0.1", "react-native": "0.64.3", "react-native-gesture-handler": "~2.1.0", "react-native-keychain": "6.2.0", "react-native-safe-area-context": "3.3.2", "react-native-screens": "~3.10.1", "reactotron-mst": "3.1.4", "reactotron-react-js": "^3.3.7", "reactotron-react-native": "5.0.1", "realm": "^10.13.0", "validate.js": "0.13.1"

Issue 4332 encounter the same problem, but i dont understand how to use the solution provided there in my case
Thanks you in advance for any help you could give me

@takameyer
Copy link
Contributor

@Lektrion expo only works with realm in conjunction with expo-dev-client. I would try the following:

  • yarn add expo-dev-client
  • change the scripts in your package.json to dev-client scripts:
...
"scripts": {
  "start": "expo start --dev-client",
  "android": "expo run:android",
  "ios": "expo run:ios",
...
}
  • yarn android

Let us know if this works. I would verify it myself, but I'm having an issue even using ignite-cli at the moment.

@takameyer
Copy link
Contributor

I would also recommend updating ignite-cli to v7.10.3 if possible. This includes expo v44.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Feb 15, 2022
@Lektrion
Copy link
Author

I would also recommend updating ignite-cli to v7.10.3 if possible. This includes expo v44.

Actually ignite-cli v7.10.3 encounter a post-install error with solidarity but i will try your previous solution within the afternoon and let you know.

Thank you for the quick reply :)

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Feb 15, 2022
@Lektrion
Copy link
Author

Your solution resolved my problem @takameyer !

Basically you can make ignite-cli and Realm work together this way :

npx ignite-cli new realmIgnite --expo
npm install realm
expo upgrade

Then follow @takameyer solution:

@Lektrion expo only works with realm in conjunction with expo-dev-client. I would try the following:

  • yarn add expo-dev-client
  • change the scripts in your package.json to dev-client scripts:
...
"scripts": {
  "start": "expo start --dev-client",
  "android": "expo run:android",
  "ios": "expo run:ios",
...
}
  • yarn android

Let us know if this works. I would verify it myself, but I'm having an issue even using ignite-cli at the moment.

for me ignite project was throwing an error because of rick.jpg image found in components>auto-image (the require doesnt work because the .jpg file seems broken)

After following the protocol above and removing the error from auto-image Realm works fine with Ignite-cli boilerplate!

I look forward for the new release of Ignite-CLI to be fixed.

Thank you

@takameyer
Copy link
Contributor

That's great! It's cool to hear we also work with ignite-cli 🙂 Thanks for submitting the issue.

@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label Feb 15, 2022
@sync-by-unito sync-by-unito bot closed this as completed Feb 15, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants