akveo / react-native-ui-kitten

:boom: React Native UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/react-native-ui-kitten/
MIT License
10.19k stars 952 forks source link

Apple Pay (live not test) popup window disappears immediately #1815

Closed obayit closed 1 month ago

obayit commented 1 month ago

🐛 Bug Report

I am integrating payments with oppwa. And the Apple Pay popup window works properly in testing mode. But in live mode it disappears immediately, I never thought that the cause could be from how UI-Kitten works, because it was working in the test mode.

The relevant part of my code is this:

internal class OppwaHandler: NSObject, UINavigationControllerDelegate, OPPThreeDSEventListener, PKPaymentAuthorizationViewControllerDelegate {
    // constants
    let viewController = RCTPresentedViewController()

    // ... some irrelevant code

    public func onApplePay(params: ApplePayParams) -> String {
         // ... some irrelevant code
        if let rootViewController = self.viewController {
            if let vc = PKPaymentAuthorizationViewController(paymentRequest: request) as PKPaymentAuthorizationViewController? {
                vc.delegate = self

                DispatchQueue.main.async {
                    rootViewController.present(vc, animated: true, completion: nil)
                }
                return "Ok. reached end of ok logic"
            } else {
                return "Apple Pay not supported."
            }
        }else{
            return "Not showing view controller"
        }

The issue is that in my code, the instance rootViewController type is RCTModalHostViewController instead of UIViewController. I don't know how view controllers work, but when I removed all UI Kitten code, the type of the controller was UIViewController and the pop did not disappear.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Link to runnable example or repository (highly encouraged)

UI Kitten and Eva version

Package Version
@eva-design/eva 2.1.1
@ui-kitten/components 5.1.2

Environment information

obayit commented 1 month ago

I found the cause of my issue, it is not a bug in UI Kitten.

I was already presenting a modal, and iOS does not allow more than one modal to be presented. The modal I was presenting was a Loading modal.