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 attempt to present view not in hierarchy #1924

Conversation

dluksza
Copy link

@dluksza dluksza commented Sep 11, 2024

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

Attempt to present <STP_Internal_BottomSheetViewController> on <UIViewController> (from <UIViewController>) 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.

Co-authored-by: Bruno Pastre bruno.pastre@onefootball.com

dluksza and others added 2 commits September 11, 2024 13:24
In a situation when `rootViewController` is not set by the application,
the main view controller is not found, resulting in error:

  Attempt to present <STP_Internal_BottomSheetViewController> on
    <UIViewController> (from <UIViewController>) 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`.

Co-authored-by: Bruno Pastre <bruno.pastre@onefootball.com>
@jonasbark
Copy link
Member

Thanks for your contribution! This change would be overwritten from the next sync with https://github.com/stripe/stripe-react-native
Would you kindly add the same change into that repository?

@dluksza
Copy link
Author

dluksza commented Sep 20, 2024

this is now replaced by PR to stripe-react-native project stripe/stripe-react-native#1736

@dluksza dluksza closed this Sep 20, 2024
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.

2 participants