-
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
Fix RCTAlertController not showing when using SceneDelegate on iOS 13.0+ #35716
Conversation
Hi @ouabing! 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: 9c57a7f |
Base commit: 9c57a7f |
PR build artifact for e468621 is ready. |
PR build artifact for e468621 is ready. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
@makovkastar has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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 code seems ok to me, I left a couple of questions to understand it better and see whether we can simplify it a little bit.
Also, can we extract lone 24 to 34 into a private function? Something like:
- (UIWindow *)getUIWindowFromScene
{
// ...moved code...
}
This will make it easier to read the code and to eventually change/remove the code once we don't need all the checks.
What do you think?
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 | ||
if (@available(iOS 13.0, *)) { | ||
for (UIScene *scene in RCTSharedApplication().connectedScenes) { | ||
if (scene.activationState == UISceneActivationStateForegroundActive && [scene isKindOfClass:[UIWindowScene class]]) { |
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.
Why the check [scene isKindOfClass:[UIWindowScene class]]
is needed? Can scene
be of something different from a UIWindowScene class
?
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.
For app supports CarPlay, RCTSharedApplication().connectedScenes
will include CarPlay scenes such as CPTemplateApplicationScene
instance, which may also in active state.
PR build artifact for 50273c0 is ready. |
PR build artifact for 50273c0 is ready. |
PR build artifact for cb78e7e is ready. |
PR build artifact for cb78e7e is ready. |
@makovkastar has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@ouabing can you please rebase this PR on top of the latest commit? There are some merge conflicts. |
PR build artifact for 03de6eb is ready. |
PR build artifact for 03de6eb is ready. |
@makovkastar done, thank you all |
@makovkastar has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@makovkastar merged this pull request in 0c53420. |
….0+ (#35716) Summary: On iOS 13.0+, app may use SceneDelegate for multiple windows support or CarPlay support. RCTAlertController can't find the correct root vc in such scene based apps. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [iOS] [Fixed] - Fix RCTAlertController not showing when using SceneDelegate on iOS 13.0+. Pull Request resolved: #35716 Reviewed By: cipolleschi Differential Revision: D42253653 Pulled By: makovkastar fbshipit-source-id: ae4e833abca2af7af8028f3af9bd8d3f60ebd392
….0+ (facebook#35716) Summary: On iOS 13.0+, app may use SceneDelegate for multiple windows support or CarPlay support. RCTAlertController can't find the correct root vc in such scene based apps. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [iOS] [Fixed] - Fix RCTAlertController not showing when using SceneDelegate on iOS 13.0+. Pull Request resolved: facebook#35716 Reviewed By: cipolleschi Differential Revision: D42253653 Pulled By: makovkastar fbshipit-source-id: ae4e833abca2af7af8028f3af9bd8d3f60ebd392
* fix: unbalanced calls to begin/end appearance transitions * fix: update how toastWindow is obtained see facebook/react-native#35716
…n iOS 13.0+ (facebook#35716)" This reverts commit 0c53420.
Summary
On iOS 13.0+, app may use SceneDelegate for multiple windows support or CarPlay support. RCTAlertController can't find the correct root vc in such scene based apps.
Changelog
[iOS] [Fixed] - Fix RCTAlertController not showing when using SceneDelegate on iOS 13.0+.
Test Plan