morrowdigital / watermelondb-expo-plugin

125 stars 30 forks source link

Expo Dev Client and Hermes Support #19

Closed ZeroGodForce closed 1 year ago

ZeroGodForce commented 1 year ago

Hi there, thanks for the hard work you've put into this.

I'm currently trying to implement this into my project, I'm using expo-dev-client with Hermes, but for the life of me I can't get the app to build and I'm not really sure why at this point. I'm using:

And I'm running it on the iOS simulator iPhone 14 Pro Max (iOS v16.2).

I consistently get this error messages bundled together while the app is building

ERROR  TypeError: Cannot read property 'getRandomIds' of null, js engine: hermes

ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.

A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

Near as I can tell getRandomIds is the part of WatermelonDB responsible for generating IDs. But I haven't use it directly for anything. I've tried integrating the example on watermelon's repo, (though I'm using TypeScript), when that didn't work I discovered the example folder on this repo and tried to integrate that, but that doesn't appear to work either. Is there some sort of compatibility issue I'm missing? Is the combination of my setup not supported? I'm kinda stuck and don't know what to try next. If anyone could point me in the right direction I'd really appreciate it.

If you need more info please ask, thanks.

MorningLit commented 1 year ago

Seems like this plugin does not support the latest version of watermelondb: v0.26.0 Related issue: https://github.com/Nozbe/WatermelonDB/issues/1592

I tried to setup a brand new project with create-expo-app with the following dependencies (downgraded watermelondb) and following the tutorial (before the withObservables part)

"@morrowdigital/watermelondb-expo-plugin": "^2.1.2",
"@nozbe/watermelondb": "^0.25.5",
"expo": "~48.0.15",
"expo-build-properties": "~0.6.0",
"expo-status-bar": "~1.4.4",
"react": "18.2.0",
"react-native": "0.71.8"

but I'm faced with another issue TypeError: Cannot read property 'initializeJSI' of null, js engine: hermes

I am not sure what to do after this and what version of watermelondb does this plugin support. I am looking to try https://github.com/skam22/watermelondb-expo-plugin alternative plugin next to see if there's any results @ZeroGodForce @brunokiafuka

ZeroGodForce commented 1 year ago

@MorningLit I tried attacking it from a different angle. I downloaded the code in the example folder (as it was supposed to be an example for use with v0.26.0), and I got that running. But at that point it still doesn't really "do" anything.

So I'm using the source from this demo (https://youtu.be/8fle93Zzdp0) and trying to convert it to TypeScript without changing too much to get that working. Haven't had time to finish but will let you know what results I come across.

ZeroGodForce commented 1 year ago

@MorningLit I abandoned the attempt in the end and decided to go with Realm instead. Perhaps there will be fixes down the line, but I didn't have the time to spend and see if it came to anything. @brunokiafuka did you get anywhere with the alternative plugin?

brunokiafuka commented 1 year ago

Hi @ZeroGodForce, apologies on the lack of response. I've been chatting with the folks at WatermelonDB so we can join the plugin on the main repo.

ZeroGodForce commented 1 year ago

@brunokiafuka no worries at all. That sounds neat, will pop my head in there and see what's going on. Definitely want to give WatermelonDB another go once I'm done with my current workstream