I encountered the error “A moduleName is required to create an RCTROotView”, after which the app was caught on the startup web page. Who may also help me? thanks.
Step
- run ‘npx react-native init RN0710RC3 –version 0.71.0-rc.3’ to create a RN mission
- create ‘AppDelegate.swift’ ‘Bridging-Header.h’ and delete ‘AppDelegate.mm’ ‘AppDelegate.h’ ‘predominant.m’
AppDelegate.mm
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
@implementation AppDelegate
- (BOOL)software:(UIApplication *)software didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"RN0710RC3";
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"predominant" withExtension:@"jsbundle"];
#endif
}
- (BOOL)concurrentRootEnabled
{
return true;
}
@finish
AppDelegate.swift
import Basis
import UIKit
@UIApplicationMain
class AppDelegate: RCTAppDelegate {
func software(software: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
CommonTheme.currentTheme.primaryColor = .purple;
self.moduleName = "RN0710RC3";
return self.software(software, didFinishLaunchingWithOptions: launchOptions);
}
override func sourceURL(for bridge: RCTBridge!) -> URL! {
#if DEBUG
return RCTBundleURLProvider.sharedSettings()?.jsBundleURL(forBundleRoot: "index", fallbackResource: nil)
#else
return Bundle.predominant.url(forResource: "predominant", withExtension: "jsBundle")
#endif
}
func concurrentRootEnabled() -> Bool {
return true;
}
}
Bridging-Header.h
#import <RCTAppDelegate.h>
#import <React/RCTBundleURLProvider.h>