Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AddressSheet crashing app on iPad #1514

Closed
Ricckkzero opened this issue Sep 25, 2023 · 1 comment · Fixed by #1515
Closed

AddressSheet crashing app on iPad #1514

Ricckkzero opened this issue Sep 25, 2023 · 1 comment · Fixed by #1515

Comments

@Ricckkzero
Copy link

Hi there!

Describe the bug
I am using AddressSheet to fill in address details without any problem on iPhone devices. However, when I test my application on an iPad and try to open the address sheet, it crashes my app.

** Steps to Reproduce**

I use the following code (mainly from your docs):

import {
  AddressDetails,
  AddressSheet,
  AddressSheetError,
  useStripe,
} from '@stripe/stripe-react-native';
<AddressSheet
  appearance={{
    colors: {
      primary: '#F8F8F2',
      background: '#272822'
    }
  }}
  defaultValues={{
    phone: '111-222-3333',
    address: {
      country: 'United States',
      city: 'San Francisco',
    },
  }}
  visible={true}
  additionalFields={{
    phoneNumber: 'required',
  }}
  allowedCountries={['US', 'CA', 'GB']}
  primaryButtonTitle={'Use this address'}
  sheetTitle={'Shipping Address'}
/>

(added visible={true} here)

When debugging the issue initially, I figured out that by setting visible to false stopped crashing my app. Next to that, I am receiving this error when it crashes:

Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<UIPopoverPresentationController: 0x12ea2ed50>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'

Expected behavior
I would expect that I can open the address sheet without a problem on an iPad (or any other) device as well.

Version used
"@stripe/stripe-react-native": "0.33.0"

I know this is not the recommended beta version from the docs, but since this works on an iPhone I would expect this to also work on other devices.

Device information

  • Device: iPad
  • OS: 16.6.1
  • Modelname iPad (9th generation)

Hopefully this provides you with enough information!

I am planning to use this AddressSheet in production, would you recommend it right now? Since your docs say it's still in Beta (?).

Thank you in advance for your help/answers :)

@charliecruzan-stripe
Copy link
Collaborator

Hi @Ricckkzero! I'll look into this, but a workaround for now would be to use presentationStyle="fullscreen", that won't crash

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants