Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
* - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge moduleName:(NSString*)moduleName initProps:(NSDictionary
*)initProps;
* - (UIViewController *)createRootViewController;
* - (UIViewController *)attachRootView:(UIViewController *) rootViewController
rootView:(UIView *)rootView;
* New Architecture:
* - (BOOL)concurrentRootEnabled
* - (BOOL)turboModuleEnabled;
Expand Down Expand Up @@ -94,6 +96,16 @@
*/
- (UIViewController *)createRootViewController;

/**
* It assigns the rootView to the rootViewController
* By default, it assigns the rootView to the view property of the rootViewController
*
* @return: an instance of `UIViewController`
*/
- (UIViewController *)attachRootView:(UIViewController *) rootViewController
rootView:(UIView *)rootView;


/// This method controls whether the App will use RuntimeScheduler. Only applicable in the legacy architecture.
///
/// @return: `YES` to use RuntimeScheduler, `NO` to use JavaScript scheduler. The default value is `YES`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [self createRootViewController];
rootViewController.view = rootView;
[self attachRootView:rootViewController rootView:rootView];
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];

Expand Down Expand Up @@ -129,6 +129,12 @@ - (UIViewController *)createRootViewController
return [UIViewController new];
}

- (UIViewController *)attachRootView:(UIViewController *) rootViewController
rootView:(UIView *)rootView {
rootViewController.view = rootView;
return rootViewController;
}

- (BOOL)runtimeSchedulerEnabled
{
return YES;
Expand Down