RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks

后端 未结 2 1346
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 22:19

I get this in logs:

RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks

This is leading to

相关标签:
2条回答
  • 2020-12-29 22:51

    I fixed it with updating AppDelegate.m as below:

    #if RCT_DEV
    #import <React/RCTDevLoadingView.h>
    #endif
    ...
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
      ...
      RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:jsCodeLocation
                                                moduleProvider:nil
                                                 launchOptions:launchOptions];
    #if RCT_DEV
      [bridge moduleForClass:[RCTDevLoadingView class]];
    #endif
      RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                       moduleName:@"<AddYourAppNameHere>"
                                                initialProperties:nil];
      ...
    }
    

    Source: devburmistro's answer Dec 10, 2017 from: https://github.com/facebook/react-native/issues/16376

    0 讨论(0)
  • 2020-12-29 22:52

    Swift Solution

    let bridge = RCTBridge(bundleURL: jsCodeLocation, moduleProvider: nil, launchOptions: nil)
    
    #if RCT_DEV
    bridge?.module(for: RCTDevLoadingView.self)
    #endif
    let rootView = RCTRootView(bridge: bridge!, moduleName: "AppMain", initialProperties: nil)
    
    
    0 讨论(0)
提交回复
热议问题