注意:请务必评论我应该提到什么来改进这个问题而不是拒绝,我能够成功地为另一个项目设置 React Navigation with expo,并且会喜欢在这个项目中启动并运行 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
进行更改后,我收到两个 Xcode 错误:
'ReactNativeNavigation/ReactNativeNavigation.h' file not found
Use of undeclared identifier 'ReactNativeNavigation'
我已确保遵循所有步骤,错误发生在 React Native Navigation iOS documentation 的第 3 步中
最佳答案
尝试删除 node_modules 文件夹,然后在项目目录中执行全新的 npm install 或 yarn install。接着运行 react-native 链接。
关于ios - 找不到“ReactNativeNavigation/ReactNativeNavigation.h”文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54058375/