After some time spent to set up this package in react native, got this error:
[DB] Uh-oh. Database failed to load, we're in big trouble, [TypeError: undefined is not an object (evaluating 'Native.setUp')]
I am using expo for development.
Hey, looks like the native module is not set up. Did you go through Installation guide for iOS/Android?
I missed defining the decorators in Model. After defining, I got an error:
Unable to resolve "@nozbe/watermelondb/decorators"
So, is it working now for you or still no? Your error is most likely because you forgot to add the babel plugin to your config. Note that you need to restart the bundler after doing that
Nop. Do you meen - @babel/plugin-proposal-decorators?
please go through https://github.com/Nozbe/WatermelonDB/blob/master/docs/Installation.md carefully one more time -- and let me know if this fixes it ;)
I got this same error, so I went to the docs. Adding <appname>-Bridging-Header.h solved the problem for me.
@radex
@theixbass is this a solved issue?
I assume it is — closing this now. @theixbass let me know if this issue should be reopened
@theixbass I have the same problem with Expo, how did you resolve in the end (without ejecting)?
@theixbass I have the same problem with Expo, how did you resolve in the end?
I did not...
Okay, clearly this is not suitable for Expo at this time then. Back to RxDB it is...
Yeah, makes sense, you probably cannot add swift files to expo project.
I believe you can eject to ExpoKit and then just go through standard Installation steps: https://docs.expo.io/versions/latest/expokit/expokit
Are there any plans to attempt to support Expo?
@Slapbox you can eject to ExpoKit. If you want easy built in support in Expo, you have to contact Expo ;)
To be honest I think it's in your interest to support Expo. Ejecting gives a developer far more choice when it comes to ORMs - you could use Realm, for example. Keeping everything in JS has significant advantages for many development teams.
@davidwadge What are you trying to say? Ejecting to ExpoKit should make it easy to add Watermelon as a dependency.
The advantage of using Expo is that you keep your codebase _entirely_ in JS. Ejecting turns your codebase into a more native-y one, meaning I could just as well use another ORM, such as Realm for example.
Ejecting turns your codebase into a more native-y one, meaning I could just as well use another ORM, such as Realm for example.
Right. That's good, no?
Imagine you have a team of predominantly React web developers who have little to no experience with native iOS or Android development. In that circumstance, you want to keep as much as possible in JavaScript, which is why Expo exists.
In that circumstance, you want to keep as much as possible in JavaScript, which is why Expo exists.
That's cool, but what does that have to do with WatermelonDB? I don't decide what's part of the Expo SDK.
If people want WatermelonDB support in Expo, this is the place to make it known: https://expo.canny.io/feature-requests/p/add-support-for-watermelondb
The thing is that expo already has support for sqlite. If that is the only native dependency you need then is it reasonable to expand expo support by writing an adapter against the expo’s SQLite interface?
@bemnet4u I don't think it's possible, some basic native support is needed — I think. But you can investigage if you'd like
I have been facing the same issue.
I started a new app using react-native. I followed general instructions and android instructions in installation.md.
can anybody help please?
I got this same error, so I went to the docs. Adding
<appname>-Bridging-Header.hsolved the problem for me.
When doing this initially, I wasn't sure where the file needs to go and deleted it to retry. However, when following the steps again, XCode doesn't prompt to create the bridging header again. Can you explain exactly how to create this file and which folder it goes into?

For the next person that deletes the header file, XCode won't prompt you the second time and you'll need to manually create it. Here are the instructions: https://mycodetips.com/ios/manually-adding-swift-bridging-header-1290.html
I am facing the same error in android. I tried linking manually.
facing same error after manual linking
Most helpful comment
If people want WatermelonDB support in Expo, this is the place to make it known: https://expo.canny.io/feature-requests/p/add-support-for-watermelondb