Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve RCTAppDelegate usage for brownfield (#46625)
Summary: This PR improves the usage of `RCTAppDelegate` for brownfield scenarios. Currently, when we want to integrate React Native with a brownfield app users might not want to initialize React Native in the main window. They may want to create it later. Example usage: ```swift class AppDelegate: RCTAppDelegate { override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Disable automatically creating react native window self.automaticallyLoadReactNativeWindow = false return super.application(application, didFinishLaunchingWithOptions: launchOptions) } } ``` ```swift import Foundation import React import React_RCTAppDelegate class SettingsViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.view = (RCTSharedApplication()?.delegate as? RCTAppDelegate)?.rootViewFactory .view(withModuleName: "Settings", initialProperties: [:]) } } ``` ## Changelog: [IOS] [ADDED] - improve RCTAppDelegate usage for brownfield, add `automaticallyLoadReactNativeWindow` flag Pull Request resolved: #46625 Test Plan: CI Green Reviewed By: cortinico Differential Revision: D63325397 Pulled By: cipolleschi fbshipit-source-id: 1361bda5fcd91f4933219871c64a84a83c281c34
- Loading branch information