Multiple RCTRootView in one application

I am creating a responsive native application, but I need to use objective C to create my custom UIView. But the problem is that this UIView should display reactive content. for example, paste text input and a button. I am thinking of adding RCTRootView (which will have these responsive components) to the custom UIView and thus solve the problem. But currently I am using one RCTRootView. How to create another and use it in my code.

edit: I realized that we can add different packages from the how-to-rename-react-native-entry-file-index-ios-js server , but how to use this when I run locally.

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

+4
source share
1

RCTRootView, UIView.

RCTRootView *someRootView = [[RCTRootView alloc] initWithBundleURL:someJsCodeLocation 
                                                        moduleName:@"SomeRootComponent" 
                                                     launchOptions:nil];

RCTRootView *anotherRootView = [[RCTRootView alloc] initWithBundleURL:anotherJsCodeLocation 
                                                           moduleName:@"AnotherRootComponent" 
                                                        launchOptions:nil];

(jsCodeLocation) RCTRootView RCTRootView. (moduleName):

AppRegistry.registerComponent('SomeRootComponent', () => SomeRootComponent);

AppRegistry.registerComponent('AnotherRootComponent', () => AnotherRootComponent);

, :

curl 'http://localhost:8082/index1.ios.bundle?dev=false&minify=true' -o iOS/main1.jsbundle

curl 'http://localhost:8082/index2.ios.bundle?dev=false&minify=true' -o iOS/main2.jsbundle

main1.jsbundle main2.jsbundle .

+8

All Articles