Skip to content
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 actionSheet position for iPad #194

Merged
merged 2 commits into from
May 2, 2024

Conversation

solilin
Copy link
Contributor

@solilin solilin commented Mar 14, 2024

There's an issue in the MenuComponent Demo on iPads. When clicking on menu icons, the app crashes with the following error:

Terminating app due to uncaught exception 'NSGenericException', reason: 'Your application has presented a UIAlertController (<UIAlertController: 0x106808800>) of style UIAlertControllerStyleActionSheet from UINavigationController (<UINavigationController: 0x10780aa00>). The modalPresentationStyle of a UIAlertController with this style is UIModalPresentationPopover. You must provide location information for this popover through the alert controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a barButtonItem.  If this information is not known when you present the alert controller, you may provide it in the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.

We need to specify the position for iPads

@joemasilotti
Copy link
Member

Thanks for this! This looks to fix the issue for the Overflow Menu example but remains broken for the Menu example. Do you have appetite to address that, too?

@solilin
Copy link
Contributor Author

solilin commented Apr 10, 2024

@joemasilotti, thanks for the comment. While I'm unsure if it's a good solution, I've still implemented it. If there's no rightBarButtonItem, then we open the popover in the center.

@joemasilotti
Copy link
Member

Excellent! Thanks for your contribution @solilin.

@joemasilotti joemasilotti merged commit cba8776 into hotwired:main May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants