feat: improve RCTAppDelegate usage for brownfield#46625
Closed
okwasniewski wants to merge 1 commit into
Closed
Conversation
2a617d7 to
529cf9b
Compare
cipolleschi
approved these changes
Sep 24, 2024
Contributor
cipolleschi
left a comment
There was a problem hiding this comment.
Thanks for putting up this PR
Contributor
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Contributor
|
@cipolleschi merged this pull request in 391680f. |
Collaborator
|
This pull request was successfully merged by @okwasniewski in 391680f When will my fix make it into a release? | How to file a pick request? |
blakef
pushed a commit
that referenced
this pull request
Sep 30, 2024
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
This was referenced Apr 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This PR improves the usage of
RCTAppDelegatefor 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:
Changelog:
[IOS] [ADDED] - improve RCTAppDelegate usage for brownfield, add
automaticallyLoadReactNativeWindowflagTest Plan:
CI Green