-
Notifications
You must be signed in to change notification settings - Fork 24k
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
[iOS] - Display Alert correctly if app is using iOS13 Scenes API. #30740
Conversation
Hi @hellostu! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, 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. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Base commit: fc0b3fa |
Base commit: fc0b3fa |
Hello @hellostu could you please add photos that demonstrate the fix? Something that shows broken AlertController and then fixed. Thank you. |
anynews ? |
Hey @sammy-SC. Thanks for getting back to me and sorry for the late reply. If you are using the Scenes framework, then keyWindow doesn't work, which is react's mechanism for displaying an Alert. So this project demonstrates the fix: If you enable the Scenes framework on an existing project (as in the link above) then alerts simply don't display. This change would fix that by detecting the use of that framework and pointing to the correct UIWindow. I'm not sure how best to demo it in an image? |
@hellostu I think a video would demo it best. Something like:
Including code used to record the video is also helpful. |
This PR is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days |
This PR was closed because the author hasn't provided the requested feedback after 7 days. |
Summary
UIApplication.keyWindow
is deprecated. This is only a problem if an app is using the Scenes API. An app includes Scenes to display multiple windows and/or to enable the latest CarPlay. Using this API breaks Alerts. RCTAlertController usesUIApplication.keyWindow
to display an alert. It does not display if using the Scenes API. This PR fixes this issue by doing a check for iOS13 and use of the Scenes API. It then grabs the foreground window. It falls back to the previous implementation in the else case.Changelog
[iOS] [Fixed] - Display Alert correctly if app is using iOS13 Scenes API.
Test Plan
See React Native test app to demonstrate the fix below:
https://github.com/mixcloud/SceneApiAlertTest