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 DatePicker crash on iPad #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Tug
Copy link

@Tug Tug commented Feb 7, 2023

I noticed the following error while using the universal design system you've built and trying to open the date picker on iPad:

Your application has presented a UIAlertController (<UIAlertController: 0x7fa4e56dda00>) of style
UIAlertControllerStyleActionSheet from UIViewController (<UIViewController: 0x7fa500c59390>). 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.

This PR is an attempt to fix it.
Disclaimer: my knowledge of iOS is very limited.

How to reproduce:

  • Open the "iPad (10th generation)" Simulator
  • Load the master branch of this project
  • yarn; cd example; rm -rf ios; yarn ios
  • Wait for the example app to load on the iPad sim
  • Click on the "Open picker" button, you should see the error in the console

Testing Instructions

  • Apply this patch
  • yarn ios
  • Check that the error is gone and that the date picker looks decent on iPad

Your application has presented a UIAlertController (<UIAlertController: 0x7fa4e56dda00>) of style
UIAlertControllerStyleActionSheet from UIViewController (<UIViewController: 0x7fa500c59390>). 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant