找不到“ReactNativeNavigation/ReactNativeNavigation.h”文件

Jos*_* K. 5 ios react-native react-native-navigation

注意:请务必对我应该提及的内容进行评论以改进这个问题,而不是不赞成,我能够成功地为另一个项目设置带有 expo 的 React Navigation,并且很想在这个项目中启动和运行 RNN。


我正在为我的 React Native 应用程序设置 React Native Navigation,特别是使用 Xcode 的 iOS。

我已AppDelegate.m按照说明更改了文件:

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];

  return YES;
}

@end
Run Code Online (Sandbox Code Playgroud)

进行更改后,我收到两个 Xcode 错误:

'ReactNativeNavigation/ReactNativeNavigation.h' file not found
Use of undeclared identifier 'ReactNativeNavigation'
Run Code Online (Sandbox Code Playgroud)

我已确保遵循所有步骤,错误发生在React Native Navigation iOS 文档的第 3 步

med*_*uru 1

尝试删除node_modules文件夹,然后在项目目录中执行新的npm安装或yarn安装。接下来运行react-native链接。