1

I'm working in a Expo ejected project (Expo SDK 44, WatermelonDB 0.24.0). When I try to build de project, I get those erros:

[RUN_FASTLANE] ❌ (node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/DatabaseBridge.swift:7:23)

   5 |     typealias ConnectionTag = NSNumber
   6 | 
>  7 |     @objc var bridge: RCTBridge?
     |                       ^ cannot find type 'RCTBridge' in scope
   8 |     @objc static let requiresMainQueueSetup: Bool = false
   9 |     @objc let methodQueue = DispatchQueue(label: "com.nozbe.watermelondb.database", qos: .userInteractive)
  10 | 

[RUN_FASTLANE] ❌ (node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/DatabaseBridge.swift:93:13)

  91 |         methodQueue.sync {
  92 |             // swiftlint:disable all
> 93 |             installWatermelonJSI(bridge as? RCTCxxBridge)
     |             ^ cannot find 'installWatermelonJSI' in scope
  94 |         }
  95 |         return [:]
  96 |     }

[RUN_FASTLANE] ❌ (node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/DatabaseBridge.swift:103:9)

  101 |                          resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
  102 |         var error: NSError?
> 103 |         watermelondbProvideSyncJson(id.int32Value, json.data(using: String.Encoding.utf8.rawValue), &error)
      |         ^ cannot find 'watermelondbProvideSyncJson' in scope
  104 |         if let error = error {
  105 |             sendReject(reject, error)
  106 |    

I've add to my Project-Bridging-Header.h this code:

    #import <React/RCTBundleURLProvider.h>
    #import <React/RCTRootView.h>
    #import <React/RCTViewManager.h>
    #import <React/RCTBridgeModule.h>

    // Silence warning
    #import 
      "../../node_modules/@nozbe/watermelondb/native/ios/WatermelonDB/SupportingFiles/Bridging.h"

Any help?

Thanks in advance

Martín

letincho5
  • 25
  • 5

1 Answers1

1

For anyone that stumbles in this question, I was able to run WatermelonDB + Expo by:

  1. Installing @morrowdigital/watermelondb-expo-plugin
  2. Adding the below snippet to my app.json
{
  "expo": {
    "plugins": ["@morrowdigital/watermelondb-expo-plugin"]
  }
}
  1. Running expo run:android

Although I'm not sure if what was missing was expo run instead of expo start or expo run + the plugin.

Hope that this is useful for someone.