Search code examples
react-native-navigationwix-react-native-navigationreact-native-navigation-v2

How to fix 'No such module 'ReactNativeNavigation' error in swift ios project


I just implemented the ReactNativeNavigation library to my ios project using a swift AppDelegate file and when I build the project I get the error: 'No such module 'ReactNativeNavigation'

I have tried to install a previous version of the package and also tried to enable 'Copy only when installing' in the package itself.

My AppDelegate.swift file's parts using the package

import ReactNativeNavigation

...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    let jsCodeLocation = RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource: nil)
    ReactNativeNavigation.bootstrap(jsCodeLocation, launchOptions: launchOptions)

    return true
  }

Has anyone met with this issue or knows how to fix it? Thanks in advance!


Solution

  • I had a similar situation recently with swift and ReactNativeNavigation, I fixed it by:

    • Removing "import ReactNativeNavigation" from AppDelegate.swift

    • add "#import <ReactNativeNavigation/ReactNativeNavigation.h>" to your "project"-Bridge-Header.h

    • clear build cache and build again.