gpt4 book ai didi

react-native - 我该如何解决 : "RCTBridge required dispatch_sync to load" in React Native using yarn workspaces?

转载 作者:行者123 更新时间:2023-12-04 11:51:07 28 4
gpt4 key购买 nike

我关注中篇文章:React Native 0.63 Monorepo walkthrough小心地让 yarn 工作区与 react-native 一起工作。 Everhtings 可以工作,我可以构建我的 iOS 和 Android 应用程序,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 设置产生的。
您知道如何删除此警告吗?

最佳答案

打开您的 /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

关于react-native - 我该如何解决 : "RCTBridge required dispatch_sync to load" in React Native using yarn workspaces?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67093549/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com