-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
feat: add initialProps property to RCTAppDelegate #35848
feat: add initialProps property to RCTAppDelegate #35848
Conversation
Hi @jblarriviere! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Base commit: e6d1ab9 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
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.
It looks good to me. I'm wondering how we can let users know about this. With this change only, it will be hidden in the AppDelegate library. 🤔
How do you feel about modifying the template adding something, like:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"HelloWorld";
+ // You can add your custom initial props in the dictionary below.
+ // They will be passed down to the ViewController used by React Native.
+ self.initialProps = @{};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
In this way we will also teach our users how to use this new property.
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Thanks for your feedback. That sounds like a good way to let users know, I've added the comment you suggested . |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi merged this pull request in b314e6f. |
Summary: Hi there, While upgrading to 0.71 we realised the RCTAppDelegate doesn't offer a way to set custom `initProps` that would depend on `launchOptions`. This PR adds an `initialProps` property to the RCTAppDelegate. This would let us set this property based on `launchOptions` in our implementation of `didFinishLaunchingWithOptions` before calling `[super didFinishLaunchingWithOptions]` Thanks ! ## Changelog [IOS] [ADDED] - Add `initialProps` property to `RCTAppDelegate` Pull Request resolved: #35848 Reviewed By: rshest Differential Revision: D42543027 Pulled By: cipolleschi fbshipit-source-id: 55374914890445f8193c12a06a943b7796edb457
Are you using the 0.71.1 ? This PR is not available in previous versions |
@codemickey78 if you are updating from a previous version of React Native, make sure that your AppDelegate extends |
Summary: Hi there, While upgrading to 0.71 we realised the RCTAppDelegate doesn't offer a way to set custom `initProps` that would depend on `launchOptions`. This PR adds an `initialProps` property to the RCTAppDelegate. This would let us set this property based on `launchOptions` in our implementation of `didFinishLaunchingWithOptions` before calling `[super didFinishLaunchingWithOptions]` Thanks ! ## Changelog [IOS] [ADDED] - Add `initialProps` property to `RCTAppDelegate` Pull Request resolved: facebook#35848 Reviewed By: rshest Differential Revision: D42543027 Pulled By: cipolleschi fbshipit-source-id: 55374914890445f8193c12a06a943b7796edb457
Summary
Hi there,
While upgrading to 0.71 we realised the RCTAppDelegate doesn't offer a way to set custom
initProps
that would depend onlaunchOptions
.This PR adds an
initialProps
property to the RCTAppDelegate. This would let us set this property based onlaunchOptions
in our implementation ofdidFinishLaunchingWithOptions
before calling[super didFinishLaunchingWithOptions]
Thanks !
Changelog
[IOS] [ADDED] - Add
initialProps
property toRCTAppDelegate