我遵循medium的文章:React Native 0.63 Monorepo walkthrough小心地使用react-native获得纱线工作区。一切正常,我可以构建我的iOS和安卓应用程序,也可以构建Metro Bundler,但当我使用yarn workspace mobile ios构建我的iOS应用程序时,metro bundler会给我以下警告
RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks除非我在yarn工作区中使用react-native,否则我不会收到这个警告。因此,我怀疑这个错误是由我的monorepo设置生成的。
您知道如何删除此警告吗?
发布于 2021-06-09 12:08:58
打开你的/ios/YourAppName/AppDelegate.m
#import "AppDelegate.h"
// ADD THIS
#if RCT_DEV
#import <React/RCTDevLoadingView.h>
#endif
// TILL HERE
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
moduleProvider:nil
launchOptions:launchOptions];
// THIS CONDITION
#if RCT_DEV
[bridge moduleForClass:[RCTDevLoadingView class]];
#endif
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Test"
initialProperties:nil];
// TILL HERE
...
}源here
发布于 2021-04-15 00:52:51
重新打开终端并再次构建应用程序后,警告不再出现
https://stackoverflow.com/questions/67093549
复制相似问题