stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.29k stars 263 forks source link

fix: Finding main view controller on iOS #1736

Open dluksza opened 2 months ago

dluksza commented 2 months ago

In a situation when rootViewController is not set by the application, the main view controller is not found, resulting in error:

Attempt to present on (from ) whose view is not in the window hierarchy.

which then prevents the Stripe bottom sheet from showing. Blocking the payment flow.

To prevent this, a fallback is added to traverse the windows hierarchy and find the first one that has isKeyWindow set to true.

Testing

Documentation

Select one:

CLAassistant commented 2 months ago

CLA assistant check
All committers have signed the CLA.

DaveMiller-Stadion commented 2 months ago

Very good catch @dluksza, hopefully we can go back to a release version of stripe before we launch the marketplace for OneFootball and 11TeamSports end of next month.

pastre commented 1 month ago

hey @charliecruzan-stripe, what are we missing to get this in? Sorry to bother, but we're happy to make any changes requested and go back to use Stripe from trunk :D