-
Notifications
You must be signed in to change notification settings - Fork 25k
feat: implement ReactNativeFactory #46298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
packages/react-native/Libraries/AppDelegate/RCTAppDelegate+Protected.h
Outdated
Show resolved
Hide resolved
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The direction looks the right one to me. I left a couple of comments with internal considerations, but it looks promising.
packages/react-native/Libraries/AppDelegate/RCTAppDelegate+Protected.h
Outdated
Show resolved
Hide resolved
7754580 to
969d347
Compare
Summary: This PR introduces `RCTUIConfiguratorProtocol` for better separation of concerns inside of RCTAppDelegate. It's also a prerequisite for #46298 Discussed with cipolleschi ## Changelog: [IOS] [ADDED] - introduce RCTUIConfiguratorProtocol Pull Request resolved: #47139 Test Plan: - CI Green - Test if methods can be overriden Reviewed By: blakef Differential Revision: D65063839 Pulled By: cipolleschi fbshipit-source-id: b63766e245d57f369ab94bd8047d5de9a3447b3e
Summary: This PR introduces `RCTArchConfiguratorProtocol` for better separation of concerns inside of RCTAppDelegate. It's also a prerequisite for #46298 Discussed with cipolleschi ## Changelog: [IOS] [ADDED] - introduce RCTArchConfiguratorProtocol Pull Request resolved: #47306 Test Plan: - CI Green - Test if methods can be overriden Reviewed By: realsoelynn Differential Revision: D65212703 Pulled By: cipolleschi fbshipit-source-id: 9850fec31c421f0c6230e7e23d7a208d823d828f
969d347 to
13d0fa4
Compare
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the long wait @okwasniewski.
I love the direction of this!
packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm
Outdated
Show resolved
Hide resolved
packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm
Outdated
Show resolved
Hide resolved
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pressed on approve by mistake.
There are a couple of things that are missing.
|
@cipolleschi Sorry I kind of left it in-progress, as I was experimenting with the new approach, of course everything you pointed out needs to be fixed! Thanks for checking it out and making sure the direction is good. We are finishing a client project, so I will have some time to get back to this work soon |
7f64781 to
e69d9dc
Compare
| #import <ReactCommon/RCTTurboModuleManager.h> | ||
| #import "RCTAppDelegate.h" | ||
|
|
||
| @interface RCTAppDelegate () <RCTTurboModuleManagerDelegate> | ||
| @end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cipolleschi I'm not sure how to handle this. This should be defined on the ReactNativeFactoryDelegate now but removing this might be a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added the conformance already here so, technically, the RCTAppDelegate conforms to the RCTTurboModuleManagerDelegate.
If the breaking change is for the missing file/import, we can land it and ship it in 0.78.
400d438 to
7f60df3
Compare
|
uhm... dynamic frameworks are failing, could you have a look at why and fix it, please? |
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job. I left a few other comments that probably needs to be addressed.
Can you also check whether the packages/helloworld/ios app requires any change? This mimics the template in our CI.
7f60df3 to
06e3513
Compare
Yeah.. wrong import, should be good now |
06e3513 to
5bb5a94
Compare
|
And now we have a conflict with your other PR.. 🤣 |
wip: work on new implementation
5bb5a94 to
4c456ee
Compare
Rebased ✅ At least now we have a clear history why it was deleted 😄 |
cipolleschi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the amazing work!
| #import <ReactCommon/RCTTurboModuleManager.h> | ||
| #import "RCTAppDelegate.h" | ||
|
|
||
| @interface RCTAppDelegate () <RCTTurboModuleManagerDelegate> | ||
| @end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added the conformance already here so, technically, the RCTAppDelegate conforms to the RCTTurboModuleManagerDelegate.
If the breaking change is for the missing file/import, we can land it and ship it in 0.78.
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @okwasniewski in 081be01 When will my fix make it into a release? | How to file a pick request? |
|
@cipolleschi merged this pull request in 081be01. |
Summary: Recently, I've introduced `RCTReactNativeFactory` in this PR: #46298, which is a good successor for `RCTAppDelegate`. ### Why? `RCTAppDelegate` introduced strong coupling between React Native and AppDelegate pattern. From iOS 13+ there is a newer equivalent (Scene Delegate) which is not possible to achieve with current architecture. The proposed solution involves migration to a `RCTReactNativeFactory` a class that encapsulates initialization logic of React Native. This migration will make brownfield initialization easier by making it more flexible and simpler to integrate into already established apps. ### Deprecation plan The plan I've discussed with cipolleschi involves: - Deprecation of `RCTAppDelegate` in 0.79 (current main) - Migration off `RCTAppDelegate` to SceneDelegate + `RCTReactNativeFactory` in 0.80 ## Changelog: [IOS] [DEPRECATED] - deprecate RCTAppDelegate Pull Request resolved: #49078 Test Plan: Not needed Reviewed By: cortinico Differential Revision: D69061022 Pulled By: cipolleschi fbshipit-source-id: b02a0ff3f26be9320da749f38c9cf083804f9f30
Summary: Recently, I've introduced `RCTReactNativeFactory` in this PR: facebook#46298, which is a good successor for `RCTAppDelegate`. ### Why? `RCTAppDelegate` introduced strong coupling between React Native and AppDelegate pattern. From iOS 13+ there is a newer equivalent (Scene Delegate) which is not possible to achieve with current architecture. The proposed solution involves migration to a `RCTReactNativeFactory` a class that encapsulates initialization logic of React Native. This migration will make brownfield initialization easier by making it more flexible and simpler to integrate into already established apps. ### Deprecation plan The plan I've discussed with cipolleschi involves: - Deprecation of `RCTAppDelegate` in 0.79 (current main) - Migration off `RCTAppDelegate` to SceneDelegate + `RCTReactNativeFactory` in 0.80 ## Changelog: [IOS] [DEPRECATED] - deprecate RCTAppDelegate Pull Request resolved: facebook#49078 Test Plan: Not needed Reviewed By: cortinico Differential Revision: D69061022 Pulled By: cipolleschi fbshipit-source-id: b02a0ff3f26be9320da749f38c9cf083804f9f30
Summary:
This PR implements ReactNativeFactory to encapsulate further the logic of creating an instance of React Native for iOS.
This will remove the strong coupling on the RCTAppDelegate and allow us to support Scene Delegate in the future.
The goal is to have a following API:
Changelog:
[IOS] [ADDED] - implement ReactNativeFactory
Test Plan:
Test out all the methods of AppDelegate